Java Code Examples for org.alfresco.service.cmr.dictionary.DataTypeDefinition#TEXT

The following examples show how to use org.alfresco.service.cmr.dictionary.DataTypeDefinition#TEXT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseTemplateRenderingEngine.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected Collection<ParameterDefinition> getParameterDefinitions()
{
    Collection<ParameterDefinition> paramList = super.getParameterDefinitions();
    ParameterDefinitionImpl modelParamDef = new ParameterDefinitionImpl(PARAM_MODEL, DataTypeDefinition.ANY, false,
            getParamDisplayLabel(PARAM_MODEL));
    ParameterDefinitionImpl templateParamDef = new ParameterDefinitionImpl(//
            PARAM_TEMPLATE, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_TEMPLATE));
    ParameterDefinitionImpl templateNodeParamDef = new ParameterDefinitionImpl(PARAM_TEMPLATE_NODE,
            DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_TEMPLATE_NODE));
    ParameterDefinitionImpl templatePathParamDef = new ParameterDefinitionImpl(PARAM_TEMPLATE_PATH,
            DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_TEMPLATE_PATH));
    paramList.add(new ParameterDefinitionImpl(PARAM_MIME_TYPE, DataTypeDefinition.TEXT, false,
            getParamDisplayLabel(PARAM_MIME_TYPE)));
    paramList.add(modelParamDef);
    paramList.add(templateParamDef);
    paramList.add(templateNodeParamDef);
    paramList.add(templatePathParamDef);
    return paramList;
}
 
Example 2
Source File: WorkflowFormProcessorTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Map<QName, PropertyDefinition> makeTaskPropertyDefs()
{
    Map<QName, PropertyDefinition> properties = new HashMap<QName, PropertyDefinition>();
    QName intType = DataTypeDefinition.INT;
    MockClassAttributeDefinition priorityDef = MockClassAttributeDefinition.mockPropertyDefinition(PRIORITY_NAME, intType, "2");
    properties.put(PRIORITY_NAME, priorityDef);
    
    QName textType = DataTypeDefinition.TEXT;

    // Add a Description property
    PropertyDefinition descValue = MockClassAttributeDefinition.mockPropertyDefinition(DESC_NAME, textType);
    properties.put(DESC_NAME, descValue);

    // Add a Status property
    PropertyDefinition titleValue = MockClassAttributeDefinition.mockPropertyDefinition(STATUS_NAME, textType);
    properties.put(STATUS_NAME, titleValue);

    // Add a Status property
    PropertyDefinition with_ = MockClassAttributeDefinition.mockPropertyDefinition(PROP_WITH_, textType);
    properties.put(PROP_WITH_, with_);

    // Add a Package Action property
    QName pckgActionGroup = PROP_PACKAGE_ACTION_GROUP;
    PropertyDefinition pckgAction = MockClassAttributeDefinition.mockPropertyDefinition(pckgActionGroup, textType,
                "add_package_item_actions");
    properties.put(pckgActionGroup, pckgAction);

    // Add a Package Action property
    QName pckgItemActionGroup = PROP_PACKAGE_ITEM_ACTION_GROUP;
    PropertyDefinition pckgItemAction = MockClassAttributeDefinition.mockPropertyDefinition(pckgItemActionGroup,
                textType, "start_package_item_actions");
    properties.put(pckgItemActionGroup, pckgItemAction);

    return properties;
}
 
Example 3
Source File: TaskFormProcessorTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Map<QName, PropertyDefinition> makeTaskPropertyDefs()
{
    Map<QName, PropertyDefinition> properties = new HashMap<QName, PropertyDefinition>();
    QName textType = DataTypeDefinition.TEXT;

    // Add a Description property
    PropertyDefinition descValue = MockClassAttributeDefinition.mockPropertyDefinition(DESC_NAME, textType);
    properties.put(DESC_NAME, descValue);

    // Add a Status property
    PropertyDefinition titleValue = MockClassAttributeDefinition.mockPropertyDefinition(STATUS_NAME, textType);
    properties.put(STATUS_NAME, titleValue);

    // Add a Status property
    PropertyDefinition with_ = MockClassAttributeDefinition.mockPropertyDefinition(PROP_WITH_, textType);
    properties.put(PROP_WITH_, with_);

    // Add a Package Action property
    QName pckgActionGroup = PROP_PACKAGE_ACTION_GROUP;
    PropertyDefinition pckgAction = MockClassAttributeDefinition.mockPropertyDefinition(pckgActionGroup, textType,
                "");
    properties.put(pckgActionGroup, pckgAction);

    // Add a Package Action property
    QName pckgItemActionGroup = PROP_PACKAGE_ITEM_ACTION_GROUP;
    PropertyDefinition pckgItemAction = MockClassAttributeDefinition.mockPropertyDefinition(pckgItemActionGroup,
                textType, "read_package_item_actions");
    properties.put(pckgItemActionGroup, pckgItemAction);
    
    
    // Add a priority property
    QName priorityName = PROP_PRIORITY;
    PropertyDefinition priorityDef = 
        MockClassAttributeDefinition.mockPropertyDefinition(priorityName, DataTypeDefinition.INT, Integer.class, "0");
    properties.put(priorityName, priorityDef);

    return properties;
}
 
Example 4
Source File: ParameterDefinitionImplTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ParameterDefinitionImpl create()
{
    ParameterDefinitionImpl paramDef = new ParameterDefinitionImpl(
            NAME,
            DataTypeDefinition.TEXT,
            true,
            DISPLAY_LABEL);
    assertNotNull(paramDef);
    return paramDef;
}
 
Example 5
Source File: Cron.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
public QName getExpressionDataType()
{
    return DataTypeDefinition.TEXT;
}
 
Example 6
Source File: XMLDuration.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
public QName getExpressionDataType()
{
    return DataTypeDefinition.TEXT;
}
 
Example 7
Source File: Lower.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Lower()
{
    super(NAME, DataTypeDefinition.TEXT, args);
}
 
Example 8
Source File: Upper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Upper()
{
    super(NAME, DataTypeDefinition.TEXT, args);
}
 
Example 9
Source File: RestVariableHelper.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 4 votes vote down vote up
public QName extractTypeFromValue(Object value) {
    QName type = null;
    if(value instanceof Collection<?>)
    {
        Collection<?> collection = (Collection<?>) value;
        if(collection.size() > 0)
        {
            type = extractTypeFromValue(collection.iterator().next());
        }
    }
    else
    {
        if(value instanceof String) 
        {
            type = DataTypeDefinition.TEXT;
        }
        else if(value instanceof Integer)
        {
            type = DataTypeDefinition.INT;
        }
        else if(value instanceof Long)
        {
            type = DataTypeDefinition.LONG;
        }
        else if(value instanceof Double)
        {
            type = DataTypeDefinition.DOUBLE;
        }
        else if(value instanceof Float)
        {
            type = DataTypeDefinition.FLOAT;
        }
        else if(value instanceof Date)
        {
            type = DataTypeDefinition.DATETIME;
        }
        else if(value instanceof Boolean)
        {
            type = DataTypeDefinition.BOOLEAN;
        }
        else if(value instanceof QName)
        {
            type = DataTypeDefinition.QNAME;
        }
        else if(value instanceof NodeRef || value instanceof ScriptNode)
        {
            type = DataTypeDefinition.NODE_REF;
        }
    }
   
    if(type == null)
    {
        // Type cannot be determined, revert to default for unknown types
        type = DataTypeDefinition.ANY;
    }
    return type;
}