Java Code Examples for org.alfresco.service.cmr.dictionary.AssociationDefinition#getName()
The following examples show how to use
org.alfresco.service.cmr.dictionary.AssociationDefinition#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewParser.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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)); }
Example 2
Source File: ParentContext.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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(); }
Example 3
Source File: IntegrityChecker.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @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); } } }
Example 4
Source File: IntegrityChecker.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * @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); } } }
Example 5
Source File: RelationshipTypeDefintionWrapper.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 4 votes |
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); }