/** * 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); }
/** * 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); }
/** * Ensures the validity of the given assoc type * * @param assocTypeQName QName * @throws IllegalArgumentException */ private void checkAssocType(QName assocTypeQName) throws IllegalArgumentException { AssociationDefinition assocDef = dictionary.getAssociation(assocTypeQName); if (assocDef == null) { throw new IllegalArgumentException("Association " + assocTypeQName + " has not been defined in the data dictionary"); } }
/** * Ensures the validity of the given assoc type * * @param assocTypeQName QName * @throws IllegalArgumentException */ private void checkAssocType(QName assocTypeQName) throws IllegalArgumentException { AssociationDefinition assocDef = dictionary.getAssociation(assocTypeQName); if (assocDef == null) { throw new IllegalArgumentException("Association " + assocTypeQName + " has not been defined in the data dictionary"); } }
@Override protected AssociationDefinition getTypeDefinition(QName fullName, ContentModelItemData<?> itemData, boolean isForcedField) { AssociationDefinition assocDefinition = itemData.getAssociationDefinition(fullName); if (assocDefinition == null) { if (isForcedField) { assocDefinition = dictionaryService.getAssociation(fullName); } } return assocDefinition; } }
@Override protected AssociationDefinition getTypeDefinition(QName fullName, ContentModelItemData<?> itemData, boolean isForcedField) { AssociationDefinition assocDefinition = itemData.getAssociationDefinition(fullName); if (assocDefinition == null) { if (isForcedField) { assocDefinition = dictionaryService.getAssociation(fullName); } } return assocDefinition; } }
/** * Determine if name referes to an association * * @param defName QName * @return AssociationDefinition */ public AssociationDefinition determineAssociation(QName defName) { AssociationDefinition def = null; if (nodeChildAssocs.containsKey(defName) == false) { def = getDictionaryService().getAssociation(defName); } return def; }
/** * Determine if name referes to an association * * @param defName QName * @return AssociationDefinition */ public AssociationDefinition determineAssociation(QName defName) { AssociationDefinition def = null; if (nodeChildAssocs.containsKey(defName) == false) { def = getDictionaryService().getAssociation(defName); } return def; }
public void init() { super.init(); DictionaryService dictionaryService = serviceRegistry.getDictionaryService(); peerAssociationTypes.clear(); for (QName associationType : suppliedAssociationTypes) { AssociationDefinition assocDef = dictionaryService.getAssociation(associationType); if (assocDef != null && !assocDef.isChild()) { peerAssociationTypes.add(associationType); } } initialised = true; } }
private Set<QName> getMissingAspectsAssoc( Set<QName> existingAspects, Map<QName, Serializable> existingProperties, QName assocTypeQName) { AssociationDefinition assocDef = dictionaryService.getAssociation(assocTypeQName); if (assocDef == null) { return Collections.emptySet(); } ClassDefinition classDefinition = assocDef.getSourceClass(); return getMissingAspects(existingAspects, existingProperties, classDefinition.getName()); }
public void init() { super.init(); DictionaryService dictionaryService = serviceRegistry.getDictionaryService(); peerAssociationTypes.clear(); for (QName associationType : suppliedAssociationTypes) { AssociationDefinition assocDef = dictionaryService.getAssociation(associationType); if (assocDef != null && !assocDef.isChild()) { peerAssociationTypes.add(associationType); } } initialised = true; } }
public void init() { super.init(); // Quickly scan the supplied association types and remove any that either // do not exist or are not child association types. DictionaryService dictionaryService = serviceRegistry.getDictionaryService(); childAssociationTypes.clear(); for (QName associationType : suppliedAssociationTypes) { AssociationDefinition assocDef = dictionaryService.getAssociation(associationType); if (assocDef != null && assocDef.isChild()) { childAssociationTypes.add(associationType); } } initialised = true; }
private Set<QName> getMissingAspectsAssoc( Set<QName> existingAspects, Map<QName, Serializable> existingProperties, QName assocTypeQName) { AssociationDefinition assocDef = dictionaryService.getAssociation(assocTypeQName); if (assocDef == null) { return Collections.emptySet(); } ClassDefinition classDefinition = assocDef.getSourceClass(); return getMissingAspects(existingAspects, existingProperties, classDefinition.getName()); }
public void init() { super.init(); // Quickly scan the supplied association types and remove any that either // do not exist or are not child association types. DictionaryService dictionaryService = serviceRegistry.getDictionaryService(); childAssociationTypes.clear(); for (QName associationType : suppliedAssociationTypes) { AssociationDefinition assocDef = dictionaryService.getAssociation(associationType); if (assocDef != null && assocDef.isChild()) { childAssociationTypes.add(associationType); } } initialised = true; }
/** * 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()); }
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour) { // Validate arguments ParameterCheck.mandatory("Policy", policy); ParameterCheck.mandatory("Class Reference", className); ParameterCheck.mandatory("Association Reference", assocName); ParameterCheck.mandatory("Behaviour", behaviour); // Validate Binding AssociationDefinition assocDefinition = dictionary.getAssociation(assocName); if (assocDefinition == null) { throw new IllegalArgumentException("Association " + assocName + " of class " + className + " has not been defined in the data dictionary"); } // Create behaviour definition and bind to policy ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, assocName); 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 " + assocName + " of class " + className); return definition; }
/** * 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()); }
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour) { // Validate arguments ParameterCheck.mandatory("Policy", policy); ParameterCheck.mandatory("Class Reference", className); ParameterCheck.mandatory("Association Reference", assocName); ParameterCheck.mandatory("Behaviour", behaviour); // Validate Binding AssociationDefinition assocDefinition = dictionary.getAssociation(assocName); if (assocDefinition == null) { throw new IllegalArgumentException("Association " + assocName + " of class " + className + " has not been defined in the data dictionary"); } // Create behaviour definition and bind to policy ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, assocName); 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 " + assocName + " of class " + className); return definition; }
public void testChildAssocPropagate() { // Check the default value AssociationDefinition assocDef = service.getAssociation(QName.createQName(TEST_URL, "childassoc1")); assertNotNull("No such child association found", assocDef); assertTrue("Expected a child association", assocDef instanceof ChildAssociationDefinition); ChildAssociationDefinition childAssocDef = (ChildAssociationDefinition) assocDef; assertFalse("Expected 'false' for default timestamp propagation", childAssocDef.getPropagateTimestamps()); // Check the explicit value assocDef = service.getAssociation(QName.createQName(TEST_URL, "childassocPropagate")); assertNotNull("No such child association found", assocDef); assertTrue("Expected a child association", assocDef instanceof ChildAssociationDefinition); childAssocDef = (ChildAssociationDefinition) assocDef; assertTrue("Expected 'true' for timestamp propagation", childAssocDef.getPropagateTimestamps()); }
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()); }