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

The following examples show how to use org.alfresco.service.cmr.dictionary.DataTypeDefinition#INT . 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: 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 2
Source File: AbstractCalendarPeriodProvider.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
public QName getExpressionDataType()
{
    return DataTypeDefinition.INT;
}
 
Example 3
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;
}