Java Code Examples for org.alfresco.service.cmr.dictionary.AspectDefinition#getName()
The following examples show how to use
org.alfresco.service.cmr.dictionary.AspectDefinition#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 | 6 votes |
/** * Process aspect definition * * @param xpp XmlPullParser * @param aspectDef AspectDefinition * @param parserContext ParserContext * @throws XmlPullParserException * @throws IOException */ private void processAspect(XmlPullParser xpp, AspectDefinition aspectDef, ParserContext parserContext) throws XmlPullParserException, IOException { NodeContext node = peekNodeContext(parserContext.elementStack); node.addAspect(aspectDef); int eventType = xpp.next(); if (eventType != XmlPullParser.END_TAG) { throw new ImporterException("Aspect " + aspectDef.getName() + " definition is not valid - it cannot contain any elements"); } if (logger.isDebugEnabled()) logger.debug(indentLog("Processed aspect " + aspectDef.getName(), parserContext.elementStack.size())); }
Example 2
Source File: WorkflowInterpreter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private void getMandatoryAspects(ClassDefinition classDef, List<QName> aspects) { for (AspectDefinition aspect : classDef.getDefaultAspects()) { QName aspectName = aspect.getName(); if (!aspects.contains(aspectName)) { aspects.add(aspect.getName()); getMandatoryAspects(aspect, aspects); } } }
Example 3
Source File: DictionaryComponent.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
/** * Gets a flattened list of all mandatory aspects for a given class * * @param classDef the class * @param aspects a list to hold the mandatory aspects */ private void getMandatoryAspects(ClassDefinition classDef, List<QName> aspects) { for (AspectDefinition aspect : classDef.getDefaultAspects()) { QName aspectName = aspect.getName(); if (!aspects.contains(aspectName)) { aspects.add(aspect.getName()); getMandatoryAspects(aspect, aspects); } } }
Example 4
Source File: CMISDictionaryRegistryImpl.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
private void addTypeExtensions(TypeDefinitionWrapper td) { QName classQName = td.getAlfrescoClass(); ClassDefinition classDef = dictionaryService.getClass(classQName); if(classDef != null) { // add mandatory/default aspects List<AspectDefinition> defaultAspects = classDef.getDefaultAspects(true); if(defaultAspects != null && defaultAspects.size() > 0) { List<CmisExtensionElement> mandatoryAspectsExtensions = new ArrayList<CmisExtensionElement>(); for(AspectDefinition aspectDef : defaultAspects) { QName aspectQName = aspectDef.getName(); TypeDefinitionWrapper aspectType = getTypeDefByQName(cmisMapping.getCmisType(aspectQName)); if (aspectType == null) { continue; } mandatoryAspectsExtensions.add(new CmisExtensionElementImpl(ALFRESCO_EXTENSION_NAMESPACE, MANDATORY_ASPECT, null, aspectType.getTypeId())); } if(!mandatoryAspectsExtensions.isEmpty()) { td.getTypeDefinition(true).setExtensions( Collections.singletonList((CmisExtensionElement) new CmisExtensionElementImpl( ALFRESCO_EXTENSION_NAMESPACE, MANDATORY_ASPECTS, null, mandatoryAspectsExtensions))); } } } }
Example 5
Source File: DbNodeServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Get any aspects that should be added given the type, properties and existing aspects. * Note that this <b>does not</b> included a search for properties required for the missing * aspects. * * @param classQName the type, aspect or association * @return Returns any aspects that should be added */ private Set<QName> getMissingAspects( Set<QName> existingAspects, Map<QName, Serializable> existingProperties, QName classQName) { // Copy incoming existing values so that we can modify appropriately existingAspects = new HashSet<QName>(existingAspects); ClassDefinition classDefinition = dictionaryService.getClass(classQName); if (classDefinition == null) { return Collections.emptySet(); } Set<QName> missingAspects = new HashSet<QName>(7); // Check that the aspect itself is present (only applicable for aspects) if (classDefinition.isAspect() && !existingAspects.contains(classQName)) { missingAspects.add(classQName); } // Find all aspects that should be present on the class List<AspectDefinition> defaultAspectDefs = classDefinition.getDefaultAspects(); for (AspectDefinition defaultAspectDef : defaultAspectDefs) { QName defaultAspect = defaultAspectDef.getName(); if (!existingAspects.contains(defaultAspect)) { missingAspects.add(defaultAspect); } } // Find all aspects that should be present given the existing properties for (QName existingPropQName : existingProperties.keySet()) { PropertyDefinition existingPropDef = dictionaryService.getProperty(existingPropQName); if (existingPropDef == null || !existingPropDef.getContainerClass().isAspect()) { continue; // Property is undefined or belongs to a class } QName existingPropDefiningType = existingPropDef.getContainerClass().getName(); if (!existingAspects.contains(existingPropDefiningType)) { missingAspects.add(existingPropDefiningType); } } // If there were missing aspects, recurse to find further missing aspects // Don't re-add ones we know about or we can end in infinite recursion. // Don't send any properties because we don't want to reprocess them each time Set<QName> allTypesAndAspects = new HashSet<QName>(13); allTypesAndAspects.add(classQName); allTypesAndAspects.addAll(existingAspects); allTypesAndAspects.addAll(missingAspects); Set<QName> missingAspectsCopy = new HashSet<QName>(missingAspects); for (QName missingAspect : missingAspectsCopy) { Set<QName> furtherMissingAspects = getMissingAspects( allTypesAndAspects, Collections.<QName, Serializable>emptyMap(), missingAspect); missingAspects.addAll(furtherMissingAspects); allTypesAndAspects.addAll(furtherMissingAspects); } // Done return missingAspects; }