org.apache.chemistry.opencmis.commons.enums.PropertyType Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.enums.PropertyType. 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: TypeManager.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void addFolderPropertyDefinitions(FolderTypeDefinitionImpl type) {
	type.addPropertyDefinition(createPropDef(PropertyIds.PARENT_ID, "Parent Id", "Parent Id", PropertyType.ID,
			Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS,
			"Allowed Child Object Type Ids", "Allowed Child Object Type Ids", PropertyType.ID, Cardinality.MULTI,
			Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.PATH, "Path", "Path", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READONLY, false, false));

	/*
	 * Properties of the LogicalDOC folder
	 */
	type.addPropertyDefinition(createPropDef(PROP_DESCRIPTION, "Description", "Description", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READWRITE, false, false));
	type.addPropertyDefinition(createPropDef(PROP_TYPE, "Type", "Type", PropertyType.INTEGER, Cardinality.SINGLE,
			Updatability.READONLY, false, false));
}
 
Example #2
Source File: CMISConnector.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public Properties getAssocProperties(CMISNodeInfo info, String filter)
{
    PropertiesImpl result = new PropertiesImpl();

    Set<String> filterSet = splitFilter(filter);

    for (PropertyDefinitionWrapper propDefWrap : info.getType().getProperties())
    {
        PropertyDefinition<?> propDef = propDefWrap.getPropertyDefinition();
        if ((filterSet != null) && (!filterSet.contains(propDef.getQueryName())))
        {
            // skip properties that are not in the filter
            continue;
        }

        CMISPropertyAccessor cmisPropertyAccessor = propDefWrap.getPropertyAccessor();
        Serializable value = cmisPropertyAccessor.getValue(info);
        PropertyType propType = propDef.getPropertyType();
        PropertyData<?> propertyData = getProperty(propType, propDefWrap, value);
        result.addProperty(propertyData);
    }

    return result;
}
 
Example #3
Source File: CmisUtils.java    From iaf with Apache License 2.0 6 votes vote down vote up
private static <T> AbstractPropertyDefinition<T> addStandardDefinitions(AbstractPropertyDefinition<T> propertyDefinition, Element propertyElement, PropertyType propertyType) {

		String nameAttr = propertyElement.getAttribute("name");
		String displayNameAttr = propertyElement.getAttribute("displayName");
		String localNameAttr = propertyElement.getAttribute("localName");
		String queryNameAttr = propertyElement.getAttribute("queryName");

		propertyDefinition.setId(nameAttr);
		propertyDefinition.setDisplayName(displayNameAttr);
		propertyDefinition.setLocalName(localNameAttr);
		propertyDefinition.setQueryName(queryNameAttr);
		propertyDefinition.setCardinality(Cardinality.SINGLE);
		propertyDefinition.setPropertyType(propertyType);

		return propertyDefinition;
	}
 
Example #4
Source File: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 6 votes vote down vote up
PropertyType propertyType(Field field) {

		if (field.getType().equals(String.class)) {
			return PropertyType.STRING;
		} else if (field.getType().equals(Boolean.class)) {
			return PropertyType.BOOLEAN;
		} else if (field.getType().equals(Date.class)) {
			return PropertyType.DATETIME;
		} else if (field.getType().equals(Integer.class)) {
			return PropertyType.INTEGER;
		} else if (field.getType().equals(Double.class) || field.getType().equals(Float.class)) {
			return PropertyType.DECIMAL;
		} else if (field.getType().equals(URI.class)) {
			return PropertyType.URI;
		} else if ((field.getType().getAnnotation(Id.class) == null) || (field.getType().getAnnotation(org.springframework.data.annotation.Id.class) == null)) {
			return PropertyType.ID;
		}

		throw new IllegalStateException(format("Unable to convert type for field: %s", field.getName()));
	}
 
Example #5
Source File: CmisTestObject.java    From iaf with Apache License 2.0 5 votes vote down vote up
@Override
public List<Property<?>> getProperties() {
	List<Property<?>> list = new ArrayList<Property<?>>();
	
	Property<String> pName = mock(Property.class);
	when(pName.getId()).thenReturn("cmis:name");
	when(pName.getFirstValue()).thenReturn("dummy");
	when(pName.getType()).thenReturn(PropertyType.ID);
	list.add(pName);
	
	Property<BigInteger> pProjectNumber = mock(Property.class);
	when(pProjectNumber.getType()).thenReturn(PropertyType.INTEGER);
	when(pProjectNumber.getId()).thenReturn("project:number");
	when(pProjectNumber.getFirstValue()).thenReturn(new BigInteger("123456789"));
	list.add(pProjectNumber);
	
	Property<GregorianCalendar> pLastModified = mock(Property.class);
	when(pLastModified.getType()).thenReturn(PropertyType.DATETIME);
	when(pLastModified.getId()).thenReturn("project:lastModified");
	when(pLastModified.getFirstValue()).thenReturn(new GregorianCalendar(2019, 1, 26, 16, 31, 15));
	list.add(pLastModified);
	
	Property<Boolean> pOnTime = mock(Property.class);
	when(pOnTime.getId()).thenReturn("project:onTime");
	when(pOnTime.getType()).thenReturn(PropertyType.BOOLEAN);
	when(pOnTime.getFirstValue()).thenReturn(true);
	list.add(pOnTime);
	
	// TODO Fill this list

	return list;
}
 
Example #6
Source File: TypeManager.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void addBasePropertyDefinitions(AbstractTypeDefinition type) {
	type.addPropertyDefinition(createPropDef(PropertyIds.BASE_TYPE_ID, "Base Type Id", "Base Type Id",
			PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.OBJECT_ID, "Object Id", "Object Id", PropertyType.ID,
			Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.OBJECT_TYPE_ID, "Type Id", "Type Id", PropertyType.ID,
			Cardinality.SINGLE, Updatability.ONCREATE, false, true));

	type.addPropertyDefinition(createPropDef(PropertyIds.NAME, "Name", "Name", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READWRITE, false, true));

	type.addPropertyDefinition(createPropDef(PropertyIds.CREATED_BY, "Created By", "Created By",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.CREATION_DATE, "Creation Date", "Creation Date",
			PropertyType.DATETIME, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.LAST_MODIFIED_BY, "Last Modified By", "Last Modified By",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(
			createPropDef(PropertyIds.LAST_MODIFICATION_DATE, "Last Modification Date", "Last Modification Date",
					PropertyType.DATETIME, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.CHANGE_TOKEN, "Change Token", "Change Token",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
}
 
Example #7
Source File: CmisUtils.java    From iaf with Apache License 2.0 5 votes vote down vote up
private static CreatablePropertyTypes xml2creatablePropertyTypes(Element cmisResult) {
	CreatablePropertyTypesImpl creatablePropertyTypes = new CreatablePropertyTypesImpl();
	Element creatablePropertyTypesXml = XmlUtils.getFirstChildTag(cmisResult, "creatablePropertyTypes");
	if(creatablePropertyTypesXml != null) {
		Set<PropertyType> propertyTypeSet = new TreeSet<PropertyType>();
		for (Node type : XmlUtils.getChildTags(cmisResult, "type")) {
			String value = XmlUtils.getStringValue((Element) type);
			if(StringUtils.isNotEmpty(value))
				propertyTypeSet.add(PropertyType.valueOf(value));
		}
		creatablePropertyTypes.setCanCreate(propertyTypeSet);
	}
	return creatablePropertyTypes;
}
 
Example #8
Source File: CmisUtils.java    From iaf with Apache License 2.0 5 votes vote down vote up
private static XmlBuilder creatablePropertyTypes2xml(CreatablePropertyTypes creatablePropertyTypes) {
	XmlBuilder creatablePropertyTypesXml = new XmlBuilder("creatablePropertyTypes");
	if(creatablePropertyTypes != null) {
		for (PropertyType propertyType : creatablePropertyTypes.canCreate()) {
			creatablePropertyTypesXml.addSubElement(CmisUtils.buildXml("type", propertyType.name()));
		}
	}

	return creatablePropertyTypesXml;
}
 
Example #9
Source File: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 5 votes vote down vote up
protected void addFolderPropertyDefinitions(MutableFolderTypeDefinition type, CmisVersion cmisVersion, boolean inherited) {

		if (true /* is fileable */) {
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:parentId", "Parent Id", "Parent Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:path", "Path", "Path", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:allowedChildObjectTypeIds", "Allowed Child Object Type Ids", "Allowed Child Object Type Ids", PropertyType.ID, Cardinality.MULTI, Updatability.READONLY, inherited, false, false, false));
		}
	}
 
Example #10
Source File: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 5 votes vote down vote up
protected void addDocumentPropertyDefinitions(MutableDocumentTypeDefinition type, Class<?> repoClazz, Class<?> storeClazz, CmisVersion cmisVersion, boolean inherited) {

		if (storeClass != null) {
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:contentStreamLength", "Content Stream Length", "Content Stream Length", PropertyType.INTEGER, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:contentStreamMimeType", "MIME Type", "MIME Type", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:contentStreamFileName", "Filename", "Filename", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:contentStreamId", "Content Stream Id", "Content Stream Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
		}

		if (isVersionable(repoClass)) {
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:isImmutable", "Is Immutable", "Is Immutable", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:isLatestVersion", "Is Latest Version", "Is Latest Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:isMajorVersion", "Is Major Version", "Is Major Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:isLatestMajorVersion", "Is Latest Major Version", "Is Latest Major Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			if (cmisVersion != CmisVersion.CMIS_1_0) {
				type.addPropertyDefinition(this
						.createPropertyDefinition("cmis:isPrivateWorkingCopy", "Is Private Working Copy", "Is Private Working Copy", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, inherited, false, true, false));
			}
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:versionLabel", "Version Label", "Version Label", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, true, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:versionSeriesId", "Version Series Id", "Version Series Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, inherited, false, true, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:isVersionSeriesCheckedOut", "Is Version Series Checked Out", "Is Verison Series Checked Out", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, inherited, false, true, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:versionSeriesCheckedOutBy", "Version Series Checked Out By", "Version Series Checked Out By", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:versionSeriesCheckedOutId", "Version Series Checked Out Id", "Version Series Checked Out Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
			type.addPropertyDefinition(this
					.createPropertyDefinition("cmis:checkinComment", "Checkin Comment", "Checkin Comment", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
		}
	}
 
Example #11
Source File: CMISQueryParser.java    From alfresco-data-model with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void checkPredicateConditionsForLike(Map<String, Argument> functionArguments,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Column> columnMap)
{
    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        PropertyArgument propertyArgument = (PropertyArgument) functionArguments.get(Like.ARG_PROPERTY);

        boolean isMultiValued = functionEvaluationContext.isMultiValued(propertyArgument.getPropertyName());

        if (isMultiValued)
        {
            throw new QueryModelException("Like is not supported for multi-valued properties");
        }

        String cmisPropertyName = propertyArgument.getPropertyName();

        Column column = columnMap.get(cmisPropertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                cmisPropertyName = arg.getPropertyName();
            } else
            {
                throw new CmisInvalidArgumentException("Complex column reference not supoprted in LIKE "
                        + cmisPropertyName);
            }
        }

        PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(cmisPropertyName);
        if (propDef.getPropertyDefinition().getPropertyType() != PropertyType.STRING)
        {
            throw new CmisInvalidArgumentException("LIKE is only supported against String types" + cmisPropertyName);
        }
    }
}
 
Example #12
Source File: CMISResultSetColumn.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
CMISResultSetColumn(String name, PropertyDefinitionWrapper propertyDefinition, PropertyType dataType,
        QName alfrescoPropertyQName, QName alfrescoDataTypeQName)
{
    this.name = name;
    this.propertyDefinition = propertyDefinition;
    this.dataType = dataType;
    this.alfrescoPropertyQName = alfrescoPropertyQName;
    this.alfrescoDataTypeQName = alfrescoDataTypeQName;
}
 
Example #13
Source File: CMISAbstractDictionaryService.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public PropertyType findDataType(QName dataType)
{
    return cmisMapping.getDataType(dataType);
}
 
Example #14
Source File: CMISAbstractDictionaryService.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public QName findAlfrescoDataType(PropertyType propertyType)
{
    return cmisMapping.getAlfrescoDataType(propertyType);
}
 
Example #15
Source File: AbstractTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private <T> T convertValueFromString(String value, PropertyType datatype)
{
    if (value == null)
    {
        return null;
    }

    try
    {
        switch (datatype)
        {
        case BOOLEAN:
            return (T) Boolean.valueOf(value);
        case DATETIME:
            GregorianCalendar cal = new GregorianCalendar();
            cal.setTime(ISO8601DateFormat.parse(value));
            return (T) cal;
        case DECIMAL:
            return (T) new BigDecimal(value);
        case HTML:
            return (T) value;
        case ID:
            return (T) value;
        case INTEGER:
            return (T) new BigInteger(value);
        case STRING:
            return (T) value;
        case URI:
            return (T) value;
        default: ;
        }
    }
    catch (Exception e)
    {
        logger.error("Failed to convert value " + value + " to " + datatype, e);
        return null;
    }
    
    throw new RuntimeException("Unknown datatype! Spec change?");
}
 
Example #16
Source File: CMISQueryParser.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void checkPredicateConditionsForIn(Map<String, Argument> functionArguments,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Column> columnMap)
{
    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        PropertyArgument propertyArgument = (PropertyArgument) functionArguments.get(In.ARG_PROPERTY);
        LiteralArgument modeArgument = (LiteralArgument) functionArguments.get(In.ARG_MODE);
        String modeString = DefaultTypeConverter.INSTANCE.convert(String.class,
                modeArgument.getValue(functionEvaluationContext));
        PredicateMode mode = PredicateMode.valueOf(modeString);
        String propertyName = propertyArgument.getPropertyName();

        Column column = columnMap.get(propertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                propertyName = arg.getPropertyName();
            } else
            {
                throw new CmisInvalidArgumentException("Complex column reference not supoprted in LIKE "
                        + propertyName);
            }
        }

        boolean isMultiValued = functionEvaluationContext.isMultiValued(propertyName);

        switch (mode)
        {
        case ANY:
            if (isMultiValued)
            {
                break;
            } else
            {
                throw new QueryModelException("Predicate mode " + PredicateMode.ANY
                        + " is not supported for IN and single valued properties");
            }
        case SINGLE_VALUED_PROPERTY:
            if (isMultiValued)
            {
                throw new QueryModelException("Predicate mode " + PredicateMode.SINGLE_VALUED_PROPERTY
                        + " is not supported for IN and multi-valued properties");
            } else
            {
                break;
            }
        default:
            throw new QueryModelException("Unsupported predicate mode " + mode);
        }

        PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(propertyName);
        if (propDef.getPropertyDefinition().getPropertyType() == PropertyType.BOOLEAN)
        {
            throw new QueryModelException("In is not supported for properties of type Boolean");
        }
    }

}
 
Example #17
Source File: CMISQueryParser.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void checkPredicateConditionsForComparisons(Function function, Map<String, Argument> functionArguments,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Column> columnMap)
{
    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        ((BaseComparison) function).setPropertyAndStaticArguments(functionArguments);
        String propertyName = ((BaseComparison) function).getPropertyName();
        LiteralArgument modeArgument = (LiteralArgument) functionArguments.get(BaseComparison.ARG_MODE);
        String modeString = DefaultTypeConverter.INSTANCE.convert(String.class,
                modeArgument.getValue(functionEvaluationContext));
        PredicateMode mode = PredicateMode.valueOf(modeString);

        Column column = columnMap.get(propertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                propertyName = arg.getPropertyName();
            } else
            {
                throw new CmisInvalidArgumentException("Complex column reference not supoprted in LIKE "
                        + propertyName);
            }
        }

        boolean isMultiValued = functionEvaluationContext.isMultiValued(propertyName);

        switch (mode)
        {
        case ANY:
            if (isMultiValued)
            {
                if (function.getName().equals(Equals.NAME))
                {
                    break;
                } else
                {
                    throw new QueryModelException("Predicate mode " + PredicateMode.ANY + " is only supported for "
                            + Equals.NAME + " (and multi-valued properties).");
                }
            } else
            {
                throw new QueryModelException("Predicate mode " + PredicateMode.ANY + " is not supported for "
                        + function.getName() + " and single valued properties");
            }
        case SINGLE_VALUED_PROPERTY:
            if (isMultiValued)
            {
                throw new QueryModelException("Predicate mode " + PredicateMode.SINGLE_VALUED_PROPERTY
                        + " is not supported for " + function.getName() + " and multi-valued properties");
            } else
            {
                break;
            }
        default:
            throw new QueryModelException("Unsupported predicate mode " + mode);
        }

        // limit support for ID and Boolean

        PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(propertyName);
        if (propDef.getPropertyDefinition().getPropertyType() == PropertyType.ID)
        {
            if (function.getName().equals(Equals.NAME) || function.getName().equals(NotEquals.NAME))
            {
                return;
            } else
            {
                throw new QueryModelException("Comparison " + function.getName()
                        + " is not supported for properties of type ID");
            }
        } else if (propDef.getPropertyDefinition().getPropertyType() == PropertyType.BOOLEAN)
        {
            if (function.getName().equals(Equals.NAME))
            {
                return;
            } else
            {
                throw new QueryModelException("Comparison " + function.getName()
                        + " is not supported for properties of type Boolean");
            }
        }
    }

}
 
Example #18
Source File: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 4 votes vote down vote up
protected void addBasePropertyDefinitions(MutableTypeDefinition type, Class<?> entityClazz, CmisVersion cmisVersion, boolean inherited) {
	Field cmisNameField = BeanUtils.findFieldWithAnnotation(entityClazz, CmisName.class);
	if (cmisNameField != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:name", "Name", "Name", propertyType(cmisNameField), cardinality(cmisNameField), updatability(entityClazz, cmisNameField), inherited, true, false, false));
	}
	if (cmisVersion != CmisVersion.CMIS_1_0) {
		Field cmisDescField = BeanUtils.findFieldWithAnnotation(entityClazz, CmisDescription.class);
		if (cmisDescField != null) {
			type.addPropertyDefinition(this.createPropertyDefinition("cmis:description", "Description", "Description", propertyType(cmisDescField), cardinality(cmisDescField), updatability(entityClazz, cmisDescField), inherited, false, false, false));
		}
	}

	Field idField = BeanUtils.findFieldWithAnnotation(entityClazz, Id.class);
	if (idField == null) {
		idField = BeanUtils.findFieldWithAnnotation(entityClazz, org.springframework.data.annotation.Id.class);
	}
	if (idField != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:objectId", "Object Id", "Object Id", PropertyType.ID, cardinality(idField), Updatability.READONLY, inherited, false, false, false));
	}

	type.addPropertyDefinition(this.createPropertyDefinition("cmis:baseTypeId", "Base Type Id", "Base Type Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
	type.addPropertyDefinition(this.createPropertyDefinition("cmis:objectTypeId", "Object Type Id", "Object Type Id", PropertyType.ID, Cardinality.SINGLE, Updatability.ONCREATE, inherited, true, false, false));
	if (cmisVersion != CmisVersion.CMIS_1_0) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:secondaryObjectTypeIds", "Secondary Type Ids", "Secondary Type Ids", PropertyType.ID, Cardinality.MULTI, Updatability.READONLY, inherited, false, false, false));
	}

	Field field = BeanUtils.findFieldWithAnnotation(entityClazz, CreatedBy.class);
	if (field != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:createdBy", "Created By", "Created By", propertyType(field), cardinality(field), Updatability.READONLY, inherited, false, false, false));
	}
	field = BeanUtils.findFieldWithAnnotation(entityClazz, CreatedDate.class);
	if (field != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:creationDate", "Creation Date", "Creation Date", propertyType(field), cardinality(field), Updatability.READONLY, inherited, false, false, false));
	}
	field = BeanUtils.findFieldWithAnnotation(entityClazz, LastModifiedBy.class);
	if (field != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:lastModifiedBy", "Last Modified By", "Last Modified By", propertyType(field), cardinality(field), Updatability.READONLY, inherited, false, false, false));
	}
	field = BeanUtils.findFieldWithAnnotation(entityClazz, LastModifiedDate.class);
	if (field != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:lastModificationDate", "Last Modification Date", "Last Modification Date", propertyType(field), cardinality(field), Updatability.READONLY, inherited, false, false, false));
	}
	field = BeanUtils.findFieldWithAnnotation(entityClazz, Version.class);
	if (field != null) {
		type.addPropertyDefinition(this.createPropertyDefinition("cmis:changeToken", "Change Token", "Change Token", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, inherited, false, false, false));
	}
}
 
Example #19
Source File: CMISMapping.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public QName getAlfrescoDataType(PropertyType propertyType)
{
    return mapCmisDataTypeToAlfresco.get(propertyType);
}
 
Example #20
Source File: CMISMapping.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public PropertyType getDataType(QName dataType)
{
    return mapAlfrescoToCmisDataType.get(dataType);
}
 
Example #21
Source File: ApiIntegrationTest.java    From estatio with Apache License 2.0 4 votes vote down vote up
@Test
public void t01_putAsset() throws Exception {
    api.putProperty("APIP", "Apiland", "NLD", "ApiCity", org.estatio.dom.asset.PropertyType.SHOPPING_CENTER.name(), null, null, null, OrganisationForHelloWorldNl.REF, "APIFORMAT", "APIEXTREF", "/NLD");
    api.putUnit("APIUNIT", "APIP", "APIONWER", "Name", "BOUTIQUE", dt(1999, 6, 1), null, null, null, null, null, null, null, null, null, null, null);
    Assert.assertThat(properties.findProperties("APIP").size(), Is.is(1));
}
 
Example #22
Source File: CMISMapping.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void afterPropertiesSet()
{
    //
    // Type Mappings
    //

    mapAlfrescoQNameToTypeId.put(OBJECT_QNAME, OBJECT_TYPE_ID);
    mapAlfrescoQNameToTypeId.put(DOCUMENT_QNAME, BaseTypeId.CMIS_DOCUMENT.value());
    mapAlfrescoQNameToTypeId.put(FOLDER_QNAME, BaseTypeId.CMIS_FOLDER.value());
    mapAlfrescoQNameToTypeId.put(RELATIONSHIP_QNAME, BaseTypeId.CMIS_RELATIONSHIP.value());
    mapAlfrescoQNameToTypeId.put(SECONDARY_TYPES_QNAME, BaseTypeId.CMIS_SECONDARY.value());
    mapAlfrescoQNameToTypeId.put(ITEM_QNAME, BaseTypeId.CMIS_ITEM.value());
    mapAlfrescoQNameToTypeId.put(POLICY_QNAME, BaseTypeId.CMIS_POLICY.value());

    mapAlfrescoQNameToCmisQName.put(ContentModel.TYPE_CONTENT, DOCUMENT_QNAME);
    mapAlfrescoQNameToCmisQName.put(ContentModel.TYPE_FOLDER, FOLDER_QNAME);
    mapAlfrescoQNameToCmisQName.put(ContentModel.TYPE_BASE, ITEM_QNAME);

    mapCmisQNameToAlfrescoQName.put(DOCUMENT_QNAME, ContentModel.TYPE_CONTENT);
    mapCmisQNameToAlfrescoQName.put(FOLDER_QNAME, ContentModel.TYPE_FOLDER);
    mapCmisQNameToAlfrescoQName.put(ITEM_QNAME, ContentModel.TYPE_BASE);
    mapCmisQNameToAlfrescoQName.put(RELATIONSHIP_QNAME, null);
    mapCmisQNameToAlfrescoQName.put(POLICY_QNAME, null);

    //
    // Data Type Mappings
    //

    mapAlfrescoToCmisDataType.put(DataTypeDefinition.ANY, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.ENCRYPTED, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.ASSOC_REF, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.BOOLEAN, PropertyType.BOOLEAN);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.CATEGORY, PropertyType.ID);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.CHILD_ASSOC_REF, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.CONTENT, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.DATE, PropertyType.DATETIME);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.DATETIME, PropertyType.DATETIME);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.DOUBLE, PropertyType.DECIMAL);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.FLOAT, PropertyType.DECIMAL);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.INT, PropertyType.INTEGER);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.LOCALE, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.PERIOD, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.LONG, PropertyType.INTEGER);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.MLTEXT, PropertyType.STRING);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.NODE_REF, PropertyType.ID);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.PATH, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.QNAME, null);
    mapAlfrescoToCmisDataType.put(DataTypeDefinition.TEXT, PropertyType.STRING);
    mapAlfrescoToCmisDataType.put(CMIS_DATATYPE_ID, PropertyType.ID);
    mapAlfrescoToCmisDataType.put(CMIS_DATATYPE_URI, PropertyType.URI);
    mapAlfrescoToCmisDataType.put(CMIS_DATATYPE_HTML, PropertyType.HTML);

    mapCmisDataTypeToAlfresco.put(PropertyType.ID, DataTypeDefinition.TEXT);
    mapCmisDataTypeToAlfresco.put(PropertyType.INTEGER, DataTypeDefinition.LONG);
    mapCmisDataTypeToAlfresco.put(PropertyType.STRING, DataTypeDefinition.TEXT);
    mapCmisDataTypeToAlfresco.put(PropertyType.DECIMAL, DataTypeDefinition.DOUBLE);
    mapCmisDataTypeToAlfresco.put(PropertyType.BOOLEAN, DataTypeDefinition.BOOLEAN);
    mapCmisDataTypeToAlfresco.put(PropertyType.DATETIME, DataTypeDefinition.DATETIME);
    mapCmisDataTypeToAlfresco.put(PropertyType.URI, DataTypeDefinition.TEXT);
    mapCmisDataTypeToAlfresco.put(PropertyType.HTML, DataTypeDefinition.TEXT);
}
 
Example #23
Source File: CMISResultSetColumn.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
public PropertyType getCMISDataType()
{
    return dataType;
}
 
Example #24
Source File: TypeManager.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static void addDocumentPropertyDefinitions(DocumentTypeDefinitionImpl type) {
	type.addPropertyDefinition(createPropDef(PropertyIds.IS_IMMUTABLE, "Is Immutable", "Is Immutable",
			PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.IS_LATEST_VERSION, "Is Latest Version",
			"Is Latest Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.IS_MAJOR_VERSION, "Is Major Version", "Is Major Version",
			PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(
			createPropDef(PropertyIds.IS_LATEST_MAJOR_VERSION, "Is Latest Major Version", "Is Latest Major Version",
					PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_LABEL, "Version Label", "Version Label",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, true));

	type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_ID, "Version Series Id",
			"Version Series Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));

	type.addPropertyDefinition(createPropDef(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT,
			"Is Verison Series Checked Out", "Is Verison Series Checked Out", PropertyType.BOOLEAN,
			Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID,
			"Version Series Checked Out Id", "Version Series Checked Out Id", PropertyType.ID, Cardinality.SINGLE,
			Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY,
			"Version Series Checked Out By", "Version Series Checked Out By", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.CHECKIN_COMMENT, "Checkin Comment", "Checkin Comment",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(
			createPropDef(PropertyIds.CONTENT_STREAM_LENGTH, "Content Stream Length", "Content Stream Length",
					PropertyType.INTEGER, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_MIME_TYPE, "MIME Type", "MIME Type",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_FILE_NAME, "Filename", "Filename",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));

	type.addPropertyDefinition(createPropDef(PropertyIds.CONTENT_STREAM_ID, "Content Stream Id",
			"Content Stream Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, false));

	/*
	 * Properties of all LogicalDOC documents
	 */
	type.addPropertyDefinition(createPropDef(PROP_FILEVERSION, "File Version", "File Version", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READONLY, false, false));
	type.addPropertyDefinition(createPropDef(PROP_VERSION, "Version", "Version", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READONLY, false, false));
	type.addPropertyDefinition(createPropDef(PROP_LANGUAGE, "Language", "Language", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READWRITE, false, false));
	type.addPropertyDefinition(createPropDef(PROP_WORKFLOW_STATUS, "Workflow Status", "Workflow Status",
			PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
	type.addPropertyDefinition(createPropDef(PROP_CUSTOMID, "Custom ID", "Custom Identifier", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READWRITE, false, false));
	type.addPropertyDefinition(createPropDef(PROP_RATING, "Rating", "Rating", PropertyType.INTEGER,
			Cardinality.SINGLE, Updatability.READONLY, false, false));
	type.addPropertyDefinition(createPropDef(PROP_TAGS, "Tags", "Tags", PropertyType.STRING, Cardinality.SINGLE,
			Updatability.READWRITE, false, false));
	type.addPropertyDefinition(createPropDef(PROP_TEMPLATE, "Template", "Template", PropertyType.STRING,
			Cardinality.SINGLE, Updatability.READWRITE, false, false));

	/*
	 * Extended properties
	 */
	AttributeSetDAO dao = (AttributeSetDAO) Context.get().getBean(AttributeSetDAO.class);
	List<AttributeSet> sets = dao.findAll();
	for (AttributeSet set : sets) {
		dao.initialize(set);
		Map<String, Attribute> attributes = set.getAttributes();
		for (String name : attributes.keySet()) {
			type.addPropertyDefinition(createPropDef(PROP_EXT + name, name, name, PropertyType.STRING,
					Cardinality.SINGLE, Updatability.READWRITE, false, false));
		}

	}
}
 
Example #25
Source File: CMISDictionaryService.java    From alfresco-data-model with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Find data type
 * 
 * @param dataType QName
 * @return PropertyType
 */
PropertyType findDataType(QName dataType);
 
Example #26
Source File: CMISMapping.java    From alfresco-data-model with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Get the CMIS property type for a property
 * 
 * @param datatype DataTypeDefinition
 * @return PropertyType
 */
public PropertyType getDataType(DataTypeDefinition datatype)
{
    return getDataType(datatype.getName());
}
 
Example #27
Source File: CMISDictionaryService.java    From alfresco-data-model with GNU Lesser General Public License v3.0 votes vote down vote up
QName findAlfrescoDataType(PropertyType propertyType);