private static void mockTargetClassName(QName targetClassName, MockClassAttributeDefinition mock) { when(mock.targetClass.getName()).thenReturn(targetClassName); }
/** * 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; } }
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()); }
/** * 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; } }
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()); }
/** * 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); }
/** * 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); }
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); } } } } }
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); } } } } }
/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
@Override public Serializable getValueInternal(CMISNodeInfo nodeInfo) { if(nodeInfo.getType() == null) { //If the type is null, we can't handle it so return an empty list return (Serializable) Collections.emptyList(); } TypeDefinition type = getServiceRegistry().getDictionaryService() .getType(nodeInfo.getType().getAlfrescoClass()); if ((type != null) && (type.getChildAssociations() != null) && (!type.getChildAssociations().isEmpty())) { ArrayList<String> result = new ArrayList<String>(); for (ChildAssociationDefinition cad : type.getChildAssociations().values()) { String typeId = cmisMapping.getCmisTypeId(cad.getTargetClass().getName()); if (typeId != null) { result.add(typeId); } } return result; } return (Serializable) Collections.emptyList(); } }
@Override public Serializable getValueInternal(CMISNodeInfo nodeInfo) { if(nodeInfo.getType() == null) { //If the type is null, we can't handle it so return an empty list return (Serializable) Collections.emptyList(); } TypeDefinition type = getServiceRegistry().getDictionaryService() .getType(nodeInfo.getType().getAlfrescoClass()); if ((type != null) && (type.getChildAssociations() != null) && (!type.getChildAssociations().isEmpty())) { ArrayList<String> result = new ArrayList<String>(); for (ChildAssociationDefinition cad : type.getChildAssociations().values()) { String typeId = cmisMapping.getCmisTypeId(cad.getTargetClass().getName()); if (typeId != null) { result.add(typeId); } } return result; } return (Serializable) Collections.emptyList(); } }
public AssociationFieldDefinition makeAssociationFieldDefinition(final AssociationDefinition assocDef, FieldGroup group) { String name = getPrefixedName(assocDef); String endpointType = assocDef.getTargetClass().getName().toPrefixString(namespaceService); AssociationFieldDefinition fieldDef = new AssociationFieldDefinition(name, endpointType, Direction.TARGET); populateFieldDefinition(assocDef, fieldDef, group, ASSOC_DATA_PREFIX); fieldDef.setEndpointMandatory(assocDef.isTargetMandatory()); fieldDef.setEndpointMany(assocDef.isTargetMany()); return fieldDef; }
public AssociationFieldDefinition makeAssociationFieldDefinition(final AssociationDefinition assocDef, FieldGroup group) { String name = getPrefixedName(assocDef); String endpointType = assocDef.getTargetClass().getName().toPrefixString(namespaceService); AssociationFieldDefinition fieldDef = new AssociationFieldDefinition(name, endpointType, Direction.TARGET); populateFieldDefinition(assocDef, fieldDef, group, ASSOC_DATA_PREFIX); fieldDef.setEndpointMandatory(assocDef.isTargetMandatory()); fieldDef.setEndpointMany(assocDef.isTargetMany()); return fieldDef; }
private void validateDeleteClass(final Tenant tenant, final ClassDefinition classDef) final QName className = classDef.getName();
if (propertyDef != null) if (propertyDef.getContainerClass().getName().equals(ContentModel.TYPE_CONTENT))
if (propertyDef != null) if (propertyDef.getContainerClass().getName().equals(ContentModel.TYPE_CONTENT))