/** * 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"); } }
/** * 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"); } }
public static DataTypeDefinition getDataTypeDefinition(DictionaryService dictionaryService, QName propertyQname) { if(propertyQname == null) { return null; } PropertyDefinition propDef = dictionaryService.getProperty(propertyQname); if(propDef == null) { return null; } return propDef.getDataType(); }
@Override protected PropertyDefinition getTypeDefinition(QName fullName, ContentModelItemData<?> itemData, boolean isForcedField) { PropertyDefinition propDef = itemData.getPropertyDefinition(fullName); if (propDef == null) { if (isForcedField) { propDef = dictionaryService.getProperty(fullName); } } return propDef; }
public static DataTypeDefinition getDataTypeDefinition(DictionaryService dictionaryService, QName propertyQname) { if(propertyQname == null) { return null; } PropertyDefinition propDef = dictionaryService.getProperty(propertyQname); if(propDef == null) { return null; } return propDef.getDataType(); }
@Override protected PropertyDefinition getTypeDefinition(QName fullName, ContentModelItemData<?> itemData, boolean isForcedField) { PropertyDefinition propDef = itemData.getPropertyDefinition(fullName); if (propDef == null) { if (isForcedField) { propDef = dictionaryService.getProperty(fullName); } } return propDef; }
protected Map<QName, Serializable> getProperties(Long nodeId) { Map<QName, Serializable> props = null; // ALF-10641 // Residual properties are un-indexed -> break serlialisation nodeDAO.setCheckNodeConsistency(); Map<QName, Serializable> sourceProps = nodeDAO.getNodeProperties(nodeId); props = new HashMap<QName, Serializable>((int)(sourceProps.size() * 1.3)); for(QName propertyQName : sourceProps.keySet()) { PropertyDefinition propDef = dictionaryService.getProperty(propertyQName); if(propDef != null) { props.put(propertyQName, sourceProps.get(propertyQName)); } } return props; }
public DataTypeDefinition getPropertyDataType(QName propertyName) { // get property datatype DataTypeDefinition valueDataType = propertyDatatypes.get(propertyName); if (valueDataType == null) { PropertyDefinition propDef = getDictionaryService().getProperty(propertyName); if (propDef != null) { valueDataType = propDef.getDataType(); } } return valueDataType; }
private DataType getPropertyType(QName propertyName) { DataType dataType = null; PropertyDefinition def = dictionaryService.getProperty(propertyName); if(def != null) { DataTypeDefinition dataTypeDef = def.getDataType(); String dataTypeDefStr = dataTypeDef.getName().getPrefixString().substring(2); StringBuilder dataTypeName = new StringBuilder(dataTypeDefStr.substring(0, 1).toUpperCase()); dataTypeName.append(dataTypeDefStr.substring(1)); dataType = DataType.valueOf(dataTypeName.toString()); } return dataType; }
protected Map<QName, Serializable> getProperties(Long nodeId) { Map<QName, Serializable> props = null; // ALF-10641 // Residual properties are un-indexed -> break serlialisation nodeDAO.setCheckNodeConsistency(); Map<QName, Serializable> sourceProps = nodeDAO.getNodeProperties(nodeId); props = new HashMap<QName, Serializable>((int)(sourceProps.size() * 1.3)); for(QName propertyQName : sourceProps.keySet()) { PropertyDefinition propDef = dictionaryService.getProperty(propertyQName); if(propDef != null) { props.put(propertyQName, sourceProps.get(propertyQName)); } } return props; }
public DataTypeDefinition getPropertyDataType(QName propertyName) { // get property datatype DataTypeDefinition valueDataType = propertyDatatypes.get(propertyName); if (valueDataType == null) { PropertyDefinition propDef = getDictionaryService().getProperty(propertyName); if (propDef != null) { valueDataType = propDef.getDataType(); } } return valueDataType; }
private DataType getPropertyType(QName propertyName) { DataType dataType = null; PropertyDefinition def = dictionaryService.getProperty(propertyName); if(def != null) { DataTypeDefinition dataTypeDef = def.getDataType(); String dataTypeDefStr = dataTypeDef.getName().getPrefixString().substring(2); StringBuilder dataTypeName = new StringBuilder(dataTypeDefStr.substring(0, 1).toUpperCase()); dataTypeName.append(dataTypeDefStr.substring(1)); dataType = DataType.valueOf(dataTypeName.toString()); } return dataType; }
protected Serializable getPropertyValueToPersist(QName qName, Object value) { PropertyDefinition propDef = itemData.getPropertyDefinition(qName); if (propDef == null) { propDef = dictionaryService.getProperty(qName); } if (propDef != null) { return valueGetter.getValue(value, propDef); } return (Serializable) value; }
protected Serializable getPropertyValueToPersist(QName qName, Object value) { PropertyDefinition propDef = itemData.getPropertyDefinition(qName); if (propDef == null) { propDef = dictionaryService.getProperty(qName); } if (propDef != null) { return valueGetter.getValue(value, propDef); } return (Serializable) value; }
private Map<QName, Serializable> filterResudualProperties(Map<QName, Serializable> sourceProps) { Map<QName, Serializable> props = new HashMap<QName, Serializable>((int)(sourceProps.size() * 1.3)); for(QName propertyQName : sourceProps.keySet()) { PropertyDefinition propDef = dictionaryService.getProperty(propertyQName); if(propDef != null) { props.put(propertyQName, sourceProps.get(propertyQName)); } } return props; }
/** * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() */ protected Map<String, String> getAllowableValuesImpl() { Collection<QName> properties = dictionaryService.getAllProperties(null); Map<String, String> result = new LinkedHashMap<String, String>(properties.size()); for (QName property : properties) { PropertyDefinition propertyDef = dictionaryService.getProperty(property); if (propertyDef != null && propertyDef.getTitle(dictionaryService) != null) { result.put(property.toPrefixString(), propertyDef.getTitle(dictionaryService)); } } return result; } }
/** * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() */ protected Map<String, String> getAllowableValuesImpl() { Collection<QName> properties = dictionaryService.getAllProperties(null); Map<String, String> result = new LinkedHashMap<String, String>(properties.size()); for (QName property : properties) { PropertyDefinition propertyDef = dictionaryService.getProperty(property); if (propertyDef != null && propertyDef.getTitle(dictionaryService) != null) { result.put(property.toPrefixString(), propertyDef.getTitle(dictionaryService)); } } return result; } }
/** * 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()); }
public BehaviourDefinition<ClassFeatureBehaviourBinding> bindPropertyBehaviour(QName policy, QName className, QName propertyName, Behaviour behaviour) { // Validate arguments ParameterCheck.mandatory("Policy", policy); ParameterCheck.mandatory("Class Reference", className); ParameterCheck.mandatory("Property Reference", propertyName); ParameterCheck.mandatory("Behaviour", behaviour); // Validate Binding PropertyDefinition propertyDefinition = dictionary.getProperty(className, propertyName); if (propertyDefinition == null) { throw new IllegalArgumentException("Property " + propertyName + " of class " + className + " has not been defined in the data dictionary"); } // Create behaviour definition and bind to policy ClassFeatureBehaviourBinding binding = new ClassFeatureBehaviourBinding(dictionary, className, propertyName); 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 " + propertyName + " of class " + className); return definition; }