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


Java ClassDefinition.getProperties方法代码示例

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


在下文中一共展示了ClassDefinition.getProperties方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupStartTaskParameters

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
private void setupStartTaskParameters(TypeDefinition typeDef, Map<QName, Serializable> params)
{
    // build a complete anonymous type for the start task
    List<AspectDefinition> aspects = typeDef.getDefaultAspects();
    List<QName> aspectNames = new ArrayList<QName>(aspects.size());
    getMandatoryAspects(typeDef, aspectNames);
    ClassDefinition startTaskDef = dictionaryService.getAnonymousType(typeDef.getName(), aspectNames);

    // apply default values
    Map<QName, PropertyDefinition> propertyDefs = startTaskDef.getProperties(); 
    for (Map.Entry<QName, PropertyDefinition> entry : propertyDefs.entrySet())
    {
        String defaultValue = entry.getValue().getDefaultValue();

        if (params.get(entry.getKey()) == null)
        {
            if (defaultValue != null)
            {
                params.put(entry.getKey(), (Serializable)DefaultTypeConverter.INSTANCE.convert(entry.getValue().getDataType(), defaultValue));
            }
        }
        else
        {
            params.put(entry.getKey(), (Serializable)DefaultTypeConverter.INSTANCE.convert(entry.getValue().getDataType(), params.get(entry.getKey())));
        }
    }
    
    if (params.containsKey(WorkflowModel.ASSOC_ASSIGNEE))
    {
        String value = (String)params.get(WorkflowModel.ASSOC_ASSIGNEE);
        ArrayList<NodeRef> assignees = new ArrayList<NodeRef>();
        assignees.add(personService.getPerson(value));
        params.put(WorkflowModel.ASSOC_ASSIGNEE, assignees);
    }
    
    params.put(WorkflowModel.ASSOC_PACKAGE, workflowService.createPackage(null));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:WorkflowInterpreter.java

示例2: buildCopyProperties

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Constructs the properties to copy that apply to the type and default aspects 
 */
private Map<QName, Serializable> buildCopyProperties(
        CopyDetails copyDetails,
        Set<QName> classQNames,
        Map<QName, CopyBehaviourCallback> callbacks)
{
    Map<QName, Serializable> sourceNodeProperties = copyDetails.getSourceNodeProperties();
    Map<QName, Serializable> copyProperties = new HashMap<QName, Serializable>(sourceNodeProperties.size(), 1.0F);
    Map<QName, Serializable> scratchProperties = new HashMap<QName, Serializable>(11);
    // Each defined callback gets a chance to say which properties get copied
    // Only model-defined properties are considered
    for (QName classQName : classQNames)
    {
        CopyBehaviourCallback callback = callbacks.get(classQName);
        if (callback == null)
        {
            throw new IllegalStateException("Source node class has no callback: " + classQName);
        }
        // Ignore if not present or if not scheduled for a copy
        if (!callback.getMustCopy(classQName, copyDetails))
        {
            continue;
        }
        // Get the dictionary definition
        ClassDefinition classDef = dictionaryService.getClass(classQName);
        if (classDef == null)
        {
            continue;
        }
        // Get the defined properties
        Map<QName, PropertyDefinition> propertyDefs = classDef.getProperties();
        // Extract these from the source nodes properties and store in a safe (modifiable) map
        scratchProperties.clear();
        for (QName propertyQName : propertyDefs.keySet())
        {
            if (sourceNodeProperties.containsKey(propertyQName))
            {
                Serializable value = sourceNodeProperties.get(propertyQName);
                scratchProperties.put(propertyQName, value);
            }
        }
        // What does the behaviour do with properties?
        Map<QName, Serializable> propsToCopy = callback.getCopyProperties(classQName, copyDetails, scratchProperties);
        
        // Add to the final properties
        copyProperties.putAll(propsToCopy);
    }
    // Done
    return copyProperties;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:53,代码来源:CopyServiceImpl.java

示例3: testMandatoryEnforced

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
public void testMandatoryEnforced()
{
    // get the properties for the test type
    QName testEnforcedQName = QName.createQName(TEST_URL, "enforced");
    ClassDefinition testEnforcedClassDef = service.getClass(testEnforcedQName);
    Map<QName, PropertyDefinition> testEnforcedPropertyDefs = testEnforcedClassDef.getProperties();
    
    PropertyDefinition propertyDef = null;

    QName testMandatoryEnforcedQName = QName.createQName(TEST_URL, "mandatory-enforced");
    propertyDef = testEnforcedPropertyDefs.get(testMandatoryEnforcedQName);
    assertNotNull("Property not found: " + testMandatoryEnforcedQName,
            propertyDef);
    assertTrue("Expected property to be mandatory: " + testMandatoryEnforcedQName,
            propertyDef.isMandatory());
    assertTrue("Expected property to be mandatory-enforced: " + testMandatoryEnforcedQName,
            propertyDef.isMandatoryEnforced());

    QName testMandatoryNotEnforcedQName = QName.createQName(TEST_URL, "mandatory-not-enforced");
    propertyDef = testEnforcedPropertyDefs.get(testMandatoryNotEnforcedQName);
    assertNotNull("Property not found: " + testMandatoryNotEnforcedQName,
            propertyDef);
    assertTrue("Expected property to be mandatory: " + testMandatoryNotEnforcedQName,
            propertyDef.isMandatory());
    assertFalse("Expected property to be mandatory-not-enforced: " + testMandatoryNotEnforcedQName,
            propertyDef.isMandatoryEnforced());

    QName testMandatoryDefaultEnforcedQName = QName.createQName(TEST_URL, "mandatory-default-enforced");
    propertyDef = testEnforcedPropertyDefs.get(testMandatoryDefaultEnforcedQName);
    assertNotNull("Property not found: " + testMandatoryDefaultEnforcedQName,
            propertyDef);
    assertTrue("Expected property to be mandatory: " + testMandatoryDefaultEnforcedQName,
            propertyDef.isMandatory());
    assertFalse("Expected property to be mandatory-not-enforced: " + testMandatoryDefaultEnforcedQName,
            propertyDef.isMandatoryEnforced());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:RepoDictionaryDAOTest.java

示例4: getProperty

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
public PropertyDefinition getProperty(QName className, QName propertyName)
{
    PropertyDefinition propDef = null;
    ClassDefinition classDef = dictionaryDAO.getClass(className);
    if (classDef != null)
    {
        Map<QName,PropertyDefinition> propDefs = classDef.getProperties();
        propDef = propDefs.get(propertyName);
    }
    return propDef;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:12,代码来源:DictionaryComponent.java

示例5: getPropertyDefs

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
public Map<QName,PropertyDefinition> getPropertyDefs(QName className)
{
    ClassDefinition classDef = dictionaryDAO.getClass(className);
    if (classDef != null)
    {
        return classDef.getProperties();
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:10,代码来源:DictionaryComponent.java

示例6: testMandatoryEnforced

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
@Test
public void testMandatoryEnforced()
{
    // get the properties for the test type
    QName testEnforcedQName = QName.createQName(TEST_URL, "enforced");
    ClassDefinition testEnforcedClassDef = service.getClass(testEnforcedQName);
    Map<QName, PropertyDefinition> testEnforcedPropertyDefs = testEnforcedClassDef.getProperties();
    
    PropertyDefinition propertyDef = null;

    QName testMandatoryEnforcedQName = QName.createQName(TEST_URL, "mandatory-enforced");
    propertyDef = testEnforcedPropertyDefs.get(testMandatoryEnforcedQName);
    assertNotNull("Property not found: " + testMandatoryEnforcedQName,
            propertyDef);
    assertTrue("Expected property to be mandatory: " + testMandatoryEnforcedQName,
            propertyDef.isMandatory());
    assertTrue("Expected property to be mandatory-enforced: " + testMandatoryEnforcedQName,
            propertyDef.isMandatoryEnforced());

    QName testMandatoryNotEnforcedQName = QName.createQName(TEST_URL, "mandatory-not-enforced");
    propertyDef = testEnforcedPropertyDefs.get(testMandatoryNotEnforcedQName);
    assertNotNull("Property not found: " + testMandatoryNotEnforcedQName,
            propertyDef);
    assertTrue("Expected property to be mandatory: " + testMandatoryNotEnforcedQName,
            propertyDef.isMandatory());
    assertFalse("Expected property to be mandatory-not-enforced: " + testMandatoryNotEnforcedQName,
            propertyDef.isMandatoryEnforced());

    QName testMandatoryDefaultEnforcedQName = QName.createQName(TEST_URL, "mandatory-default-enforced");
    propertyDef = testEnforcedPropertyDefs.get(testMandatoryDefaultEnforcedQName);
    assertNotNull("Property not found: " + testMandatoryDefaultEnforcedQName,
            propertyDef);
    assertTrue("Expected property to be mandatory: " + testMandatoryDefaultEnforcedQName,
            propertyDef.isMandatory());
    assertFalse("Expected property to be mandatory-not-enforced: " + testMandatoryDefaultEnforcedQName,
            propertyDef.isMandatoryEnforced());
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:38,代码来源:DictionaryDAOTest.java

示例7: createNew

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Construct a transient node for an item yet to be created in the Repository.
 * 
 * This will apply any one-time initialisation required upon creation of the node
 * e.g. assignment of default values. 
 * 
 * @param dictionaryService dictionary service
 * @param typeDef The type definition this node will represent
 * @param name The name of the node
 * @param data The properties and associations this node will have
 * @return  transient node
 */
public static TransientNode createNew(DictionaryService dictionaryService, TypeDefinition typeDef, String name, Map<QName, Serializable> data)
{
    // build a complete anonymous type for the start task
    List<AspectDefinition> aspects = typeDef.getDefaultAspects();
    List<QName> aspectNames = new ArrayList<QName>(aspects.size());
    getMandatoryAspects(typeDef, aspectNames);
    ClassDefinition startTaskDef = dictionaryService.getAnonymousType(typeDef.getName(), aspectNames);

    // initialise start task values
    Map<QName, Serializable> startValues = new HashMap<QName, Serializable>();
    if (data != null)
    {
        startValues.putAll(data);
    }
    
    // apply default values
    Map<QName, PropertyDefinition> propertyDefs = startTaskDef.getProperties(); 
    for (Map.Entry<QName, PropertyDefinition> entry : propertyDefs.entrySet())
    {
        String defaultValue = entry.getValue().getDefaultValue();
        if (defaultValue != null)
        {
            if (startValues.get(entry.getKey()) == null)
            {
                startValues.put(entry.getKey(), (Serializable)DefaultTypeConverter.INSTANCE.convert(entry.getValue().getDataType(), defaultValue));
            }
        }
    }

    return new TransientNode(typeDef.getName(), name, startValues);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:44,代码来源:TransientNode.java

示例8: defaultOnCreateVersion

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
@Override
protected void defaultOnCreateVersion(
        QName classRef,
        NodeRef nodeRef, 
        Map<String, Serializable> versionProperties, 
        PolicyScope nodeDetails)
{
    ClassDefinition classDefinition = this.dictionaryService.getClass(classRef);    
    if (classDefinition != null)
    {           
        boolean wasMLAware = MLPropertyInterceptor.setMLAware(true);
        try
        {
            // Copy the properties
            Map<QName,PropertyDefinition> propertyDefinitions = classDefinition.getProperties();
            for (QName propertyName : propertyDefinitions.keySet()) 
            {
                Serializable propValue = this.nodeService.getProperty(nodeRef, propertyName);
                nodeDetails.addProperty(classRef, propertyName, propValue);
            }
        }
        finally
        {
            MLPropertyInterceptor.setMLAware(wasMLAware);
        }
        
        // Version the associations (child and target)
        Map<QName, AssociationDefinition> assocDefs = classDefinition.getAssociations();

        // TODO: Need way of getting child assocs of a given type
        if (classDefinition.isContainer())
        {
            List<ChildAssociationRef> childAssocRefs = this.nodeService.getChildAssocs(nodeRef);
            for (ChildAssociationRef childAssocRef : childAssocRefs) 
            {
                if (assocDefs.containsKey(childAssocRef.getTypeQName()))
                {
                    nodeDetails.addChildAssociation(classDefinition.getName(), childAssocRef);
                }
            }
        }
        
        // TODO: Need way of getting assocs of a given type
        List<AssociationRef> nodeAssocRefs = this.nodeService.getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL);
        for (AssociationRef nodeAssocRef : nodeAssocRefs) 
        {
            if (assocDefs.containsKey(nodeAssocRef.getTypeQName()))
            {
                nodeDetails.addAssociation(classDefinition.getName(), nodeAssocRef);
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:54,代码来源:VersionServiceImpl.java

示例9: setDefaultTaskProperties

import org.alfresco.service.cmr.dictionary.ClassDefinition; //导入方法依赖的package包/类
/**
 * Sets Default Properties of Task
 * 
 * @param instance
 *            task instance
 */
protected void setDefaultTaskProperties(TaskInstance instance)
{
    Map<QName, Serializable> existingValues = getTaskProperties(instance, false);
    Map<QName, Serializable> defaultValues = new HashMap<QName, Serializable>();

    // construct an anonymous type that flattens all mandatory aspects
    ClassDefinition classDef = getFullTaskDefinition(instance);
    Map<QName, PropertyDefinition> propertyDefs = classDef.getProperties(); 

    // for each property, determine if it has a default value
    for (Map.Entry<QName, PropertyDefinition> entry : propertyDefs.entrySet())
    {
        String defaultValue = entry.getValue().getDefaultValue();
        if (defaultValue != null)
        {
            if (existingValues.get(entry.getKey()) == null || ignoredProperties.containsValue(entry.getKey()))
            {
                defaultValues.put(entry.getKey(), defaultValue);
            }
        }
    }

    // special case for task description default value
    String description = (String)existingValues.get(WorkflowModel.PROP_DESCRIPTION);
    if (description == null || description.length() == 0)
    {
        description = (String) instance.getContextInstance().getVariable(
                factory.mapQNameToName(WorkflowModel.PROP_WORKFLOW_DESCRIPTION));
        if (description != null && description.length() > 0)
        {
            defaultValues.put(WorkflowModel.PROP_DESCRIPTION, description);
        }
        else
        {
            WorkflowTask task = createWorkflowTask(instance);
            defaultValues.put(WorkflowModel.PROP_DESCRIPTION, task.getTitle());
        }
    }

    // assign the default values to the task
    if (defaultValues.size() > 0)
    {
        setTaskProperties(instance, defaultValues);
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:52,代码来源:JBPMEngine.java


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