/** * Ensures the validity of the given property type * * @param propertyQName QName * @throws IllegalArgumentException */ private void checkPropertyType(QName propertyQName) throws IllegalArgumentException { PropertyDefinition propertyDef = dictionary.getProperty(propertyQName); if (propertyDef == null) { throw new IllegalArgumentException("Property " + propertyQName + " has not been defined in the data dictionary"); } }
@Override public boolean isDefinitionExists(QName qName) { return (null != dictionaryService.getAspect(qName)); } });
/** * Gets the association definition from the dictionary. If the source node type is * provided then the association particular to the subtype is attempted. * * @param eventResults results to add a violation message to * @param assocTypeQName the type of the association * @return Returns the association definition, or null if not found */ protected AssociationDefinition getAssocDef(List<IntegrityRecord> eventResults, QName assocTypeQName) { return dictionaryService.getAssociation(assocTypeQName); }
/** * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() */ protected Map<String, String> getAllowableValuesImpl() { Collection<QName> aspects = dictionaryService.getAllAspects(); Map<String, String> result = new LinkedHashMap<String, String>(aspects.size()); for (QName aspect : aspects) { AspectDefinition aspectDef = dictionaryService.getAspect(aspect); if (aspectDef != null && aspectDef.getTitle(dictionaryService) != null) { result.put(aspect.toPrefixString(), aspectDef.getTitle(dictionaryService)); } } return result; }
public void testLabels() { QName model = QName.createQName(TEST_URL, "dictionarydaotest"); ModelDefinition modelDef = service.getModel(model); assertEquals("Model Description", modelDef.getDescription(service)); QName type = QName.createQName(TEST_URL, "base"); TypeDefinition typeDef = service.getType(type); assertEquals("Base Title", typeDef.getTitle(service)); assertEquals("Base Description", typeDef.getDescription(service)); QName prop = QName.createQName(TEST_URL, "prop1"); PropertyDefinition propDef = service.getProperty(prop); assertEquals("Prop1 Title", propDef.getTitle(service)); assertEquals("Prop1 Description", propDef.getDescription(service)); QName assoc = QName.createQName(TEST_URL, "assoc1"); AssociationDefinition assocDef = service.getAssociation(assoc); assertEquals("Assoc1 Title", assocDef.getTitle(service)); assertEquals("Assoc1 Description", assocDef.getDescription(service)); QName datatype = QName.createQName(TEST_URL, "datatype"); DataTypeDefinition datatypeDef = service.getDataType(datatype); assertEquals("alfresco/model/dataTypeAnalyzers", datatypeDef.getAnalyserResourceBundleName()); }
if (propDefElement != null) propDef = dictionaryService.getProperty(QName.createQName(propDefElement.getText(), nspr)); if (typeDefElement != null) typeDef = dictionaryService.getDataType(QName.createQName(typeDefElement.getText(), nspr));
protected Map<QName, Serializable> getDefaultProperties(QName typeQName) { ClassDefinition classDefinition = this.dictionaryService.getClass(typeQName); if (classDefinition == null) { return Collections.emptyMap(); } return getDefaultProperties(classDefinition); }
/** * Returns an anonymous {@link TypeDefinition} for the given name with all * the mandatory aspects applied. * * @param name * the name of the task definition. * @param isStart * is theis a start task? * @return the task {@link TypeDefinition}. */ public TypeDefinition getTaskFullTypeDefinition(String name, boolean isStart) { TypeDefinition typeDef = getTaskTypeDefinition(name, isStart); return dictionaryService.getAnonymousType(typeDef.getName()); }
@Override public boolean isDefinitionExists(QName qName) { return (null != dictionaryService.getType(qName)); } });
/** * @return true if this Node is a container (i.e. a folder) */ private boolean getIsContainer(QName type) { boolean isContainer = dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER) && !dictionaryService.isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER); return isContainer; }
/** * {@inheritDoc} */ public AlfrescoModel getModel(QName modelName) { if(enabled) { ModelDefinition modelDef = dictionaryService.getModel(modelName); return (modelDef != null ? new AlfrescoModel(modelDef) : null); } else { return null; } }
if (this.services.getDictionaryService().isSubClass(parent.getType(), org.alfresco.model.ContentModel.TYPE_FOLDER)) QueryParameterDefinition[] params = new QueryParameterDefinition[t.countTokens()]; DataTypeDefinition ddText = this.services.getDictionaryService().getDataType(DataTypeDefinition.TEXT); NamespaceService ns = this.services.getNamespaceService(); while (t.hasMoreTokens())
protected DataTypeDefinition getInDataType() { return getServiceRegistry().getDictionaryService().getDataType(DataTypeDefinition.TEXT); } }
private int getModelCount() { return dictionaryService.getAllModels().size(); }
assertEquals(defaultModelCnt, dictionaryService.getAllModels().size()); assertNull(dictionaryService.getClass(QName.createQName("{my.new.model}sop"))); assertEquals(defaultModelCnt+1, dictionaryService.getAllModels().size()); ClassDefinition myType = dictionaryService.getClass(QName.createQName("{my.new.model}sop")); assertNotNull(myType); assertEquals(QName.createQName("{my.new.model}mynewmodel"),myType.getModel().getName()); assertEquals(defaultModelCnt, dictionaryService.getAllModels().size()); assertNull(dictionaryService.getClass(QName.createQName("{my.new.model}sop"))); assertEquals(defaultModelCnt+1, dictionaryService.getAllModels().size()); myType = dictionaryService.getClass(QName.createQName("{my.new.model}sop")); assertNotNull(myType); assertEquals(QName.createQName("{my.new.model}mynewmodel"),myType.getModel().getName());
if (propDefElement != null) propDef = dictionaryService.getProperty(QName.createQName(propDefElement.getText(), nspr)); if (typeDefElement != null) typeDef = dictionaryService.getDataType(QName.createQName(typeDefElement.getText(), nspr));
protected Map<QName, Serializable> getDefaultProperties(QName typeQName) { ClassDefinition classDefinition = this.dictionaryService.getClass(typeQName); if (classDefinition == null) { return Collections.emptyMap(); } return getDefaultProperties(classDefinition); }
/** * Returns an anonymous {@link TypeDefinition} for the given name with all * the mandatory aspects applied. * * @param name * the name of the task definition. * @param isStart * is theis a start task? * @return the task {@link TypeDefinition}. */ public TypeDefinition getTaskFullTypeDefinition(String name, boolean isStart) { TypeDefinition typeDef = getTaskTypeDefinition(name, isStart); return dictionaryService.getAnonymousType(typeDef.getName()); }
@Override public boolean isDefinitionExists(QName qName) { return (null != dictionaryService.getType(qName)); } });
public Boolean isSubtypeOf(NodeRef nodeRef, QName typeQName) { // get the type of the node QName nodeTypeQName = nodeService.getType(nodeRef); return dictionaryService.isSubClass(nodeTypeQName, typeQName); }