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


Java Pair类代码示例

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


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

示例1: AbstractPropertyValueDAOImpl

import org.alfresco.util.Pair; //导入依赖的package包/类
/**
 * Default constructor.
 * <p>
 * This sets up the DAO accessors to bypass any caching to handle the case where the caches are not
 * supplied in the setters.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public AbstractPropertyValueDAOImpl()
{
    this.propertyClassDaoCallback = new PropertyClassCallbackDAO();
    this.propertyDateValueCallback = new PropertyDateValueCallbackDAO();
    this.propertyStringValueCallback = new PropertyStringValueCallbackDAO();
    this.propertyDoubleValueCallback = new PropertyDoubleValueCallbackDAO();
    this.propertySerializableValueCallback = new PropertySerializableValueCallbackDAO();
    this.propertyValueCallback = new PropertyValueCallbackDAO();
    this.propertyCallback = new PropertyCallbackDAO();
    
    this.propertyClassCache = new EntityLookupCache<Long, Class<?>, String>(propertyClassDaoCallback);
    this.propertyDateValueCache = new EntityLookupCache<Long, Date, Date>(propertyDateValueCallback);
    this.propertyStringValueCache = new EntityLookupCache<Long, String, Pair<String, Long>>(propertyStringValueCallback);
    this.propertyDoubleValueCache = new EntityLookupCache<Long, Double, Double>(propertyDoubleValueCallback);
    this.propertySerializableValueCache = new EntityLookupCache<Long, Serializable, Serializable>(propertySerializableValueCallback);
    this.propertyValueCache = new EntityLookupCache<Long, Serializable, Serializable>(propertyValueCallback);
    this.propertyCache = new EntityLookupCache<Long, Serializable, Serializable>(propertyCallback);
    
    this.propertyUniqueContextCache = (SimpleCache<CachePucKey, PropertyUniqueContextEntity>)new NullCache();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:AbstractPropertyValueDAOImpl.java

示例2: removeAssociation

import org.alfresco.util.Pair; //导入依赖的package包/类
@Extend(traitAPI=NodeServiceTrait.class,extensionAPI=NodeServiceExtension.class)
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
        throws InvalidNodeRefException
{
    // The node(s) involved may not be pending deletion
    checkPendingDelete(sourceRef);
    checkPendingDelete(targetRef);
    
    Pair<Long, NodeRef> sourceNodePair = getNodePairNotNull(sourceRef);
    Long sourceNodeId = sourceNodePair.getFirst();
    Pair<Long, NodeRef> targetNodePair = getNodePairNotNull(targetRef);
    Long targetNodeId = targetNodePair.getFirst();

    AssociationRef assocRef = new AssociationRef(sourceRef, assocTypeQName, targetRef);
    // Invoke policy behaviours
    invokeBeforeDeleteAssociation(assocRef);

    // delete it
    int assocsDeleted = nodeDAO.removeNodeAssoc(sourceNodeId, targetNodeId, assocTypeQName);
    
    if (assocsDeleted > 0)
    {
        // Invoke policy behaviours
        invokeOnDeleteAssociation(assocRef);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:DbNodeServiceImpl.java

示例3: checkRequired

import org.alfresco.util.Pair; //导入依赖的package包/类
/**
 * Check that a given authentication is available on a node
 * 
 * @param authority String
 * @param aclId Long
 * @return true if a check is required
 */
boolean checkRequired(String authority, Long aclId)
{
    AccessControlList acl = aclDaoComponent.getAccessControlList(aclId);

    if (acl == null)
    {
        return false;
    }

    Set<Pair<String, PermissionReference>> denied = new HashSet<Pair<String, PermissionReference>>();

    // Check if each permission allows - the first wins.
    // We could have other voting style mechanisms here
    for (AccessControlEntry ace : acl.getEntries())
    {
        if (isGranted(ace, authority, denied))
        {
            return true;
        }
    }
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:PermissionServiceImpl.java

示例4: 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

示例5: tokeniseName

import org.alfresco.util.Pair; //导入依赖的package包/类
/**
 * This method will tokenise a name string in order to extract first name, last name - if possible.
 * The split is simple - it's made on the first whitespace within the trimmed nameFilter String. So
 * <p/>
 * "Luke Skywalker" becomes ["Luke", "Skywalker"].
 * <p/>
 * "Jar Jar Binks" becomes ["Jar", "Jar Binks"].
 * <p/>
 * "C-3PO" becomes null.
 * 
 * @param nameFilter String
 * @return A Pair<firstName, lastName> if the String is valid, else <tt>null</tt>.
 */
private Pair<String, String> tokeniseName(String nameFilter)
{
    Pair<String, String> result = null;
    
    if (nameFilter != null)
    {
        final String trimmedNameFilter = nameFilter.trim();
        
        // We can only have a first name and a last name if we have at least 3 characters e.g. "A B".
        if (trimmedNameFilter.length() > 3)
        {
            final String[] tokens = trimmedNameFilter.split(ON_FIRST_SPACE, 2);
            if (tokens.length == 2)
            {
                result = new Pair<String, String>(tokens[0], tokens[1]);
            }
        }
    }
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:ScriptAuthorityService.java

示例6: selectChildAssocsByPropertyValue

import org.alfresco.util.Pair; //导入依赖的package包/类
@Override
protected void selectChildAssocsByPropertyValue(Long parentNodeId,
        QName propertyQName, 
        NodePropertyValue nodeValue,
        ChildAssocRefQueryCallback resultsCallback)
{
    ChildPropertyEntity assocProp = new ChildPropertyEntity();
    // Parent
    assocProp.setParentNodeId(parentNodeId);
    // Property name
    Pair<Long,QName> propName = qnameDAO.getQName(propertyQName);
    if (propName == null)
    {
        resultsCallback.done();
        return;
    }
    
    // Property
    assocProp.setValue(nodeValue);
    assocProp.setPropertyQNameId(propName.getFirst());

    ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
    template.select(SELECT_CHILD_ASSOCS_BY_PROPERTY_VALUE, assocProp, resultHandler);
    resultsCallback.done();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:NodeDAOImpl.java

示例7: initKeys

import org.alfresco.util.Pair; //导入依赖的package包/类
private Pair<String[], Set<QName>> initKeys(Map<String, String> attributeMapping,
        String... extraAttibutes)
{
    // Compile a complete array of LDAP attribute names, including operational attributes
    Set<String> attributeSet = new TreeSet<String>();
    attributeSet.addAll(Arrays.asList(extraAttibutes));
    attributeSet.add(this.modifyTimestampAttributeName);
    for (String attribute : attributeMapping.values())
    {
        if (attribute != null)
        {
            attributeSet.add(attribute);
        }
    }
    String[] attributeNames = new String[attributeSet.size()];
    attributeSet.toArray(attributeNames);

    // Create a set with the property names converted to QNames
    Set<QName> qnames = new HashSet<QName>(attributeMapping.size() * 2);
    for (String property : attributeMapping.keySet())
    {
        qnames.add(QName.createQName(property, this.namespaceService));
    }

    return new Pair<String[], Set<QName>>(attributeNames, qnames);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:LDAPUserRegistry.java

示例8: splitByDomain

import org.alfresco.util.Pair; //导入依赖的package包/类
private Pair<String, String> splitByDomain(String name, String domainSeparator)
{
    int idx = name.lastIndexOf(domainSeparator);
    if (idx != -1)
    {
        if ((idx + 1) > name.length())
        {
            return new Pair<String, String>(name.substring(0, idx), "");
        }
        else
        {
            return new Pair<String, String>(name.substring(0, idx), name.substring(idx + 1));
        }
    }

    return new Pair<String, String>(name, "");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:UserNameMatcherImpl.java

示例9: testTimeLimit

import org.alfresco.util.Pair; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testTimeLimit()
{
    final RetryingTransactionHelper txnHelper = new RetryingTransactionHelper();
    txnHelper.setTransactionService(transactionService);
    txnHelper.setMaxExecutionMs(3000);
    final List<Throwable> caughtExceptions = Collections.synchronizedList(new LinkedList<Throwable>());

    // Try submitting a request after a timeout
    runThreads(txnHelper, caughtExceptions, new Pair(0, 1000), new Pair(0, 5000), new Pair(4000, 1000));
    assertEquals("Expected 1 exception", 1, caughtExceptions.size());
    assertTrue("Excpected TooBusyException", caughtExceptions.get(0) instanceof TooBusyException);

    // Stay within timeout limits
    caughtExceptions.clear();
    runThreads(txnHelper, caughtExceptions, new Pair(0, 1000), new Pair(0, 2000), new Pair(0, 1000), new Pair(1000, 1000), new Pair(1000, 2000), new Pair(2000, 1000));
    if (caughtExceptions.size() > 0)
    {
        throw new RuntimeException("Unexpected exception", caughtExceptions.get(0));
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:RetryingTransactionHelperTest.java

示例10: testAuditModel

import org.alfresco.util.Pair; //导入依赖的package包/类
public void testAuditModel() throws Exception
{
    final File file = AbstractContentTransformerTest.loadQuickTestFile("pdf");
    assertNotNull(file);
    final URL url = new URL("file:" + file.getAbsolutePath());
    RetryingTransactionCallback<Pair<Long, ContentData>> callback = new RetryingTransactionCallback<Pair<Long, ContentData>>()
    {
        public Pair<Long, ContentData> execute() throws Throwable
        {
            Pair<Long, ContentData> auditModelPair = auditDAO.getOrCreateAuditModel(url);
            return auditModelPair;
        }
    };
    Pair<Long, ContentData> configPair = txnHelper.doInTransaction(callback);
    assertNotNull(configPair);
    // Now repeat.  The results should be exactly the same.
    Pair<Long, ContentData> configPairCheck = txnHelper.doInTransaction(callback);
    assertNotNull(configPairCheck);
    assertEquals(configPair, configPairCheck);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AuditDAOTest.java

示例11: removeProperties

import org.alfresco.util.Pair; //导入依赖的package包/类
/**
 * Removes transformer properties from the supplied multi line propertyNames.
 * @param propertyNames which optionally include a value
 * @throws IllegalArgumentException if an unexpected line is found
 */
public int removeProperties(String propertyNames)
{
    Set<String> remove = new HashSet<String>();
    Map<String, String> transformerReferences = new HashMap<String, String>();
    Set<String> dynamicTransformerNames = new HashSet<String>();
    Properties defaultProperties = transformerProperties.getDefaultProperties();
    for (String propertyNameAndValue: extractProperties(propertyNames, false, transformerReferences, dynamicTransformerNames))
    {
        Pair<String, String> pair = splitNameAndValue(propertyNameAndValue);
        String propertyName = pair.getFirst();
        if (transformerProperties.getProperty(propertyName) == null)
        {
            throw unexpectedProperty("Does not exist", propertyName);
        }
        if (defaultProperties.getProperty(propertyName) != null)
        {
            throw unexpectedProperty("Is a deafult property so may not be removed", propertyName);
        }
        remove.add(propertyName);
    }
    transformerProperties.removeProperties(remove);
    return remove.size();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:TransformerPropertySetter.java

示例12: applyInternal

import org.alfresco.util.Pair; //导入依赖的package包/类
@Override
protected String applyInternal() throws Exception
{
    // We don't need to catch the potential InvalidQNameException here as it will be caught
    // in AbstractPatch and correctly handled there
    QName qnameBefore = QName.createQName(this.qnameStringBefore);
    QName qnameAfter = QName.createQName(this.qnameStringAfter);

    Long maxNodeId = patchDAO.getMaxAdmNodeID();
    
    Pair<Long, QName> before = qnameDAO.getQName(qnameBefore);
    
    if (before != null)
    {
        for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
        {
            Work work = new Work(before.getFirst(), i);
            retryingTransactionHelper.doInTransaction(work, false, true);
        }
        qnameDAO.updateQName(qnameBefore, qnameAfter);
    }

    return I18NUtil.getMessage(MSG_SUCCESS, qnameBefore, qnameAfter);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:QNamePatch.java

示例13: createPermission

import org.alfresco.util.Pair; //导入依赖的package包/类
public Permission createPermission(PermissionReference permissionReference)
{
    ParameterCheck.mandatory("permissionReference", permissionReference);
    
    PermissionEntity entity = null;
    
    // Get the persistent ID for the QName
    Pair<Long, QName> qnamePair = qnameDAO.getOrCreateQName(permissionReference.getQName());
    if (qnamePair != null)
    {
        Long qnameId  = qnamePair.getFirst();
        entity = new PermissionEntity(qnameId, permissionReference.getName());
        
        entity.setVersion(0L);
        
        Pair<Long, PermissionEntity> entityPair = permissionEntityCache.getOrCreateByValue(entity);
        entity = entityPair.getSecond();
    }
    return entity;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:AbstractAclCrudDAOImpl.java

示例14: list

import org.alfresco.util.Pair; //导入依赖的package包/类
@Override
public PagingResults<Reference> list(Reference ref, boolean actual, boolean virtual, Set<QName> searchTypeQNames,
            Set<QName> ignoreTypeQNames, Set<QName> ignoreAspectQNames, List<Pair<QName, Boolean>> sortProps,
            PagingRequest pagingRequest) throws VirtualizationException
{
    // TODO: find null string value for pattern
    return list(ref,
                actual,
                virtual,
                true,
                true,
                null,
                searchTypeQNames,
                Collections.<QName> emptySet(),
                ignoreAspectQNames,
                sortProps,
                pagingRequest);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:VirtualStoreImpl.java

示例15: getRendition

import org.alfresco.util.Pair; //导入依赖的package包/类
@Override
public Rendition getRendition(String sharedId, String renditionId)
{
    checkEnabled();
    checkValidShareId(sharedId);

    try
    {
        Pair<String, NodeRef> pair = quickShareService.getTenantNodeRefFromSharedId(sharedId);

        String networkTenantDomain = pair.getFirst();
        final NodeRef nodeRef = pair.getSecond();

        return TenantUtil.runAsSystemTenant(() ->
        {
            String nodeId = nodeRef.getId();
            Parameters params = getParamsWithCreatedStatus();
            return renditions.getRendition(nodeId, renditionId, params);

        }, networkTenantDomain);
    }
    catch (InvalidSharedIdException ex)
    {
        logger.warn("Unable to find: " + sharedId);
        throw new EntityNotFoundException(sharedId);
    }
    catch (InvalidNodeRefException inre)
    {
        logger.warn("Unable to find: " + sharedId + " [" + inre.getNodeRef() + "]");
        throw new EntityNotFoundException(sharedId);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:33,代码来源:QuickShareLinksImpl.java


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