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


Java ContentModel.ASSOC_CHILDREN属性代码示例

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


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

示例1: getAssocTypeQName

/**
 * Get the type of child association that should be created.
 * 
 * @param parentNodeRef the parent
 * @return Returns the appropriate child association type qualified name for the type of the
 *      parent.  Null will be returned if it can't be determined.
 */
private QName getAssocTypeQName(NodeRef parentNodeRef)
{
    // check the parent node's type to determine which association to use
    QName parentNodeTypeQName = nodeService.getType(parentNodeRef);
    QName assocTypeQName = null;
    if (dictionaryService.isSubClass(parentNodeTypeQName, ContentModel.TYPE_CONTAINER))
    {
        // it may be a root node or something similar
        assocTypeQName = ContentModel.ASSOC_CHILDREN;
    }
    else if (dictionaryService.isSubClass(parentNodeTypeQName, ContentModel.TYPE_FOLDER))
    {
        // more like a directory
        assocTypeQName = ContentModel.ASSOC_CONTAINS;
    }
    return assocTypeQName;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:FileImporterImpl.java

示例2: getPrimaryParent

/**
 * Simulates the node begin attached to the root node of the version store.
 */
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException
{
    return new ChildAssociationRef(
            ContentModel.ASSOC_CHILDREN,
            dbNodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID)),
            rootAssocName,
            nodeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:Node2ServiceImpl.java

示例3: getPrimaryParent

/**
 * Simulates the node begin attached ot the root node of the version store.
 */
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException
{
    return new ChildAssociationRef(
            ContentModel.ASSOC_CHILDREN,
            dbNodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, STORE_ID)),
            rootAssocName,
            nodeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:NodeServiceImpl.java

示例4: getPrimaryAssocTypeQName

public QName getPrimaryAssocTypeQName()
{
    
    Field field = getDocument().getField("PRIMARYASSOCTYPEQNAME");
    if (field != null)
    {
        String qname = field.stringValue();
        return QName.createQName(qname);
    }
    else
    {
        return ContentModel.ASSOC_CHILDREN;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:LuceneResultSetRow.java

示例5: getArchiveNodeRefAssocTypePair

private Pair<NodeRef, QName> getArchiveNodeRefAssocTypePair(final NodeRef archiveStoreRootNodeRef)
{
    final String currentUser = getCurrentUser();

    if (archiveStoreRootNodeRef == null || !nodeService.exists(archiveStoreRootNodeRef))
    {
        throw new InvalidNodeRefException("Invalid archive store root node Ref.",
                    archiveStoreRootNodeRef);
    }

    if (hasAdminAccess(currentUser))
    {
        return new Pair<NodeRef, QName>(archiveStoreRootNodeRef, ContentModel.ASSOC_CHILDREN);
    }
    else
    {
        List<ChildAssociationRef> list = AuthenticationUtil.runAs(new RunAsWork<List<ChildAssociationRef>>()
        {
            @Override
            public List<ChildAssociationRef> doWork() throws Exception
            {
                return nodeService.getChildrenByName(archiveStoreRootNodeRef,
                        ContentModel.ASSOC_ARCHIVE_USER_LINK,
                        Collections.singletonList(currentUser));
            }
        }, AuthenticationUtil.getAdminUserName());

        // Empty list means that the current user hasn't deleted anything yet.
        if (list == null || list.isEmpty())
        {
            return new Pair<NodeRef, QName>(null, null);
        }
        NodeRef userArchive = list.get(0).getChildRef();
        return new Pair<NodeRef, QName>(userArchive, ContentModel.ASSOC_ARCHIVED_LINK);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:NodeArchiveServiceImpl.java

示例6: createUser

public static void createUser(
        String userName, 
        String password, 
        String email,
        NodeRef rootNodeRef,
        NodeService nodeService,
        MutableAuthenticationService authenticationService)
{    
    // ignore if the user's authentication already exists
    if (authenticationService.authenticationExists(userName))
    {
        // ignore
        return;
    }
    QName children = ContentModel.ASSOC_CHILDREN;
    QName system = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "system");
    QName container = ContentModel.TYPE_CONTAINER;
    QName types = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "people");
    
    NodeRef systemNodeRef = nodeService.createNode(rootNodeRef, children, system, container).getChildRef();
    NodeRef typesNodeRef = nodeService.createNode(systemNodeRef, children, types, container).getChildRef();
    
    HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(ContentModel.PROP_USERNAME, userName);
    if (email != null && email.length() != 0)
    {
        properties.put(ContentModel.PROP_EMAIL, email);
    }
    nodeService.createNode(typesNodeRef, children, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, userName) , container, properties);
    
    // Create the users
    authenticationService.createAuthentication(userName, password.toCharArray()); 
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:TestWithUserUtils.java

示例7: detectNodeChanges

public void detectNodeChanges(NodeRef nodeRef, SearchService searcher,
        Collection<ChildAssociationRef> addedParents, Collection<ChildAssociationRef> deletedParents,
        Collection<ChildAssociationRef> createdNodes, Collection<NodeRef> updatedNodes) throws LuceneIndexException
{
    boolean nodeExisted = false;
    boolean relationshipsChanged = false;
    
    ResultSet results = null;
    SearchParameters sp = new SearchParameters();
    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    sp.addStore(nodeRef.getStoreRef());
    try
    {
        sp.setQuery("ID:" + SearchLanguageConversion.escapeLuceneQuery(nodeRef.toString()));
        results = searcher.query(sp);
        for (ResultSetRow row : results)
        {
            nodeExisted = true;
            Document document = ((LuceneResultSetRow) row).getDocument();
            Field qname = document.getField("QNAME");
            if (qname == null)
            {
                continue;
            }
            Collection<Pair<ChildAssociationRef, QName>> allParents = getAllParents(nodeRef, nodeService.getProperties(nodeRef));
            Set<ChildAssociationRef> dbParents = new HashSet<ChildAssociationRef>(allParents.size() * 2);
            for (Pair<ChildAssociationRef, QName> pair : allParents)
            {
                ChildAssociationRef qNameRef = tenantService.getName(pair.getFirst());
                if ((qNameRef != null) && (qNameRef.getParentRef() != null) && (qNameRef.getQName() != null))
                {
                    dbParents.add(new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, qNameRef.getParentRef(), qNameRef.getQName(), qNameRef.getChildRef()));
                }
            }
                           
            Field[] parents = document.getFields("PARENT");
            String[] qnames = qname.stringValue().split(";/");
            Set<ChildAssociationRef> addedParentsSet = new HashSet<ChildAssociationRef>(dbParents);
            for (int i=0; i<Math.min(parents.length, qnames.length); i++)
            {
                QName parentQname = QName.createQName(qnames[i]);
                parentQname = QName.createQName(parentQname.getNamespaceURI(), ISO9075.decode(parentQname.getLocalName()));
                NodeRef parentRef = new NodeRef(parents[i].stringValue());
                ChildAssociationRef indexedParent = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, parentRef, parentQname, nodeRef);
                if (!addedParentsSet.remove(indexedParent))
                {
                    deletedParents.add(indexedParent);                        
                    relationshipsChanged = true;
                }
            }
            if (addedParents.addAll(addedParentsSet))
            {
                relationshipsChanged = true;
            }

            break;
        }

        if (!nodeExisted)
        {
            createdNodes.add(nodeService.getPrimaryParent(nodeRef));
        }
        else if (!relationshipsChanged)
        {
            updatedNodes.add(nodeRef);
        }
    }
    finally
    {
        if (results != null) { results.close(); }
    }
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:73,代码来源:ADMLuceneIndexerImpl.java

示例8: getPath

@Override
public Path getPath(Reference reference) throws VirtualizationException
{
    Reference virtualPathElement = reference;
    Reference virtualPathParent = reference.execute(new GetParentReferenceMethod());

    Path virtualPath = new Path();

    while (virtualPathElement != null && virtualPathParent != null)
    {
        NodeRef parentNodeRef;

        parentNodeRef = virtualPathParent.toNodeRef();

        NodeRef parent = parentNodeRef;

        NodeRef virtualPathNodeRef = virtualPathElement.toNodeRef();

        // TODO: extract node reference name into protocol method in order
        // to enforce path processing code reuse and consistency

        String templatePath = virtualPathElement.execute(new GetTemplatePathMethod()).trim();
        final String pathSeparator = "/";
        if (pathSeparator.equals(templatePath))
        {
            // found root
            break;
        }
        else if (templatePath.endsWith(pathSeparator))
        {
            templatePath = templatePath.substring(0,
                                                  templatePath.length() - 1);
        }
        int lastSeparator = templatePath.lastIndexOf(pathSeparator);
        String childId = templatePath.substring(lastSeparator + 1);
        VirtualFolderDefinition structure = resolveVirtualFolderDefinition(virtualPathParent);
        VirtualFolderDefinition child = structure.findChildById(childId);
        if (child == null)
        {
            throw new VirtualizationException("Invalid reference: " + reference.encode());
        }
        String childName = child.getName();
        QName childQName = QName.createQName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                             childName);

        ChildAssociationRef assocRef = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN,
                                                               parent,
                                                               childQName,
                                                               virtualPathNodeRef,
                                                               true,
                                                               -1);
        ChildAssocElement assocRefElement = new ChildAssocElement(assocRef);
        virtualPath.prepend(assocRefElement);

        virtualPathElement = virtualPathParent;
        virtualPathParent = virtualPathParent.execute(new GetParentReferenceMethod());
    }

    return virtualPath;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:60,代码来源:VirtualStoreImpl.java

示例9: reindexTransaction

/**
 * Perform full reindexing of the given transaction.  A read-only transaction is created
 * <b>if one doesn't already exist</b>.
 * 
 * @param txnId the transaction identifier
 */
public void reindexTransaction(final long txnId)
{
    if (logger.isDebugEnabled())
    {
        logger.debug("Reindexing transaction: " + txnId);
    }
    
    RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
    {
        public Object execute() throws Exception
        {
            // get the node references pertinent to the transaction
            List<NodeRef.Status> nodeStatuses = nodeDAO.getTxnChanges(txnId);
            // reindex each node
            for (NodeRef.Status nodeStatus : nodeStatuses)
            {
                NodeRef nodeRef = nodeStatus.getNodeRef();
                if (nodeStatus.isDeleted())                                 // node deleted
                {
                    // only the child node ref is relevant
                    ChildAssociationRef assocRef = new ChildAssociationRef(
                            ContentModel.ASSOC_CHILDREN,
                            null,
                            null,
                            nodeRef);
                  indexer.deleteNode(assocRef);
                }
                else                                                        // node created
                {
                    // reindex
                    indexer.updateNode(nodeRef);
                }
            }
            // done
            return null;
        }
    };
    transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true, false);
    // done
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:46,代码来源:FullIndexRecoveryComponent.java

示例10: setUp

public void setUp() throws Exception
{
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
    {
        throw new AlfrescoRuntimeException(
                "A previous tests did not clean up transaction: " +
                AlfrescoTransactionSupport.getTransactionId());
    }
    
    aclDaoComponent = (AclDAO) applicationContext.getBean("aclDAO");
    
    nodeService = (NodeService) applicationContext.getBean("nodeService");
    dictionaryService = (DictionaryService) applicationContext.getBean(ServiceRegistry.DICTIONARY_SERVICE
            .getLocalName());
    permissionService = (PermissionServiceSPI) applicationContext.getBean("permissionService");
    namespacePrefixResolver = (NamespacePrefixResolver) applicationContext
            .getBean(ServiceRegistry.NAMESPACE_SERVICE.getLocalName());
    authenticationService = (MutableAuthenticationService) applicationContext.getBean("authenticationService");
    authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    permissionModelDAO = (ModelDAO) applicationContext.getBean("permissionsModelDAO");
    personService = (PersonService) applicationContext.getBean("personService");
    authorityService = (AuthorityService) applicationContext.getBean("authorityService");
    
    authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
    authenticationDAO = (MutableAuthenticationDao) applicationContext.getBean("authenticationDao");
    transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
    
    testTX = transactionService.getUserTransaction();
    testTX.begin();
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.nanoTime());
    rootNodeRef = nodeService.getRootNode(storeRef);

    QName children = ContentModel.ASSOC_CHILDREN;
    QName system = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "system");
    QName container = ContentModel.TYPE_CONTAINER;
    QName types = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "people");

    systemNodeRef = nodeService.createNode(rootNodeRef, children, system, container).getChildRef();
    NodeRef typesNodeRef = nodeService.createNode(systemNodeRef, children, types, container).getChildRef();
    Map<QName, Serializable> props = createPersonProperties("andy");
    nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();
    props = createPersonProperties("lemur");
    nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();

    // create an authentication object e.g. the user
    if(authenticationDAO.userExists("andy"))
    {
        authenticationService.deleteAuthentication("andy");
    }
    authenticationService.createAuthentication("andy", "andy".toCharArray());

    if(authenticationDAO.userExists("lemur"))
    {
        authenticationService.deleteAuthentication("lemur");
    }
    authenticationService.createAuthentication("lemur", "lemur".toCharArray());
    
    if(authenticationDAO.userExists(AuthenticationUtil.getAdminUserName()))
    {
        authenticationService.deleteAuthentication(AuthenticationUtil.getAdminUserName());
    }
    authenticationService.createAuthentication(AuthenticationUtil.getAdminUserName(), "admin".toCharArray());
    
    authenticationComponent.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:68,代码来源:AclDaoComponentTest.java


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