本文整理汇总了Java中org.alfresco.service.cmr.site.SiteInfo类的典型用法代码示例。如果您正苦于以下问题:Java SiteInfo类的具体用法?Java SiteInfo怎么用?Java SiteInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SiteInfo类属于org.alfresco.service.cmr.site包,在下文中一共展示了SiteInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doPeopleACPExport
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
protected void doPeopleACPExport(final List<NodeRef> peopleNodes, SiteInfo site, CloseIgnoringOutputStream writeTo) throws IOException
{
if (!peopleNodes.isEmpty())
{
// Build the parameters
ExporterCrawlerParameters parameters = new ExporterCrawlerParameters();
parameters.setExportFrom(new Location(peopleNodes.toArray(new NodeRef[peopleNodes.size()])));
parameters.setCrawlChildNodes(true);
parameters.setCrawlSelf(true);
parameters.setCrawlContent(true);
// And the export handler
ACPExportPackageHandler handler = new ACPExportPackageHandler(
writeTo,
new File(site.getShortName() + "-people.xml"),
new File(site.getShortName() + "-people"),
mimetypeService);
// Do the export
exporterService.exportView(handler, parameters, null);
}
}
示例2: getSite
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
/**
* Get a site for a provided site short name.
* <p>
* Returns null if the site does not exist.
*
* @param shortName short name of the site
* @return Site the site, null if does not exist
*/
public Site getSite(final String shortName)
{
SiteInfo siteInfo = null;
Site site = null;
if (siteService.isSiteAdmin(AuthenticationUtil.getFullyAuthenticatedUser()))
{
siteInfo = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<SiteInfo>()
{
public SiteInfo doWork() throws Exception
{
return siteService.getSite(shortName);
}
}, AuthenticationUtil.getAdminUserName());
}
else
{
siteInfo = this.siteService.getSite(shortName);
}
if (siteInfo != null)
{
site = new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
}
return site;
}
示例3: getSiteInfo
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
/**
* Get a site for a provided site short name. If the current user does not have permission to view the site content, the info
* will still be returned, but none of the operations that would modify site information on save() will work. As usual ACLs
* will apply on any attempt to modify the Site object.
* <p>
* Returns null if the site does not exist.
*
* @param shortName short name of the site
* @return Site the site, null if does not exist
*/
public Site getSiteInfo(final String shortName)
{
Site site = null;
SiteInfo siteInfo = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<SiteInfo>()
{
public SiteInfo doWork() throws Exception
{
return siteService.getSite(shortName);
}
}, AuthenticationUtil.getAdminUserName());
if (siteInfo != null)
{
site = new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
}
return site;
}
示例4: listSites
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
/**
* @see org.alfresco.service.cmr.site.SiteService#listSites(java.lang.String, int)
*/
public List<SiteInfo> listSites(final String userName, final int size)
{
// MT share - for activity service remote system callback (deprecated)
if (tenantService.isEnabled() &&
TenantUtil.isCurrentDomainDefault() &&
(AuthenticationUtil.SYSTEM_USER_NAME.equals(AuthenticationUtil.getRunAsUser())) &&
tenantService.isTenantUser(userName))
{
final String tenantDomain = tenantService.getUserDomain(userName);
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<List<SiteInfo>>()
{
public List<SiteInfo> doWork() throws Exception
{
return listSitesImpl(userName, size);
}
}, tenantDomain);
}
else
{
return listSitesImpl(userName, size);
}
}
示例5: setUp
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
super.setUp();
this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
this.activityService = (ActivityService)getServer().getApplicationContext().getBean("activityService");
ChildApplicationContextFactory activitiesFeed = (ChildApplicationContextFactory)getServer().getApplicationContext().getBean("ActivitiesFeed");
ApplicationContext activitiesFeedCtx = activitiesFeed.getApplicationContext();
this.feedGenerator = (FeedGenerator)activitiesFeedCtx.getBean("feedGenerator");
this.postLookup = (PostLookup)activitiesFeedCtx.getBean("postLookup");
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create test site
// - only create the site if it doesn't already exist
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_BLOG);
if (siteInfo == null)
{
this.siteService.createSite("BlogSitePreset", SITE_SHORT_NAME_BLOG, "BlogSiteTitle", "BlogSiteDescription", SiteVisibility.PUBLIC);
}
// Create users
createUser(USER_ONE, SiteModel.SITE_COLLABORATOR, SITE_SHORT_NAME_BLOG);
createUser(USER_TWO, SiteModel.SITE_COLLABORATOR, SITE_SHORT_NAME_BLOG);
// Blank our lists used to track things the test creates
posts = new ArrayList<String>(5);
drafts = new ArrayList<String>(5);
// Do tests as inviter user
this.authenticationComponent.setCurrentUser(USER_ONE);
}
示例6: SiteMembership
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
public SiteMembership(SiteInfo siteInfo, String personId, String role)
{
super();
if (siteInfo == null)
{
throw new java.lang.IllegalArgumentException();
}
if (personId == null)
{
throw new java.lang.IllegalArgumentException(
"Person required building site membership of " + siteInfo.getShortName());
}
if (role == null)
{
throw new java.lang.IllegalArgumentException(
"Role required building site membership of " + siteInfo.getShortName());
}
this.siteInfo = siteInfo;
this.personId = personId;
this.role = role;
}
示例7: getDisplayLabel
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
@Override
public FacetLabel getDisplayLabel(String value)
{
// Solr returns the site short name encoded
value = ISO9075.decode(value);
String title = null;
if (nonSiteLocationsLabels.containsKey(value))
{
title = nonSiteLocationsLabels.get(value);
}
else
{
SiteService siteService = serviceRegistry.getSiteService();
SiteInfo siteInfo = siteService.getSite(value);
title = siteInfo != null ? siteInfo.getTitle() : value;
}
return new FacetLabel(value, title, -1);
}
示例8: tearDown
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
@Override
protected void tearDown() throws Exception
{
super.tearDown();
SiteInfo site = siteService.getSite(TEST_SITE_NAME);
// use retrying transaction to delete the site
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
// delete the test site
siteService.deleteSite(TEST_SITE_NAME);
return null;
}
});
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef()));
AuthenticationUtil.clearCurrentSecurityContext();
}
示例9: postFileFolderUpdated
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void postFileFolderUpdated(boolean isFolder, NodeRef nodeRef)
{
if(activitiesEnabled && !hiddenAspect.hasHiddenAspect(nodeRef))
{
SiteInfo siteInfo = siteService.getSite(nodeRef);
String siteId = (siteInfo != null ? siteInfo.getShortName() : null);
if(siteId != null && !siteId.equals(""))
{
// post only for nodes within sites
String fileName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
if (!isFolder)
{
FileInfo fileInfo = fileFolderService.getFileInfo(nodeRef);
poster.postFileFolderActivity(ActivityType.FILE_UPDATED, null, getCurrentTenantDomain(),
siteId, null, nodeRef, fileName, APP_TOOL, Client.asType(ClientType.cmis), fileInfo);
}
}
}
}
示例10: listSitesIncludingSubTypesOfSite
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
/**
* This method ensures that {@link SiteService#listSites(String)} includes content subtypes of {@link SiteModel#TYPE_SITE st:site}.
*/
@Test public void listSitesIncludingSubTypesOfSite() throws Exception
{
TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
PagingResults<SiteInfo> sites = SITE_SERVICE.listSites(null, null, new PagingRequest(0, 1024));
Map<String, SiteInfo> sitesByName = new HashMap<String, SiteInfo>();
for (SiteInfo site : sites.getPage())
{
sitesByName.put(site.getShortName(), site);
}
assertNotNull("st:site missing.", sitesByName.get(TEST_SITE_NAME));
assertNotNull("subtype of st:site missing.", sitesByName.get(TEST_SUB_SITE_NAME));
return null;
}
});
}
示例11: getFavouriteSites
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
public CollectionWithPagingInfo<FavouriteSite> getFavouriteSites(String personId, Parameters parameters)
{
personId = people.validatePerson(personId);
Paging paging = parameters.getPaging();
BeanPropertiesFilter filter = parameters.getFilter();
PagingResults<SiteInfo> favouriteSites = getFavouriteSites(personId, Util.getPagingRequest(paging));
List<FavouriteSite> favourites = new ArrayList<FavouriteSite>(favouriteSites.getPage().size());
for(SiteInfo favouriteSite : favouriteSites.getPage())
{
String role = null;
if(filter.isAllowed(Site.ROLE))
{
role = getSiteRole(favouriteSite.getShortName(), personId);
}
FavouriteSite favourite = new FavouriteSite(favouriteSite, role);
favourites.add(favourite);
}
return CollectionWithPagingInfo.asPaged(paging, favourites, favouriteSites.hasMoreItems(), favouriteSites.getTotalResultCount().getFirst());
}
示例12: checkSiteInfo
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
private void checkSiteInfo(SiteInfo siteInfo,
String expectedSitePreset,
String expectedShortName,
String expectedTitle,
String expectedDescription,
SiteVisibility expectedVisibility)
{
assertNotNull(siteInfo);
assertEquals(expectedSitePreset, siteInfo.getSitePreset());
assertEquals(expectedShortName, siteInfo.getShortName());
assertEquals(expectedTitle, siteInfo.getTitle());
assertEquals(expectedDescription, siteInfo.getDescription());
assertEquals(expectedVisibility, siteInfo.getVisibility());
assertNotNull(siteInfo.getNodeRef());
// Check that the site is a tag scope
assertTrue(this.taggingService.isTagScope(siteInfo.getNodeRef()));
}
示例13: testDeleteSite_ViaNodeService
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
public void testDeleteSite_ViaNodeService()
{
String siteShortName = "testUpdateSite";
this.siteService.createSite(TEST_SITE_PRESET, siteShortName, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
SiteInfo siteInfo = this.siteService.getSite(siteShortName);
assertNotNull(siteInfo);
// delete a site through the nodeService - not allowed
try
{
nodeService.deleteNode(siteInfo.getNodeRef());
fail("Shouldn't be able to delete a site via the nodeService");
}
catch (AlfrescoRuntimeException expected)
{
// Intentionally empty
}
}
示例14: removeFavouriteSite
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
public void removeFavouriteSite(String personId, String siteId)
{
personId = people.validatePerson(personId);
SiteInfo siteInfo = validateSite(siteId);
if(siteInfo == null)
{
// site does not exist
throw new RelationshipResourceNotFoundException(personId, siteId);
}
siteId = siteInfo.getShortName();
StringBuilder prefKey = new StringBuilder(FAVOURITE_SITES_PREFIX);
prefKey.append(siteId);
String value = (String)preferenceService.getPreference(personId, prefKey.toString());
boolean isFavouriteSite = (value == null ? false : value.equalsIgnoreCase("true"));
if(!isFavouriteSite)
{
throw new NotFoundException("Site " + siteId + " is not a favourite site");
}
preferenceService.clearPreferences(personId, prefKey.toString());
}
示例15: getBlogPostList
import org.alfresco.service.cmr.site.SiteInfo; //导入依赖的package包/类
/**
* Fetches all posts of the given blog
*/
private PagingResults<BlogPostInfo> getBlogPostList(SiteInfo site, NodeRef nonSiteContainer,
Date fromDate, Date toDate, String tag, PagingRequest pagingReq)
{
// Currently we only support CannedQuery-based gets without tags:
if (tag == null || tag.trim().isEmpty())
{
return getBlogResultsImpl(site, nonSiteContainer, fromDate, toDate, pagingReq);
}
else
{
RangedDateProperty dateRange = new RangedDateProperty(fromDate, toDate, ContentModel.PROP_CREATED);
if(site != null)
{
return blogService.findBlogPosts(site.getShortName(), dateRange, tag, pagingReq);
}
else
{
return blogService.findBlogPosts(nonSiteContainer, dateRange, tag, pagingReq);
}
}
}