org.alfresco.service.cmr.dictionary.ClassDefinition Java Examples
The following examples show how to use
org.alfresco.service.cmr.dictionary.ClassDefinition.
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: DbNodeServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @param existingProperties existing node properties * @param classQNames the types or aspects to introspect * @return Returns any properties that should be added */ private Map<QName, Serializable> getMissingProperties(Map<QName, Serializable> existingProperties, Set<QName> classQNames) { Map<QName, Serializable> allDefaultProperties = new HashMap<QName, Serializable>(17); for (QName classQName : classQNames) { ClassDefinition classDefinition = dictionaryService.getClass(classQName); if (classDefinition == null) { continue; } // Get the default properties for this type/aspect Map<QName, Serializable> defaultProperties = getDefaultProperties(classQName); if (defaultProperties.size() > 0) { allDefaultProperties.putAll(defaultProperties); } } // Work out what is missing Map<QName, Serializable> missingProperties = new HashMap<QName, Serializable>(allDefaultProperties); missingProperties.keySet().removeAll(existingProperties.keySet()); // Done return missingProperties; }
Example #2
Source File: ExporterComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * 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()); }
Example #3
Source File: CustomModelsImpl.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
private List<CustomModelProperty> convertToCustomModelProperty(ClassDefinition classDefinition, boolean includeInherited) { Collection<PropertyDefinition> ownProperties = null; ClassDefinition parentDef = classDefinition.getParentClassDefinition(); if (!includeInherited && parentDef != null) { // Remove inherited properties ownProperties = removeRightEntries(classDefinition.getProperties(), parentDef.getProperties()).values(); } else { ownProperties = classDefinition.getProperties().values(); } List<CustomModelProperty> customProperties = new ArrayList<>(ownProperties.size()); for (PropertyDefinition propDef : ownProperties) { customProperties.add(new CustomModelProperty(propDef, dictionaryService)); } return customProperties; }
Example #4
Source File: DictionaryDAOTest.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 6 votes |
@Test 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()); }
Example #5
Source File: AbstractClassGet.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Override method from DeclarativeWebScript */ protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) { Map<String, Object> model = new HashMap<String, Object>(3); Map<QName, ClassDefinition> classdef = new HashMap<QName, ClassDefinition>(); Map<QName, Collection<PropertyDefinition>> propdef = new HashMap<QName, Collection<PropertyDefinition>>(); Map<QName, Collection<AssociationDefinition>> assocdef = new HashMap<QName, Collection<AssociationDefinition>>(); QName classQname = getClassQname(req); classdef.put(classQname, this.dictionaryservice.getClass(classQname)); propdef.put(classQname, this.dictionaryservice.getClass(classQname).getProperties().values()); assocdef.put(classQname, this.dictionaryservice.getClass(classQname).getAssociations().values()); model.put(MODEL_PROP_KEY_CLASS_DETAILS, classdef.values()); model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, propdef.values()); model.put(MODEL_PROP_KEY_ASSOCIATION_DETAILS, assocdef.values()); model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, this.dictionaryservice); return model; }
Example #6
Source File: CustomModelServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
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); } } } } }
Example #7
Source File: PolicyComponentImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(QName policy, QName className, Behaviour behaviour) { // Validate arguments ParameterCheck.mandatory("Policy", policy); ParameterCheck.mandatory("Class Reference", className); ParameterCheck.mandatory("Behaviour", behaviour); // Validate Binding ClassDefinition classDefinition = dictionary.getClass(className); if (classDefinition == null) { throw new IllegalArgumentException("Class " + className + " has not been defined in the data dictionary"); } // Create behaviour definition and bind to policy ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, FEATURE_WILDCARD); BehaviourDefinition<ClassFeatureBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Property, policy, binding, behaviour); getPropertyBehaviourIndex(policy).putClassBehaviour(definition); if (logger.isInfoEnabled()) logger.info("Bound " + behaviour + " to policy " + policy + " for property " + FEATURE_WILDCARD + " of class " + className); return definition; }
Example #8
Source File: ExporterComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Is the association unexportable? */ private boolean isExcludedAspectAssociation(QName[] excludeAspects, QName associationQName) { AssociationDefinition assocDef = dictionaryService.getAssociation(associationQName); if (assocDef == null) { return false; } ClassDefinition classDef = assocDef.getSourceClass(); if (classDef == null || !classDef.isAspect()) { return false; } return isExcludedAspect(excludeAspects, classDef.getName()); }
Example #9
Source File: ClassFeatureBehaviourBinding.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public BehaviourBinding generaliseBinding() { BehaviourBinding generalisedBinding = null; ClassDefinition classDefinition = getDictionary().getClass(getClassQName()); if (classDefinition == null) { // The class definition doesn't exist so there can be no behaviour bound return null; } if (activeFeatureQName.equals(ALL_FEATURES)) { QName parentClassName = classDefinition.getParentName(); if (parentClassName != null) { generalisedBinding = new ClassFeatureBehaviourBinding(getDictionary(), getNodeRef(), parentClassName, featureQName, featureQName); } } else { generalisedBinding = new ClassFeatureBehaviourBinding(getDictionary(), getNodeRef(), getClassQName(), featureQName, ALL_FEATURES); } return generalisedBinding; }
Example #10
Source File: SelectorPropertyContentStore.java From alfresco-simple-content-stores with Apache License 2.0 | 6 votes |
private void afterPropertiesSet_validateSelectors() { PropertyCheck.mandatory(this, "selectorClassName", this.selectorClassName); PropertyCheck.mandatory(this, "selectorPropertyName", this.selectorPropertyName); this.selectorClassQName = QName.resolveToQName(this.namespaceService, this.selectorClassName); this.selectorPropertyQName = QName.resolveToQName(this.namespaceService, this.selectorPropertyName); PropertyCheck.mandatory(this, "selectorClassQName", this.selectorClassQName); PropertyCheck.mandatory(this, "selectorPropertyQName", this.selectorPropertyQName); final ClassDefinition classDefinition = this.dictionaryService.getClass(this.selectorClassQName); if (classDefinition == null) { throw new IllegalStateException(this.selectorClassName + " is not a valid content model class"); } final PropertyDefinition propertyDefinition = this.dictionaryService.getProperty(this.selectorPropertyQName); if (propertyDefinition == null || !DataTypeDefinition.TEXT.equals(propertyDefinition.getDataType().getName()) || propertyDefinition.isMultiValued()) { throw new IllegalStateException( this.selectorPropertyName + " is not a valid content model property of type single-valued d:text"); } }
Example #11
Source File: PolicyComponentImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(QName policy, QName className, Behaviour behaviour) { // Validate arguments ParameterCheck.mandatory("Policy", policy); ParameterCheck.mandatory("Class Reference", className); ParameterCheck.mandatory("Behaviour", behaviour); // Validate Binding ClassDefinition classDefinition = dictionary.getClass(className); if (classDefinition == null) { throw new IllegalArgumentException("Class " + className + " has not been defined in the data dictionary"); } // Create behaviour definition and bind to policy ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, FEATURE_WILDCARD); BehaviourDefinition<ClassFeatureBehaviourBinding> definition = createBehaviourDefinition(PolicyType.Association, policy, binding, behaviour); getAssociationBehaviourIndex(policy).putClassBehaviour(definition); if (logger.isInfoEnabled()) logger.info("Bound " + behaviour + " to policy " + policy + " for association " + FEATURE_WILDCARD + " of class " + className); return definition; }
Example #12
Source File: ClassBehaviourBinding.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public BehaviourBinding generaliseBinding() { BehaviourBinding generalisedBinding = null; ClassDefinition classDefinition = dictionary.getClass(classQName); if (classDefinition == null) { // The class definition doesn't exist so there can be no behaviour bound return null; } QName parentClassName = classDefinition.getParentName(); if (parentClassName != null) { generalisedBinding = new ClassBehaviourBinding(dictionary, parentClassName); } return generalisedBinding; }
Example #13
Source File: WorkflowRestImpl.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * @param taskType type of the task * @return all types (and aspects) which properties should not be used for form-model elements */ protected Set<QName> getTypesToExclude(TypeDefinition taskType) { HashSet<QName> typesToExclude = new HashSet<QName>(); ClassDefinition parentClassDefinition = taskType.getParentClassDefinition(); boolean contentClassFound = false; while(parentClassDefinition != null) { if(contentClassFound) { typesToExclude.add(parentClassDefinition.getName()); } else if(ContentModel.TYPE_CONTENT.equals(parentClassDefinition.getName())) { // All parents of "cm:content" should be ignored as well for fetching start-properties typesToExclude.add(ContentModel.TYPE_CONTENT); typesToExclude.addAll(parentClassDefinition.getDefaultAspectNames()); contentClassFound = true; } parentClassDefinition = parentClassDefinition.getParentClassDefinition(); } return typesToExclude; }
Example #14
Source File: NodeContext.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Adds a collection property to the node * * @param property QName */ public void addPropertyCollection(QName property) { // Do not import properties of sys:referenceable or cm:versionable or cm:copiedfrom // TODO: Make this configurable... PropertyDefinition propDef = getDictionaryService().getProperty(property); ClassDefinition classDef = (propDef == null) ? null : propDef.getContainerClass(); if (classDef != null) { if (!isImportableClass(classDef.getName())) { return; } } // create collection and assign to property List<Serializable>values = new ArrayList<Serializable>(); nodeProperties.put(property, (Serializable)values); }
Example #15
Source File: RepoDictionaryDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
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()); }
Example #16
Source File: DictionaryComponent.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
public PropertyDefinition getProperty(QName className, QName propertyName) { PropertyDefinition propDef = null; ClassDefinition classDef = dictionaryDAO.getClass(className); if (classDef != null) { Map<QName,PropertyDefinition> propDefs = classDef.getProperties(); propDef = propDefs.get(propertyName); } return propDef; }
Example #17
Source File: DictionaryWebServiceBase.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
/** * Returns dependent collections (properties or associations) * in order that complies to order of class definitions * @param sortedClassDefs - list of sorted class definitions * @param dependent - collections that depend on class definitions * @return collection of dependent values */ protected <T> Collection<T> reorderedValues(List<ClassDefinition> sortedClassDefs, Map<QName, T> dependent) { Collection<T> result = new ArrayList<T>(sortedClassDefs.size()); for (ClassDefinition classDef : sortedClassDefs) { result.add(dependent.get(classDef.getName())); } return result; }
Example #18
Source File: AbstractTypeDefinitionWrapper.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void updateDefinition(DictionaryService dictionaryService) { String name = null; String description = null; ClassDefinition definition = dictionaryService.getClass(alfrescoName); if (definition != null) { name = definition.getTitle(dictionaryService); description = definition.getDescription(dictionaryService); } setTypeDefDisplayName(name); setTypeDefDescription(description); }
Example #19
Source File: CMISStrictDictionaryService.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
/** * Create Type Definitions * * @param classQName QName */ private AbstractTypeDefinitionWrapper createTypeDef(QName classQName) { AbstractTypeDefinitionWrapper objectTypeDef = null; // skip items that are remapped to CMIS model if(!cmisMapping.isRemappedType(classQName)) { // create appropriate kind of type definition ClassDefinition classDef = dictionaryService.getClass(classQName); String typeId = null; if (cmisMapping.isValidCmisDocument(classQName)) { typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_DOCUMENT, classQName); objectTypeDef = new DocumentTypeDefinitionWrapper(cmisMapping, accessorMapping, luceneBuilderMapping, typeId, dictionaryService, classDef); } else if (cmisMapping.isValidCmisFolder(classQName)) { typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_FOLDER, classQName); objectTypeDef = new FolderTypeDefintionWrapper(cmisMapping, accessorMapping, luceneBuilderMapping, typeId, dictionaryService, classDef); } else if (cmisMapping.getCmisVersion().equals(CmisVersion.CMIS_1_1) && cmisMapping.isValidCmisSecondaryType(classQName)) { typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_SECONDARY, classQName); objectTypeDef = new SecondaryTypeDefinitionWrapper(cmisMapping, accessorMapping, luceneBuilderMapping, typeId, dictionaryService, classDef); } else if (cmisMapping.isValidCmisPolicy(classQName)) { typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, classQName); objectTypeDef = new PolicyTypeDefintionWrapper(cmisMapping, accessorMapping, luceneBuilderMapping, typeId, dictionaryService, classDef); } else if (cmisMapping.isValidCmisItem(classQName)) { typeId = cmisMapping.getCmisTypeId(BaseTypeId.CMIS_ITEM, classQName); objectTypeDef = new ItemTypeDefinitionWrapper(cmisMapping, accessorMapping, luceneBuilderMapping, typeId, dictionaryService, classDef); } } return objectTypeDef; }
Example #20
Source File: M2PropertyDefinition.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
M2PropertyDefinition( ClassDefinition classDef, PropertyDefinition propertyDef, M2PropertyOverride override, NamespacePrefixResolver prefixResolver, Map<QName, ConstraintDefinition> modelConstraints) { this.classDef = classDef; this.name = propertyDef.getName(); this.dataType = propertyDef.getDataType(); this.propertyTypeName = this.dataType.getName(); this.m2Property = createOverriddenProperty(propertyDef, override, prefixResolver, modelConstraints); }
Example #21
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 #22
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 #23
Source File: NodeBrowserPost.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
private boolean searchInClassDefinition(QName qname, ClassDefinition classDef) { if (classDef != null) { for (QName definedPropQName : classDef.getProperties().keySet()) { if(qname.isMatch(definedPropQName)) { return true; } } } return false; }
Example #24
Source File: DictionaryComponent.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
public boolean isSubClass(QName className, QName ofClassName) { // Validate arguments ParameterCheck.mandatory("className", className); ParameterCheck.mandatory("ofClassName", ofClassName); ClassDefinition classDef = getClass(className); if (classDef == null) { return false; } ClassDefinition ofClassDef = getClass(ofClassName); if (ofClassDef == null) { return false; } // Only check if both ends are either a type or an aspect boolean subClassOf = false; if (classDef.isAspect() == ofClassDef.isAspect()) { while (classDef != null) { if (classDef.equals(ofClassDef)) { subClassOf = true; break; } // No match yet, so go to parent class QName parentClassName = classDef.getParentName(); classDef = (parentClassName == null) ? null : getClass(parentClassName); } } return subClassOf; }
Example #25
Source File: DelegateModelQuery.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
public ClassDefinition getClass(QName name) { ClassDefinition def = query.getClass(name); if (def == null) { def = delegate.getClass(name); } return def; }
Example #26
Source File: M2AssociationDefinition.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
/** * Construct * * @param classDef ClassDefinition * @param assoc M2ClassAssociation * @param resolver NamespacePrefixResolver */ /*package*/ M2AssociationDefinition(ClassDefinition classDef, M2ClassAssociation assoc, NamespacePrefixResolver resolver) { this.classDef = classDef; this.assoc = assoc; // Resolve names this.name = QName.createQName(assoc.getName(), resolver); this.targetClassName = QName.createQName(assoc.getTargetClassName(), resolver); this.sourceRoleName = QName.createQName(assoc.getSourceRoleName(), resolver); this.targetRoleName = QName.createQName(assoc.getTargetRoleName(), resolver); }
Example #27
Source File: DictionaryDAOImpl.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ClassDefinition getClass(QName className) { ClassDefinition classDef = null; if (className != null) { classDef = getTenantDictionaryRegistry().getClass(className); } return classDef; }
Example #28
Source File: RepoDictionaryDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void testMandatoryEnforced() { // get the properties for the test type QName testEnforcedQName = QName.createQName(TEST_URL, "enforced"); ClassDefinition testEnforcedClassDef = service.getClass(testEnforcedQName); Map<QName, PropertyDefinition> testEnforcedPropertyDefs = testEnforcedClassDef.getProperties(); PropertyDefinition propertyDef = null; QName testMandatoryEnforcedQName = QName.createQName(TEST_URL, "mandatory-enforced"); propertyDef = testEnforcedPropertyDefs.get(testMandatoryEnforcedQName); assertNotNull("Property not found: " + testMandatoryEnforcedQName, propertyDef); assertTrue("Expected property to be mandatory: " + testMandatoryEnforcedQName, propertyDef.isMandatory()); assertTrue("Expected property to be mandatory-enforced: " + testMandatoryEnforcedQName, propertyDef.isMandatoryEnforced()); QName testMandatoryNotEnforcedQName = QName.createQName(TEST_URL, "mandatory-not-enforced"); propertyDef = testEnforcedPropertyDefs.get(testMandatoryNotEnforcedQName); assertNotNull("Property not found: " + testMandatoryNotEnforcedQName, propertyDef); assertTrue("Expected property to be mandatory: " + testMandatoryNotEnforcedQName, propertyDef.isMandatory()); assertFalse("Expected property to be mandatory-not-enforced: " + testMandatoryNotEnforcedQName, propertyDef.isMandatoryEnforced()); QName testMandatoryDefaultEnforcedQName = QName.createQName(TEST_URL, "mandatory-default-enforced"); propertyDef = testEnforcedPropertyDefs.get(testMandatoryDefaultEnforcedQName); assertNotNull("Property not found: " + testMandatoryDefaultEnforcedQName, propertyDef); assertTrue("Expected property to be mandatory: " + testMandatoryDefaultEnforcedQName, propertyDef.isMandatory()); assertFalse("Expected property to be mandatory-not-enforced: " + testMandatoryDefaultEnforcedQName, propertyDef.isMandatoryEnforced()); }
Example #29
Source File: DictionaryComparators.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public int compare(ClassDefinition arg0, ClassDefinition arg1) { int result = 0; String title0 = arg0.getTitle(messageLookup); if (title0 == null) { title0 = arg0.getName().toPrefixString(); } String title1 = arg1.getTitle(messageLookup); if (title1 == null) { title1 = arg1.getName().getPrefixString(); } if (title0 == null && title1 != null) { result = 1; } else if (title0 != null && title1 == null) { result = -1; } else if (title0 != null && title1 != null) { result = String.CASE_INSENSITIVE_ORDER.compare(title0, title1); } return result; }
Example #30
Source File: DictionaryComponent.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
public Map<QName,PropertyDefinition> getPropertyDefs(QName className) { ClassDefinition classDef = dictionaryDAO.getClass(className); if (classDef != null) { return classDef.getProperties(); } return null; }