当前位置: 首页>>代码示例>>Java>>正文


Java PropertyDefinition类代码示例

本文整理汇总了Java中org.alfresco.service.cmr.dictionary.PropertyDefinition的典型用法代码示例。如果您正苦于以下问题:Java PropertyDefinition类的具体用法?Java PropertyDefinition怎么用?Java PropertyDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PropertyDefinition类属于org.alfresco.service.cmr.dictionary包,在下文中一共展示了PropertyDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encrypt

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * Encrypt a properties if the data definition (model-specific) requires it.
 * 
 * @param propertyQName             the property qualified name
 * @param inbound                   the property to encrypt
 * @return                          the encrypted property or the original if encryption is not required
 */
public Serializable encrypt(QName propertyQName, Serializable inbound)
{
    PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
    if (inbound == null || propertyDef == null || !(propertyDef.getDataType().getName().equals(DataTypeDefinition.ENCRYPTED)))
    {
        return inbound;
    }
    if (inbound instanceof SealedObject)
    {
        return inbound;
    }
    Serializable outbound = encryptor.sealObject(KeyProvider.ALIAS_METADATA, null, inbound);
    // Done
    return outbound;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:MetadataEncryptor.java

示例2: validatePropsDefaultValues

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * Validates the properties' non-null default values against the defined property constraints.
 *
 * @param compiledModel the compiled model
 * @throws CustomModelException.CustomModelConstraintException if there is constraint evaluation
 *                                                             exception
 */
private void validatePropsDefaultValues(CompiledModel compiledModel)
{
    for (PropertyDefinition propertyDef : compiledModel.getProperties())
    {
        if (propertyDef.getDefaultValue() != null && propertyDef.getConstraints().size() > 0)
        {
            for (ConstraintDefinition constraintDef : propertyDef.getConstraints())
            {
                Constraint constraint = constraintDef.getConstraint();
                try
                {
                    constraint.evaluate(propertyDef.getDefaultValue());
                }
                catch (AlfrescoRuntimeException ex)
                {
                    String message = getRootCauseMsg(ex, false, "cmm.service.constraint.default_prop_value_err");
                    throw new CustomModelException.CustomModelConstraintException(message);
                }
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:CustomModelServiceImpl.java

示例3: getDefaultValue

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
private Object getDefaultValue(QName name, ContentModelItemData<?> data)
{
    PropertyDefinition propDef = data.getPropertyDefinition(name);
    if (propDef != null)
    {
        QName typeQName = propDef.getDataType().getName();
        String strDefaultValue = propDef.getDefaultValue();
        if (NodePropertyValue.isDataTypeSupported(typeQName))
        {
            // convert to the appropriate type
            NodePropertyValue pv = new NodePropertyValue(typeQName, strDefaultValue);
            return pv.getValue(typeQName);
        }
        return strDefaultValue;
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:PropertyFieldProcessor.java

示例4: getDefaultValues

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * @see org.alfresco.service.cmr.dictionary.ClassDefinition#getDefaultValues()
 */
public Map<QName, Serializable> getDefaultValues()
{
    Map<QName, Serializable> result = new HashMap<QName, Serializable>(5);
    
    for(Map.Entry<QName, PropertyDefinition> entry : inheritedProperties.entrySet())
    {
        PropertyDefinition propertyDefinition = entry.getValue();
        String defaultValue = propertyDefinition.getDefaultValue();
        if (defaultValue != null)
        {
            result.put(entry.getKey(), defaultValue);
        }
    }
    
    return Collections.unmodifiableMap(result);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:20,代码来源:M2ClassDefinition.java

示例5: isExcludedAspectProperty

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ExporterComponent.java

示例6: executeImpl

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:AbstractClassGet.java

示例7: buildQNameProperties

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
private Map<String, Object> buildQNameProperties(Map<QName, Serializable> properties, Collection<QName> keys,
        WorkflowTask task)
{
    Map<QName, PropertyDefinition> propDefs = task.getDefinition().getMetadata().getProperties();
    Map<String, Object> model = new HashMap<String, Object>();
    for (QName key : keys)
    {
        Object value = convertValue(properties.get(key));
        String strKey = qNameConverter.mapQNameToName(key);
        PropertyDefinition propDef = propDefs.get(key);
        if ((value == null) && (propDef != null))
        {
            value = propDef.getDefaultValue();
        }
        model.put(strKey, value);
    }
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:19,代码来源:WorkflowModelBuilder.java

示例8: bindPropertyBehaviour

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:PolicyComponentImpl.java

示例9: mapArbitraryProperties

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
private Map<QName, Serializable> mapArbitraryProperties(Map<String, Object> variables,
        final Map<String, Object> localVariables,
            final Map<QName, PropertyDefinition> taskProperties,
            final Map<QName, AssociationDefinition> taskAssociations) 
{
    EntryTransformer<String, Object, QName, Serializable> transformer = new EntryTransformer<String, Object, QName, Serializable>()
    {
        @Override
        public Pair<QName, Serializable> apply(Entry<String, Object> entry)
        {
            String key = entry.getKey();
            QName qname = factory.mapNameToQName(key);
            // Add variable, only if part of task definition or locally defined
            // on task
            if (taskProperties.containsKey(qname) 
                    || taskAssociations.containsKey(qname) 
                    || localVariables.containsKey(key))
            {
                Serializable value = convertPropertyValue(entry.getValue());
                return new Pair<QName, Serializable>(qname, value);
            }
            return null;
        }
    };
    return CollectionUtils.transform(variables, transformer);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:ActivitiPropertyConverter.java

示例10: convertPropertyValue

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
protected Object convertPropertyValue(PropertyDefinition propDef, Serializable value)
{
    Object newValue = value;
    // Convert property value using a default type converter
    if (value instanceof Collection<?>)
    {
        // Convert a collecion of values
        newValue =typeConverter.convert(propDef.getDataType(), (Collection<?>) value);
    }
    else
    {
        // Convert a single value
        newValue = typeConverter.convert(propDef.getDataType(), value);
    }

    // Convert NodeRefs to ActivitiScriptNodes
    DataTypeDefinition dataTypeDef = propDef.getDataType();
    if (dataTypeDef.getName().equals(DataTypeDefinition.NODE_REF))
    {
        newValue = nodeConverter.convertNodes(newValue, propDef.isMultiValued());
    }
    return newValue;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AbstractWorkflowPropertyHandler.java

示例11: handleDefaultProperty

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
protected Object handleDefaultProperty(Object task, TypeDefinition type, QName key, Serializable value)
{
    PropertyDefinition propDef = type.getProperties().get(key);
    if (propDef != null)
    {
        return handleProperty(value, propDef);
    }
    else
    {
        AssociationDefinition assocDef = type.getAssociations().get(key);
        if (assocDef != null)
        {
            return handleAssociation(value, assocDef);
        }
        else if (value instanceof NodeRef)
        {
            return nodeConverter.convertNode((NodeRef)value, false);
        }
    }
    return value;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:AbstractWorkflowPropertyHandler.java

示例12: decrypt

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * Decrypt a property if the data definition (model-specific) requires it.
 * 
 * @param propertyQName             the property qualified name
 * @param inbound                   the property to decrypt
 * @return                          the decrypted property or the original if it wasn't encrypted
 */
public Serializable decrypt(QName propertyQName, Serializable inbound)
{
    PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
    if (inbound == null || propertyDef == null || !(propertyDef.getDataType().getName().equals(DataTypeDefinition.ENCRYPTED)))
    {
        return inbound;
    }
    if (!(inbound instanceof SealedObject))
    {
        return inbound;
    }
    try
    {
     Serializable outbound = encryptor.unsealObject(KeyProvider.ALIAS_METADATA, inbound);
     // Done
     return outbound;
    }
    catch(KeyException e)
    {
    	throw new AlfrescoRuntimeException("Invalid metadata decryption key", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:MetadataEncryptor.java

示例13: convertToCustomModelProperty

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
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;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:CustomModelsImpl.java

示例14: testLabels

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
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());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:RepoDictionaryDAOTest.java

示例15: getProperties

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
@Override
public Collection<PropertyDefinition> getProperties(QName modelName,
        QName dataType)
{
    HashSet<PropertyDefinition> properties = new HashSet<PropertyDefinition>();

    Collection<PropertyDefinition> props = getProperties(modelName);
    for (PropertyDefinition prop : props)
    {
        if ((dataType == null)
                || prop.getDataType().getName().equals(dataType))
        {
            properties.add(prop);
        }
    }
    return properties;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:18,代码来源:DictionaryDAOImpl.java


注:本文中的org.alfresco.service.cmr.dictionary.PropertyDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。