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


Java AssociationDefinition.getName方法代码示例

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


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

示例1: getAssociationDefinitionName

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * Gets the qualified name of the association definition for the given unique name
 *
 * @param uniqueName The unique name
 * @return The qualified name of the association definition for the given unique name
 */
private QName getAssociationDefinitionName(String uniqueName)
{
    AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName);

    if (associationDefinition == null)
    {
        StringBuilder sb = new StringBuilder();
        sb.append("The qualified name for '")
            .append(uniqueName)
            .append("' was not found.");
        throw new AlfrescoRuntimeException(sb.toString());
    }

    return associationDefinition.getName();
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:22,代码来源:RelationshipServiceImpl.java

示例2: processStartAssoc

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * Process start of association definition
 * 
 * @param xpp XmlPullParser
 * @param assocDef AssociationDefinition
 * @param parserContext ParserContext
 * @throws XmlPullParserException
 * @throws IOException
 */
private void processStartAssoc(XmlPullParser xpp, AssociationDefinition assocDef, ParserContext parserContext)
    throws XmlPullParserException, IOException
{
    NodeContext node = peekNodeContext(parserContext.elementStack);
    importNode(parserContext, node);

    // Construct Child Association Context
    ParentContext parent = new ParentContext(assocDef.getName(), node, assocDef);
    parserContext.elementStack.push(parent);
    
    if (logger.isDebugEnabled())
        logger.debug(indentLog("Pushed " + parent, parserContext.elementStack.size() -1));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:ViewParser.java

示例3: ParentContext

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * Construct 
 * 
 * @param elementName QName
 * @param parent NodeContext
 * @param assocDef AssociationDefinition
 */
public ParentContext(QName elementName, NodeContext parent, AssociationDefinition assocDef)
{
    this(elementName, parent);
    
    TypeDefinition typeDef = parent.getTypeDefinition();
    if (typeDef != null)
    {
        //
        // Ensure association type is valid for node parent
        //
        
        // Build complete Type Definition
        Set<QName> allAspects = new HashSet<QName>();
        for (AspectDefinition typeAspect : parent.getTypeDefinition().getDefaultAspects())
        {
            allAspects.add(typeAspect.getName());
        }
        allAspects.addAll(parent.getNodeAspects());
        TypeDefinition anonymousType = getDictionaryService().getAnonymousType(parent.getTypeDefinition().getName(), allAspects);
        
        // Determine if Association is valid for Type Definition
        Map<QName, AssociationDefinition> nodeAssociations = anonymousType.getAssociations();
        if (nodeAssociations.containsKey(assocDef.getName()) == false)
        {
            throw new ImporterException("Association " + assocDef.getName() + " is not valid for node " + parent.getTypeDefinition().getName());
        }
    }
    
    parentRef = parent.getNodeRef();
    assocType = assocDef.getName();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:ParentContext.java

示例4: onAddAspect

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * @see PropertiesIntegrityEvent
 * @see AssocTargetMultiplicityIntegrityEvent
 */
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
    if (! storesToIgnore.contains(tenantService.getBaseName(nodeRef.getStoreRef()).toString()))
    {
        IntegrityEvent event = null;
        // check properties on node
        event = new PropertiesIntegrityEvent(nodeService, dictionaryService, nodeRef);
        save(event);
        
        // check for associations defined on the aspect
        AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
        if (aspectDef == null)
        {
            throw new DictionaryException("The aspect type is not recognized: " + aspectTypeQName);
        }
        Map<QName, AssociationDefinition> assocDefs = aspectDef.getAssociations();
        
        // check the multiplicity of each association with the node acting as a source
        for (AssociationDefinition assocDef : assocDefs.values())
        {
            QName assocTypeQName = assocDef.getName();
            // check target multiplicity
            event = new AssocTargetMultiplicityIntegrityEvent(
                    nodeService,
                    dictionaryService,
                    nodeRef,
                    assocTypeQName,
                    false);
            save(event);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:IntegrityChecker.java

示例5: associationExists

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * Check if an instance of the association already exists from the given
 * source node reference to the given target node reference
 *
 * @param associationDefinition The association definition
 * @param source The source node reference
 * @param target The target node reference
 * @return <code>true</code> if an association already exists, <code>false</code> otherwise
 */
private boolean associationExists(AssociationDefinition associationDefinition, NodeRef source, NodeRef target)
{
    boolean associationAlreadyExists = false;

    QName associationDefinitionName = associationDefinition.getName();
    if (associationDefinition.isChild())
    {
        List<ChildAssociationRef> childAssocs = getNodeService().getChildAssocs(source, associationDefinitionName, associationDefinitionName);
        for (ChildAssociationRef chAssRef : childAssocs)
        {
            if (chAssRef.getChildRef().equals(target))
            {
                associationAlreadyExists = true;
            }
        }
    }
    else
    {
        List<AssociationRef> assocs = getNodeService().getTargetAssocs(source, associationDefinitionName);
        for (AssociationRef assRef : assocs)
        {
            if (assRef.getTargetRef().equals(target))
            {
                associationAlreadyExists = true;
            }
        }
    }

    return associationAlreadyExists;
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:40,代码来源:RelationshipServiceImpl.java

示例6: onCreateNode

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * @see PropertiesIntegrityEvent
 * @see AssocTargetRoleIntegrityEvent
 * @see AssocTargetMultiplicityIntegrityEvent
 */
public void onCreateNode(ChildAssociationRef childAssocRef)
{
    NodeRef childRef = childAssocRef.getChildRef(); 
    if (! storesToIgnore.contains(tenantService.getBaseName(childRef.getStoreRef()).toString()))
    {
        IntegrityEvent event = null;
        // check properties on child node
        event = new PropertiesIntegrityEvent(
                nodeService,
                dictionaryService,
                childRef);
        save(event);
        
        // check that the multiplicity and other properties of the new association are allowed
        onCreateChildAssociation(childAssocRef, false);
        
        // check mandatory aspects
        event = new AspectsIntegrityEvent(nodeService, dictionaryService, childRef);
        save(event);
        
        // check for associations defined on the new node (child)
        QName childNodeTypeQName = nodeService.getType(childRef);
        ClassDefinition nodeTypeDef = dictionaryService.getClass(childNodeTypeQName);
        if (nodeTypeDef == null)
        {
            throw new DictionaryException("The node type is not recognized: " + childNodeTypeQName);
        }
        Map<QName, AssociationDefinition> childAssocDefs = nodeTypeDef.getAssociations();
        
        // check the multiplicity of each association with the node acting as a source
        for (AssociationDefinition assocDef : childAssocDefs.values())
        {
            QName assocTypeQName = assocDef.getName();
            // check target multiplicity
            event = new AssocTargetMultiplicityIntegrityEvent(
                    nodeService,
                    dictionaryService,
                    childRef,
                    assocTypeQName,
                    false);
            save(event);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:50,代码来源:IntegrityChecker.java

示例7: RelationshipTypeDefintionWrapper

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
public RelationshipTypeDefintionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping accessorMapping,
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, AssociationDefinition cmisAssocDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisAssocDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new RelationshipTypeDefinitionImpl();

    typeDef.setBaseTypeId(BaseTypeId.CMIS_RELATIONSHIP);
    typeDef.setId(typeId);
    typeDef.setLocalName(alfrescoName.getLocalName());
    typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());

    typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
    typeDef.setParentTypeId(BaseTypeId.CMIS_RELATIONSHIP.value());

    typeDef.setDisplayName(null);
    typeDef.setDescription(null);

    typeDef.setIsCreatable(true);
    typeDef.setIsQueryable(false);
    typeDef.setIsFulltextIndexed(false);
    typeDef.setIsControllablePolicy(false);
    typeDef.setIsControllableAcl(false);
    typeDef.setIsIncludedInSupertypeQuery(true);
    typeDef.setIsFileable(false);

    ArrayList<String> both = new ArrayList<String>(2);
    both.add(BaseTypeId.CMIS_DOCUMENT.value());
    both.add(BaseTypeId.CMIS_FOLDER.value());
    
    String sourceTypeId = cmisMapping.getCmisTypeId(cmisMapping
            .getCmisType(cmisAssocDef.getSourceClass().getName()));
    if (sourceTypeId != null)
    {
        typeDef.setAllowedSourceTypes(Collections.singletonList(sourceTypeId));
    }
    else
    {
        typeDef.setAllowedSourceTypes(both);
    }

    String targetTypeId = cmisMapping.getCmisTypeId(cmisMapping
            .getCmisType(cmisAssocDef.getTargetClass().getName()));
    if (targetTypeId != null)
    {
        typeDef.setAllowedTargetTypes(Collections.singletonList(targetTypeId));
    }
    else
    {
        typeDef.setAllowedTargetTypes(both);
    }

    typeDefInclProperties = CMISUtils.copy(typeDef);
    setTypeDefinition(typeDef, typeDefInclProperties);
    createActionEvaluators(accessorMapping, BaseTypeId.CMIS_RELATIONSHIP);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:59,代码来源:RelationshipTypeDefintionWrapper.java

示例8: removeRelationship

import org.alfresco.service.cmr.dictionary.AssociationDefinition; //导入方法依赖的package包/类
/**
 * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
public void removeRelationship(String uniqueName, NodeRef source, NodeRef target)
{
    mandatoryString("uniqueName", uniqueName);
    mandatory("source", source);
    mandatory("target", target);

    // Check that the association definition for the given unique name exists.
    AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName);
    if (associationDefinition == null)
    {
        StringBuilder sb = new StringBuilder();
        sb.append("No association definition found for '").
            append(uniqueName).
            append("'.");
        throw new IllegalArgumentException(sb.toString());
    }

    // Get the association definition name
    final QName associationDefinitionName = associationDefinition.getName();
    final NodeRef targetNode = target;
    final NodeRef sourceNode = source;

    invokeBeforeRemoveReference(sourceNode, targetNode, associationDefinitionName);

    if (associationDefinition.isChild())
    {
        AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
        {
            @Override
            public Void doWork()
            {
                List<ChildAssociationRef> children = getNodeService().getChildAssocs(sourceNode);
                for (ChildAssociationRef chRef : children)
                {
                    if (associationDefinitionName.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(targetNode))
                    {
                        getNodeService().removeChildAssociation(chRef);
                    }
                }

                return null;
            }
        });
    }
    else
    {
        getNodeService().removeAssociation(source, targetNode, associationDefinitionName);
    }

    invokeOnRemoveReference(source, targetNode, associationDefinitionName);
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:56,代码来源:RelationshipServiceImpl.java


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