本文整理汇总了Java中org.alfresco.service.cmr.site.SiteService.SortFields方法的典型用法代码示例。如果您正苦于以下问题:Java SiteService.SortFields方法的具体用法?Java SiteService.SortFields怎么用?Java SiteService.SortFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.site.SiteService
的用法示例。
在下文中一共展示了SiteService.SortFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listMembersPaged
import org.alfresco.service.cmr.site.SiteService; //导入方法依赖的package包/类
public PagingResults<SiteMembership> listMembersPaged(String shortName, boolean collapseGroups, List<Pair<SiteService.SortFields, Boolean>> sortProps, PagingRequest pagingRequest)
{
CannedQueryPageDetails pageDetails = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems());
// sort details
CannedQuerySortDetails sortDetails = null;
if(sortProps != null)
{
List<Pair<? extends Object, SortOrder>> sortPairs = new ArrayList<Pair<? extends Object, SortOrder>>(sortProps.size());
for (Pair<SiteService.SortFields, Boolean> sortProp : sortProps)
{
sortPairs.add(new Pair<SiteService.SortFields, SortOrder>(sortProp.getFirst(), (sortProp.getSecond() ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
}
sortDetails = new CannedQuerySortDetails(sortPairs);
}
SiteMembersCannedQueryParams parameterBean = new SiteMembersCannedQueryParams(shortName, collapseGroups);
CannedQueryParameters params = new CannedQueryParameters(parameterBean, pageDetails, sortDetails, pagingRequest.getRequestTotalCountMax(), pagingRequest.getQueryExecutionId());
CannedQuery<SiteMembership> query = new SiteMembersCannedQuery(this, personService, nodeService, params);
CannedQueryResults<SiteMembership> results = query.execute();
return getPagingResults(pagingRequest, results);
}
示例2: testCustomRole
import org.alfresco.service.cmr.site.SiteService; //导入方法依赖的package包/类
public void testCustomRole()
{
try
{
// Create a site
siteService.createSite("customrolessite", "customrolessite", "Test custom role", "Test custom role", SiteVisibility.PUBLIC);
this.siteService.setMembership("customrolessite", USER_TWO, "SiteCoordinator");
// Get the members of the site
final List<Pair<SiteService.SortFields, Boolean>> sort = new ArrayList<Pair<SiteService.SortFields, Boolean>>();
sort.add(new Pair<SiteService.SortFields, Boolean>(SiteService.SortFields.SiteTitle, Boolean.TRUE));
sort.add(new Pair<SiteService.SortFields, Boolean>(SiteService.SortFields.Role, Boolean.TRUE));
PagingResults<SiteMembership> sites = siteService.listSitesPaged(USER_TWO, sort, new PagingRequest(0, 100));
assertNotNull(sites);
assertEquals(sites.getPage().size(), 1);
}
catch (Exception ex)
{
fail("Custom role breaks sites API. Take a look on MNT-12873\n" + ex.getMessage());
}
}
示例3: getSiteMembers
import org.alfresco.service.cmr.site.SiteService; //导入方法依赖的package包/类
public CollectionWithPagingInfo<SiteMember> getSiteMembers(String siteId, Parameters parameters)
{
SiteInfo siteInfo = validateSite(siteId);
if(siteInfo == null)
{
// site does not exist
throw new EntityNotFoundException(siteId);
}
// set the site id to the short name (to deal with case sensitivity issues with using the siteId from the url)
siteId = siteInfo.getShortName();
Paging paging = parameters.getPaging();
PagingRequest pagingRequest = Util.getPagingRequest(paging);
final List<Pair<SiteService.SortFields, Boolean>> sort = new ArrayList<Pair<SiteService.SortFields, Boolean>>();
sort.add(new Pair<SiteService.SortFields, Boolean>(SiteService.SortFields.LastName, Boolean.TRUE));
sort.add(new Pair<SiteService.SortFields, Boolean>(SiteService.SortFields.FirstName, Boolean.TRUE));
sort.add(new Pair<SiteService.SortFields, Boolean>(SiteService.SortFields.Role, Boolean.TRUE));
sort.add(new Pair<SiteService.SortFields, Boolean>(SiteService.SortFields.Username, Boolean.TRUE));
PagingResults<SiteMembership> pagedResults = siteService.listMembersPaged(siteId, true, sort, pagingRequest);
List<SiteMembership> siteMembers = pagedResults.getPage();
List<SiteMember> ret = new ArrayList<SiteMember>(siteMembers.size());
for(SiteMembership siteMembership : siteMembers)
{
SiteMember siteMember = new SiteMember(siteMembership.getPersonId(), siteMembership.getRole());
ret.add(siteMember);
}
return CollectionWithPagingInfo.asPaged(paging, ret, pagedResults.hasMoreItems(), null);
}
示例4: getSites
import org.alfresco.service.cmr.site.SiteService; //导入方法依赖的package包/类
public CollectionWithPagingInfo<MemberOfSite> getSites(String personId, Parameters parameters)
{
Paging paging = parameters.getPaging();
personId = people.validatePerson(personId);
PagingRequest pagingRequest = Util.getPagingRequest(paging);
// get the sorting options
List<Pair<? extends Object, SortOrder>> sortPairs = new ArrayList<>(parameters.getSorting().size());
List<SortColumn> sortCols = parameters.getSorting();
if ((sortCols != null) && (sortCols.size() > 0))
{
for (SortColumn sortCol : sortCols)
{
SiteService.SortFields sortProp = SORT_SITE_MEMBERSHIP.get(sortCol.column);
if (sortProp == null)
{
throw new InvalidArgumentException("Invalid sort field: "+sortCol.column);
}
sortPairs.add(new Pair<>(sortProp, (sortCol.asc ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
}
}
else
{
// default sort order
sortPairs.add(new Pair<SiteService.SortFields, SortOrder>(
SiteService.SortFields.SiteTitle,
SortOrder.ASCENDING ));
}
// get the unsorted list of site memberships
List<SiteMembership> siteMembers = siteService.listSiteMemberships(personId, 0);
// sort the list of site memberships
int totalSize = siteMembers.size();
final List<SiteMembership> sortedSiteMembers = new ArrayList<>(siteMembers);
Collections.sort(sortedSiteMembers, new SiteMembershipComparator(
sortPairs,
SiteMembershipComparator.Type.SITES));
PageDetails pageDetails = PageDetails.getPageDetails(pagingRequest, totalSize);
List<MemberOfSite> ret = new ArrayList<>(totalSize);
List<FilterProp> filterProps = getFilterPropListOfSites(parameters);
int counter;
int totalItems = 0;
Iterator<SiteMembership> it = sortedSiteMembers.iterator();
for(counter = 0; it.hasNext();)
{
SiteMembership siteMember = it.next();
if (filterProps != null && !includeFilter(siteMember, filterProps))
{
continue;
}
if(counter < pageDetails.getSkipCount())
{
totalItems++;
counter++;
continue;
}
if (counter <= pageDetails.getEnd() - 1)
{
SiteInfo siteInfo = siteMember.getSiteInfo();
MemberOfSite memberOfSite = new MemberOfSite(siteInfo.getShortName(), siteInfo.getNodeRef(), siteMember.getRole());
ret.add(memberOfSite);
counter++;
}
totalItems++;
}
return CollectionWithPagingInfo.asPaged(paging, ret, counter < totalItems, totalItems);
}