private void validateTypeAspectDependency(Collection<? extends ClassDefinition> parentDefs, Collection<? extends ClassDefinition> childDefs) { for (ClassDefinition parentClassDef : parentDefs) { for (ClassDefinition childClassDef : childDefs) { if (parentClassDef.getName().equals(childClassDef.getParentName())) { Object[] msgParams = new Object[] { parentClassDef.getName().toPrefixString(), childClassDef.getName().toPrefixString(), childClassDef.getModel().getName().getLocalName() }; if (parentClassDef instanceof TypeDefinition) { throw new CustomModelException.CustomModelConstraintException(MSG_FAILED_DEACTIVATION_TYPE_DEPENDENCY, msgParams); } else { throw new CustomModelException.CustomModelConstraintException(MSG_FAILED_DEACTIVATION_ASPECT_DEPENDENCY, msgParams); } } } } }
Map<QName,PropertyDefinition> propertyDefinitions = classDefinition.getProperties(); for (QName propertyName : propertyDefinitions.keySet()) Map<QName, AssociationDefinition> assocDefs = classDefinition.getAssociations(); if (classDefinition.isContainer()) nodeDetails.addChildAssociation(classDefinition.getName(), childAssocRef); nodeDetails.addAssociation(classDefinition.getName(), nodeAssocRef);
private Set<PermissionReference> getAllPermissionsImpl(QName typeName, Set<QName> aspects, boolean exposedOnly) { Set<PermissionReference> permissions = new LinkedHashSet<PermissionReference>(128, 1.0f); ClassDefinition cd = dictionaryService.getClass(typeName); mutableState.lock.readLock().lock(); try { permissions.addAll(mutableState.getAllPermissionsImpl(typeName, exposedOnly)); if (cd != null && aspects != null) { Set<QName> defaultAspects = cd.getDefaultAspectNames(); for (QName aspect : aspects) { if (!defaultAspects.contains(aspect)) { mutableState.addAspectPermissions(aspect, permissions, exposedOnly); } } } } finally { mutableState.lock.readLock().unlock(); } return permissions; }
/** * Is the property unexportable? */ private boolean isExcludedAspectProperty(QName[] excludeAspects, QName propertyQName) { PropertyDefinition propDef = dictionaryService.getProperty(propertyQName); if (propDef == null) { return false; } ClassDefinition classDef = propDef.getContainerClass(); if (classDef == null || !classDef.isAspect()) { return false; } return isExcludedAspect(excludeAspects, classDef.getName()); }
if (classDefinition.isAspect() && !existingAspects.contains(classQName)) List<AspectDefinition> defaultAspectDefs = classDefinition.getDefaultAspects(); for (AspectDefinition defaultAspectDef : defaultAspectDefs) if (existingPropDef == null || !existingPropDef.getContainerClass().isAspect()) QName existingPropDefiningType = existingPropDef.getContainerClass().getName(); if (!existingAspects.contains(existingPropDefiningType))
private static void mockTargetClassName(QName targetClassName, MockClassAttributeDefinition mock) { when(mock.targetClass.getName()).thenReturn(targetClassName); }
if (propertyContainerDef.isAspect()) if (enableStringTagging && propertyContainerDef.getName().equals(ContentModel.ASPECT_TAGGABLE)) QName aspectQName = propertyContainerDef.getName(); requiredAspectQNames.add(aspectQName); Set<QName> aspectProperties = propertyContainerDef.getProperties().keySet(); aspectPropertyQNames.addAll(aspectProperties);
Map<QName, PropertyDefinition> propertyDefs = classDef.getProperties();
QName parentType = nodeService.getType(context.getParentContext().getParentRef()); ClassDefinition classDef = dictionaryService.getClass(parentType); Map<QName, ChildAssociationDefinition> childAssocDefs = classDef.getChildAssociations(); for (ChildAssociationDefinition childAssocDef : childAssocDefs.values()) targetTypes.put(childAssocDef.getTargetClass().getName(), childAssocDef.getName()); parentAspect); childAssocDefs = classDef.getChildAssociations(); for (ChildAssociationDefinition childAssocDef : childAssocDefs.values()) targetTypes.put(childAssocDef.getTargetClass().getName(), childAssocDef.getName()); testType = (testTypeDef == null) ? null : testTypeDef.getParentName();
/** * @param className the class name * @return the super class or <code>null</code> */ private QName generaliseClass(QName className) { ClassDefinition classDefinition = dictionaryService.getClass(className); if (classDefinition == null) { // The class definition doesn't exist return null; } QName parentClassName = classDefinition.getParentName(); return parentClassName; }
for (Map.Entry<QName, AssociationDefinition> entry : classDef.getAssociations().entrySet()) for (Map.Entry<QName, ChildAssociationDefinition> childEntry : classDef.getChildAssociations().entrySet())
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); } } }
for (Map.Entry<QName, Serializable> entry : classDefinition.getDefaultValues().entrySet())
Map<QName, AssociationDefinition> childAssocDefs = nodeTypeDef.getAssociations();
public void testArchive() { QName testFileQName = QName.createQName(TEST_URL, "file"); ClassDefinition fileClassDef = service.getClass(testFileQName); assertTrue("File type should have the archive flag", fileClassDef.getArchive()); QName testFileDerivedQName = QName.createQName(TEST_URL, "file-derived"); ClassDefinition fileDerivedClassDef = service.getClass(testFileDerivedQName); assertTrue("Direct derived File type should have the archive flag", fileDerivedClassDef.getArchive()); QName testFileDerivedNoArchiveQName = QName.createQName(TEST_URL, "file-derived-no-archive"); ClassDefinition fileDerivedNoArchiveClassDef = service.getClass(testFileDerivedNoArchiveQName); assertFalse("Derived File with archive override type should NOT have the archive flag", fileDerivedNoArchiveClassDef.getArchive()); QName testFolderQName = QName.createQName(TEST_URL, "folder"); ClassDefinition folderClassDef = service.getClass(testFolderQName); assertNull("Folder type should not have the archive flag", folderClassDef.getArchive()); }
/** * Is the property unexportable? */ private boolean isExcludedAspectProperty(QName[] excludeAspects, QName propertyQName) { PropertyDefinition propDef = dictionaryService.getProperty(propertyQName); if (propDef == null) { return false; } ClassDefinition classDef = propDef.getContainerClass(); if (classDef == null || !classDef.isAspect()) { return false; } return isExcludedAspect(excludeAspects, classDef.getName()); }
/** * Gets the properties of the specified node, minus those that have been explicitly excluded * * @param nodeRef node to get aspects for * @param excludedAspects aspects to exluce * @return map of properties minus those excluded */ private Map<QName, Serializable> getNodeProperties(NodeRef nodeRef, Set<QName> excludedAspects) { Map<QName, Serializable> properties = mlAwareNodeService.getProperties(nodeRef); if (excludedAspects == null || excludedAspects.size() == 0) { return properties; } else { Map<QName, Serializable> filteredProperties = new HashMap<QName, Serializable>(properties.size()); for (Map.Entry<QName, Serializable> property : properties.entrySet()) { PropertyDefinition propDef = dictionaryService.getProperty(property.getKey()); if (propDef == null || !excludedAspects.contains(propDef.getContainerClass().getName())) { filteredProperties.put(property.getKey(), property.getValue()); } } return filteredProperties; } }
if (propertyContainerDef.isAspect()) if (enableStringTagging && propertyContainerDef.getName().equals(ContentModel.ASPECT_TAGGABLE)) QName aspectQName = propertyContainerDef.getName(); requiredAspectQNames.add(aspectQName); Set<QName> aspectProperties = propertyContainerDef.getProperties().keySet(); aspectPropertyQNames.addAll(aspectProperties);
Map<QName, PropertyDefinition> propertyDefs = classDef.getProperties();