org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl. 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: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 5 votes vote down vote up
public MutableDocumentTypeDefinition createDocumentTypeDefinition(Class<?> entityClass, Class<?> repoClass, Class<?> storeClass, CmisDocument metadata, CmisVersion cmisVersion, String parentId) {
	MutableDocumentTypeDefinition documentType = new DocumentTypeDefinitionImpl();
	documentType.setBaseTypeId(BaseTypeId.CMIS_DOCUMENT);
	documentType.setParentTypeId(parentId);
	documentType.setIsControllableAcl(false);
	documentType.setIsControllablePolicy(false);
	documentType.setIsCreatable(repoClass != null);
	documentType.setDescription("Document");
	documentType.setDisplayName("Document");
	documentType.setIsFileable(isFileable(repoClass));
	documentType.setIsFulltextIndexed(isFulltextIndexed(repoClass));
	documentType.setIsIncludedInSupertypeQuery(true);
	documentType.setLocalName("Document");
	documentType.setLocalNamespace("");
	documentType.setIsQueryable(false);
	documentType.setQueryName("cmis:document");
	documentType.setId(BaseTypeId.CMIS_DOCUMENT.value());
	if (cmisVersion != CmisVersion.CMIS_1_0) {
		TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
		typeMutability.setCanCreate(false);
		typeMutability.setCanUpdate(false);
		typeMutability.setCanDelete(false);
		documentType.setTypeMutability(typeMutability);
	}

	documentType.setIsVersionable(isVersionable(repoClass));
	documentType.setContentStreamAllowed((storeClass != null) ? ContentStreamAllowed.ALLOWED : ContentStreamAllowed.NOTALLOWED);

	this.addBasePropertyDefinitions(documentType, entityClass, cmisVersion, parentId != null);
	this.addDocumentPropertyDefinitions(documentType, repoClass, storeClass, cmisVersion, parentId != null);
	return documentType;
}
 
Example #2
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 #3
Source File: DocumentTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public DocumentTypeDefinitionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping accessorMapping, 
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new DocumentTypeDefinitionImpl();

    typeDef.setBaseTypeId(BaseTypeId.CMIS_DOCUMENT);
    typeDef.setId(typeId);
    typeDef.setLocalName(alfrescoName.getLocalName());
    typeDef.setLocalNamespace(alfrescoName.getNamespaceURI());

    if (BaseTypeId.CMIS_DOCUMENT.value().equals(typeId))
    {
        typeDef.setQueryName(ISO9075.encodeSQL(typeId));
        typeDef.setParentTypeId(null);
    } else
    {
        typeDef.setQueryName(ISO9075.encodeSQL(cmisMapping.buildPrefixEncodedString(alfrescoName)));
        QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
        if (cmisMapping.isValidCmisDocument(parentQName))
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_DOCUMENT, parentQName));
        }
    }

    typeDef.setDisplayName(null);
    typeDef.setDescription(null);

    typeDef.setIsCreatable(true);
    typeDef.setIsQueryable(true);
    typeDef.setIsFulltextIndexed(true);
    typeDef.setIsControllablePolicy(false);
    typeDef.setIsControllableAcl(true);
    typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
    typeDef.setIsFileable(true);
    typeDef.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
    typeDef.setIsVersionable(true);

    typeDefInclProperties = CMISUtils.copy(typeDef);
    setTypeDefinition(typeDef, typeDefInclProperties);

    createOwningPropertyDefinitions(cmisMapping, accessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(accessorMapping, BaseTypeId.CMIS_DOCUMENT);
}
 
Example #4
Source File: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 4 votes vote down vote up
@Override
public Class<?> getObjectType() {
	return DocumentTypeDefinitionImpl.class;
}