• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PropertyDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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 : properties.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,代码来源:M2AnonymousTypeDefinition.java


示例17: testVersioningPropsDefault

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * MNT-9369
 * <p>
 * Initially the ContentModel.PROP_AUTO_VERSION and ContentModel.PROP_AUTO_VERSION_PROPS are true by defaults.
 */
@Test
public void testVersioningPropsDefault()
{
    createTestContent(false);
    Map<QName, PropertyDefinition> versionableProps = DICTIONARY_SERVICE.getAspect(ContentModel.ASPECT_VERSIONABLE).getProperties();
    autoVersion = Boolean.parseBoolean(versionableProps.get(ContentModel.PROP_AUTO_VERSION).getDefaultValue());
    autoVersionProps = Boolean.parseBoolean(versionableProps.get(ContentModel.PROP_AUTO_VERSION_PROPS).getDefaultValue());

    TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            log.debug("Adding versionable aspect.");

            ScriptNode sn = new ScriptNode(testNode, SERVICE_REGISTRY);
            sn.addAspect("cm:versionable");
            return null;
        }
    });

    assertEquals("Incorrect Auto Version property.", autoVersion, NODE_SERVICE.getProperty(testNode, ContentModel.PROP_AUTO_VERSION));
    assertEquals("Incorrect Auto Version Props property.", autoVersionProps, NODE_SERVICE.getProperty(testNode, ContentModel.PROP_AUTO_VERSION_PROPS));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:ScriptNodeTest.java


示例18: matchPropertyDefinition

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
public static PropertyDefinition matchPropertyDefinition(String defaultNameSpaceUri, NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService, String string)
{
    QName search = QName.createQName(QueryParserUtils.expandQName(defaultNameSpaceUri, namespacePrefixResolver, string));
    PropertyDefinition propertyDefinition = dictionaryService.getProperty(QName.createQName(QueryParserUtils.expandQName(defaultNameSpaceUri, namespacePrefixResolver, string)));
    QName match = null;
    if (propertyDefinition == null)
    {
        for (QName definition : dictionaryService.getAllProperties(null))
        {
            if (definition.getNamespaceURI().equalsIgnoreCase(search.getNamespaceURI()))
            {
                if (definition.getLocalName().equalsIgnoreCase(search.getLocalName()))
                {
                    if (match == null)
                    {
                        match = definition;
                    }
                    else
                    {
                        throw new DictionaryException("Ambiguous data datype " + string);
                    }
                }
            }

        }
    }
    else
    {
        return propertyDefinition;
    }
    if (match == null)
    {
        return null;
    }
    else
    {
        return dictionaryService.getProperty(match);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:40,代码来源:QueryParserUtils.java


示例19: getCustomProperties

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入依赖的package包/类
/**
 * Get a map of the sites custom properties
 * 
 * @return map of names and values
 */
public ScriptableQNameMap<String, CustomProperty> getCustomProperties()
{
    if (this.customProperties == null)
    {
        // create the custom properties map
        ScriptNode siteNode = new ScriptNode(this.siteInfo.getNodeRef(), this.serviceRegistry);
        // set the scope, for use when converting props to javascript objects
        siteNode.setScope(scope);
        this.customProperties = new ContentAwareScriptableQNameMap<String, CustomProperty>(siteNode, this.serviceRegistry);
        
        Map<QName, Serializable> props = siteInfo.getCustomProperties();
        for (QName qname : props.keySet())
        {
            // get the property value
            Serializable propValue = props.get(qname);
            
            // convert the value
            NodeValueConverter valueConverter = siteNode.new NodeValueConverter();
            Serializable value = valueConverter.convertValueForScript(qname, propValue);
            
            // get the type and label information from the dictionary
            String title = null;
            String type = null;
            PropertyDefinition propDef = this.serviceRegistry.getDictionaryService().getProperty(qname);
            if (propDef != null)
            {
                type = propDef.getDataType().getName().toString();
                title = propDef.getTitle(this.serviceRegistry.getDictionaryService());
            }
            
            // create the custom property and add to the map
            CustomProperty customProp = new CustomProperty(qname.toString(), value, type, title);
            this.customProperties.put(qname.toString(), customProp);
        }
    }
    return this.customProperties;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:Site.java


示例20: getPropertiesOfDataType

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

    Collection<QName> modelNames = getModels();
    for (QName modelName : modelNames)
    {
        properties.addAll(getProperties(modelName, dataType));
    }

    return properties;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:14,代码来源:DictionaryDAOImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CassandraTemplate类代码示例发布时间:2022-05-22
下一篇:
Java SensorRequest类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap