当前位置: 首页>>代码示例>>Java>>正文


Java Pair.getSecond方法代码示例

本文整理汇总了Java中org.alfresco.util.Pair.getSecond方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getSecond方法的具体用法?Java Pair.getSecond怎么用?Java Pair.getSecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.util.Pair的用法示例。


在下文中一共展示了Pair.getSecond方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import org.alfresco.util.Pair; //导入方法依赖的package包/类
public void validate(String ticket) throws AuthenticationException
{
    String currentUser = null;
    try
    {
        String tenant = getPrevalidationTenantDomain();
        
        // clear context - to avoid MT concurrency issue (causing domain mismatch) - see also 'authenticate' above
        clearCurrentSecurityContext();
        currentUser = ticketComponent.validateTicket(ticket);
        authenticationComponent.setCurrentUser(currentUser, UserNameValidationMode.NONE);
        
        if (tenant == null)
        {
            Pair<String, String> userTenant = AuthenticationUtil.getUserTenant(currentUser);
            tenant = userTenant.getSecond();
        }
        TenantContextHolder.setTenantDomain(tenant);
    }
    catch (AuthenticationException ae)
    {
        clearCurrentSecurityContext();
        throw ae;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AuthenticationServiceImpl.java

示例2: compare

import org.alfresco.util.Pair; //导入方法依赖的package包/类
@Override
public int compare(R entry1, R entry2) {
   for(Pair<Comparator<R>, SortOrder> pc : comparators)
   {
      int result = pc.getFirst().compare(entry1, entry2);
      if(result != 0)
      {
         // Sorts differ, return
         if(pc.getSecond() == SortOrder.ASCENDING)
         {
            return result;
         }
         else
         {
            return 0 - result;
         }
      }
      else
      {
         // Sorts are the same, try the next along
      }
   }
   // No difference on any
   return 0;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AbstractQNameAwareCannedQueryFactory.java

示例3: getActivities

import org.alfresco.util.Pair; //导入方法依赖的package包/类
public List<Activity> getActivities(String personId, String siteId, boolean excludeUser, boolean excludeOthers)
{
	List<ActivityFeedEntity> feedEntities = activityService.getUserFeedEntries(personId, siteId, excludeUser, excludeOthers, 0);
	List<Activity> activities = new ArrayList<Activity>(feedEntities.size());
	for(ActivityFeedEntity entity : feedEntities)
	{
		String siteNetwork = entity.getSiteNetwork();
		Pair<String, String> pair = splitSiteNetwork(siteNetwork);
		siteId = pair.getFirst();
		String networkId = pair.getSecond();
		String postDateStr = PublicApiDateFormat.getDateFormat().format(entity.getPostDate());
		Activity activity = new Activity(entity.getId(), networkId, siteId, entity.getFeedUserId(), entity.getPostUserId(), postDateStr, entity.getActivityType(), parseActivitySummary(entity));
		activities.add(activity);
	}

	return activities;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:RepoService.java

示例4: getAttribute

import org.alfresco.util.Pair; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public Serializable getAttribute(Serializable ... keys)
{
    keys = normalizeKeys(keys);
    Pair<Long, Long> pair = propertyValueDAO.getPropertyUniqueContext(keys[0], keys[1], keys[2]);
    Serializable value = null;
    if (pair != null && pair.getSecond() != null)
    {
        Long valueId = pair.getSecond();
        value = propertyValueDAO.getPropertyById(valueId);
    }
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug(
                "Got attribute: \n" +
                "   Keys:   " + Arrays.asList(keys) + "\n" +
                "   Value: " + value);
    }
    return value;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AttributeServiceImpl.java

示例5: getLocalizedSibling

import org.alfresco.util.Pair; //导入方法依赖的package包/类
@Override
public NodeRef getLocalizedSibling(NodeRef nodeRef)
{
    Locale userLocale = I18NUtil.getLocale();
    
    String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
    NodeRef parentNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
    // Work out the base name we are working with
    Pair<String, String> split = getExtension(name, false);
    String base = split.getFirst();
    String ext = split.getSecond();
    
    NodeRef resultNodeRef = nodeRef;
    // Search for siblings with the same name
    Control resourceHelper = Control.getControl(Control.FORMAT_DEFAULT);
    List<Locale> candidateLocales = resourceHelper.getCandidateLocales(base, userLocale);
    for (Locale candidateLocale : candidateLocales)
    {
        String filename = resourceHelper.toBundleName(base, candidateLocale) + "." + ext;
        // Attempt to find the file
        NodeRef foundNodeRef = searchSimple(parentNodeRef, filename);
        if (foundNodeRef != null)   // TODO: Check for read permissions
        {
            resultNodeRef = foundNodeRef;
            break;
        }
    }
    // Done
    return resultNodeRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:FileFolderServiceImpl.java

示例6: getNodeRef

import org.alfresco.util.Pair; //导入方法依赖的package包/类
@Override
@Extend(traitAPI=NodeServiceTrait.class,extensionAPI=NodeServiceExtension.class)
public NodeRef getNodeRef(Long nodeId)
{
    Pair<Long, NodeRef> nodePair = nodeDAO.getNodePair(nodeId);
    return nodePair == null ? null : nodePair.getSecond();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:DbNodeServiceImpl.java

示例7: deleteQuickShareLinkExpiryAction

import org.alfresco.util.Pair; //导入方法依赖的package包/类
@Override
public void deleteQuickShareLinkExpiryAction(QuickShareLinkExpiryAction linkExpiryAction)
{
    ParameterCheck.mandatory("linkExpiryAction", linkExpiryAction);

    NodeRef nodeRef = null;
    try
    {
        Pair<String, NodeRef> pair = getTenantNodeRefFromSharedId(linkExpiryAction.getSharedId());
        nodeRef = pair.getSecond();
    }
    catch (InvalidSharedIdException ex)
    {
        // do nothing, as the node might be already unshared
    }
    final NodeRef sharedNodeRef = nodeRef;

    TenantUtil.runAsSystemTenant(() -> {
        // Delete the expiry action and its related persisted schedule
        deleteQuickShareLinkExpiryActionImpl(linkExpiryAction);

        // As the method is called directly (ie. not via unshareContent method which removes the aspect properties),
        // then we have to remove the 'expiryDate' property as well.
        if (sharedNodeRef != null && nodeService.getProperty(sharedNodeRef, QuickShareModel.PROP_QSHARE_EXPIRY_DATE) != null)
        {
            behaviourFilter.disableBehaviour(sharedNodeRef, ContentModel.ASPECT_AUDITABLE);
            try
            {
                nodeService.removeProperty(sharedNodeRef, QuickShareModel.PROP_QSHARE_EXPIRY_DATE);
            }
            finally
            {
                behaviourFilter.enableBehaviour(sharedNodeRef, ContentModel.ASPECT_AUDITABLE);
            }
        }
        return null;
    }, TenantUtil.getCurrentDomain());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:QuickShareServiceImpl.java

示例8: getAsHTTPAuthorization

import org.alfresco.util.Pair; //导入方法依赖的package包/类
/**
 * Returns the Ticket in the form used for HTTP Basic Authentication. 
 * This should be added as the value to a HTTP Request Header with 
 *  key Authorization
 */
public String getAsHTTPAuthorization()
{
    // Build from the Username and Password
    Pair<String,String> userPass = getAsUsernameAndPassword();
    Credentials credentials = new UsernamePasswordCredentials(userPass.getFirst(), userPass.getSecond());

    // Encode it into the required format
    String credentialsEncoded = Base64.encodeBytes(
            credentials.toString().getBytes(utf8), Base64.DONT_BREAK_LINES );
    
    // Mark it as Basic, and we're done
    return "Basic " + credentialsEncoded;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:AbstractRemoteAlfrescoTicketImpl.java

示例9: isAuthorityContainedImpl

import org.alfresco.util.Pair; //导入方法依赖的package包/类
/**
 * @param authorityNodeRef              a containing authority
 * @param authorityToFindRef            an authority to find in the hierarchy
 * @return                              Returns <tt>true</tt> if the authority to find occurs
 *                                      in the hierarchy and is reachable via the {@link ContentModel#ASSOC_MEMBER}
 *                                      association.
 */
private boolean isAuthorityContainedImpl(NodeRef authorityNodeRef, String authority, NodeRef authorityToFindRef,
        Set<String> positiveHits, Set<String> negativeHits)
{
    if (positiveHits.contains(authority))
    {
        return true;
    }
    if (negativeHits.contains(authority))
    {
        return false;
    }
    Pair<Map<NodeRef, String>, List<NodeRef>> childAuthorities = getChildAuthorities(authorityNodeRef);
    Map<NodeRef, String> childAuthorityMap = childAuthorities.getFirst();

    // Is the authority we are looking for in the set provided (NodeRef is lookup)
    if (childAuthorityMap.containsKey(authorityToFindRef))
    {
        positiveHits.add(authority);
        return true;
    }

    // Recurse on non-user authorities
    for (NodeRef nodeRef : childAuthorities.getSecond())
    {
        if (isAuthorityContainedImpl(nodeRef, childAuthorityMap.get(nodeRef),
                authorityToFindRef, positiveHits, negativeHits))
        {
            positiveHits.add(authority);
            return true;
        }
    }
    negativeHits.add(authority);
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:AuthorityDAOImpl.java

示例10: getCannedQuery

import org.alfresco.util.Pair; //导入方法依赖的package包/类
/**
 * Retrieve an optionally filtered/sorted instance of a {@link CannedQuery} based on parameters including request for a total count (up to a given max)
 * 
 * Note: if both filtering and sorting is required then the combined total of unique QName properties should be the 0 to 3.
 *
 * @param parentRef             parent node ref
 * @param pattern               the pattern to use to filter children (wildcard character is '*')
 * @param filterProps           filter props
 * @param inclusiveAspects      If not null, only child nodes with any aspect in this collection will be included in the results.
 * @param exclusiveAspects      If not null, any child nodes with any aspect in this collection will be excluded in the results.
 * @param includeAdministrators include administrators in the returned results
 * @param sortProps             sort property pairs (QName and Boolean - true if ascending)
 * @param pagingRequest         skipCount, maxItems - optionally queryExecutionId and requestTotalCountMax
 * 
 * @return                      an implementation that will execute the query
 */
public CannedQuery<NodeRef> getCannedQuery(NodeRef parentRef, String pattern, List<QName> filterProps, Set<QName> inclusiveAspects, Set<QName> exclusiveAspects, boolean includeAdministrators, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest)
{
    ParameterCheck.mandatory("parentRef", parentRef);
    ParameterCheck.mandatory("pagingRequest", pagingRequest);
    
    int requestTotalCountMax = pagingRequest.getRequestTotalCountMax();
    
    // specific query params - context (parent) and inclusive filters (property values)
    GetPeopleCannedQueryParams paramBean = new GetPeopleCannedQueryParams(tenantService.getName(parentRef), filterProps, pattern, inclusiveAspects, exclusiveAspects, includeAdministrators);

    // page details
    CannedQueryPageDetails cqpd = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems(), CannedQueryPageDetails.DEFAULT_PAGE_NUMBER, CannedQueryPageDetails.DEFAULT_PAGE_COUNT);
    
    // sort details
    CannedQuerySortDetails cqsd = null;
    if (sortProps != null)
    {
        List<Pair<? extends Object, SortOrder>> sortPairs = new ArrayList<Pair<? extends Object, SortOrder>>(sortProps.size());
        for (Pair<QName, Boolean> sortProp : sortProps)
        {
            boolean sortAsc = ((sortProp.getSecond() == null) || sortProp.getSecond());
            sortPairs.add(new Pair<QName, SortOrder>(sortProp.getFirst(), (sortAsc ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
        }
        
        cqsd = new CannedQuerySortDetails(sortPairs);
    }
    
    // create query params holder
    CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingRequest.getQueryExecutionId());
    
    // return canned query instance
    return getCannedQuery(params);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:50,代码来源:GetPeopleCannedQueryFactory.java

示例11: getLocalePair

import org.alfresco.util.Pair; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public Pair<Long, Locale> getLocalePair(Long id)
{
    if (id == null)
    {
        throw new IllegalArgumentException("Cannot look up entity by null ID.");
    }
    
    Pair<Long, String> entityPair = localeEntityCache.getByKey(id);
    if (entityPair == null)
    {
        throw new DataIntegrityViolationException("No locale exists for ID " + id);
    }
    String localeStr = entityPair.getSecond();
    // Convert the locale string to a locale
    Locale locale = null;
    if (LocaleEntity.DEFAULT_LOCALE_SUBSTITUTE.equals(localeStr))
    {
        locale = I18NUtil.getLocale();
    }
    else
    {
        locale = DefaultTypeConverter.INSTANCE.convert(Locale.class, entityPair.getSecond());
    }
    
    return new Pair<Long, Locale>(id, locale);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:AbstractLocaleDAOImpl.java

示例12: getTenantImpl

import org.alfresco.util.Pair; //导入方法依赖的package包/类
private TenantEntity getTenantImpl(String tenantDomain)
{
    tenantDomain = tenantDomain.toLowerCase();
    Pair<String, TenantEntity> entityPair = tenantEntityCache.getByKey(tenantDomain);
    if (entityPair == null)
    {
        // try lower-case to make sure
        entityPair = tenantEntityCache.getByKey(tenantDomain);
        if (entityPair == null)
        {
            return null;
        }
    }
    return entityPair.getSecond();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:AbstractTenantAdminDAOImpl.java

示例13: collectLostAndFoundNode

import org.alfresco.util.Pair; //导入方法依赖的package包/类
/**
 * TODO: Remove once ALF-12358 has been proven to be fixed i.e. no more orphans are created ... ever.
 */
private void collectLostAndFoundNode(Pair<Long, NodeRef> lostNodePair, String lostName)
{
    Long childNodeId = lostNodePair.getFirst();
    NodeRef lostNodeRef = lostNodePair.getSecond();
    
    Long newParentNodeId = getOrCreateLostAndFoundContainer(lostNodeRef.getStoreRef()).getId();
    
    String assocName = lostName+"-"+System.currentTimeMillis();
    // Create new primary assoc (re-home the orphan node under lost_found)
    ChildAssocEntity assoc = newChildAssocImpl(newParentNodeId, 
                                               childNodeId, 
                                               true, 
                                               ContentModel.ASSOC_CHILDREN, 
                                               QName.createQName(assocName), 
                                               assocName,
                                               true);
    
    // Touch the node; all caches are fine
    touchNode(childNodeId, null, null, false, false, false);
    
    // update cache
    boolean isRoot = false;
    boolean isStoreRoot = false;
    ParentAssocsInfo parentAssocInfo = new ParentAssocsInfo(isRoot, isStoreRoot, assoc);
    setParentAssocsCached(childNodeId, parentAssocInfo);
    
    // Account for index impact; remove the orphan committed to the index
    nodeIndexer.indexUpdateChildAssociation(
            new ChildAssociationRef(null, null, null, lostNodeRef),
            assoc.getRef(qnameDAO));
    
    /*
    // Update ACLs for moved tree - note: actually a NOOP if oldParentAclId is null
    Long newParentAclId = newParentNode.getAclId();
    Long oldParentAclId = null; // unknown
    accessControlListDAO.updateInheritance(childNodeId, oldParentAclId, newParentAclId);
    */
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:42,代码来源:AbstractNodeDAOImpl.java

示例14: removeChildAssociation

import org.alfresco.util.Pair; //导入方法依赖的package包/类
@Extend(traitAPI=NodeServiceTrait.class,extensionAPI=NodeServiceExtension.class)
public boolean removeChildAssociation(ChildAssociationRef childAssocRef)
{
    // The node(s) involved may not be pending deletion
    checkPendingDelete(childAssocRef.getParentRef());
    checkPendingDelete(childAssocRef.getChildRef());
    
    Long parentNodeId = getNodePairNotNull(childAssocRef.getParentRef()).getFirst();
    Long childNodeId = getNodePairNotNull(childAssocRef.getChildRef()).getFirst();
    QName assocTypeQName = childAssocRef.getTypeQName();
    QName assocQName = childAssocRef.getQName();
    Pair<Long, ChildAssociationRef> assocPair = nodeDAO.getChildAssoc(
            parentNodeId, childNodeId, assocTypeQName, assocQName);
    if (assocPair == null)
    {
        // No association exists
        return false;
    }
    Long assocId = assocPair.getFirst();
    ChildAssociationRef assocRef = assocPair.getSecond();
    if (assocRef.isPrimary())
    {
        NodeRef childNodeRef = assocRef.getChildRef();
        // Delete the child node
        this.deleteNode(childNodeRef);
        // Done
        return true;
    }
    else
    {
        // Delete the association
        invokeBeforeDeleteChildAssociation(childAssocRef);
        nodeDAO.deleteChildAssoc(assocId);
        invokeOnDeleteChildAssociation(childAssocRef);
        // Index
        nodeIndexer.indexDeleteChildAssociation(childAssocRef);
        // Done
        return true;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:DbNodeServiceImpl.java

示例15: getAclImpl

import org.alfresco.util.Pair; //导入方法依赖的package包/类
private AclEntity getAclImpl(Long id)
{
    if (id == null)
    {
        return null;
    }
    Pair<Long, AclEntity> entityPair = aclEntityCache.getByKey(id);
    if (entityPair == null)
    {
        return null;
    }
    return entityPair.getSecond();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:AbstractAclCrudDAOImpl.java


注:本文中的org.alfresco.util.Pair.getSecond方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。