Java Code Examples for org.apache.chemistry.opencmis.commons.enums.CmisVersion#CMIS_1_0

The following examples show how to use org.apache.chemistry.opencmis.commons.enums.CmisVersion#CMIS_1_0 . 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: AlfrescoClientDataModelServicesFactory.java    From SearchServices with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Constructs a dictionary by default.
 * 
 * @param qnameFilter QNameFilter
 * @param namespaceDAO NamespaceDAO
 * @param dictionaryService DictionaryComponent
 * @param dictionaryDAO DictionaryDAO
 * @return Map
 */
public static Map<DictionaryKey,CMISAbstractDictionaryService> constructDictionaries(QNameFilter qnameFilter, NamespaceDAO namespaceDAO,
		DictionaryComponent dictionaryService, DictionaryDAO dictionaryDAO) 
{
    DictionaryNamespaceComponent namespaceService = new DictionaryNamespaceComponent();
    namespaceService.setNamespaceDAO(namespaceDAO);

    CMISMapping cmisMapping = new CMISMapping();
    cmisMapping.setCmisVersion(CmisVersion.CMIS_1_0);
    cmisMapping.setFilter(qnameFilter);
    cmisMapping.setNamespaceService(namespaceService);
    cmisMapping.setDictionaryService(dictionaryService);
    cmisMapping.afterPropertiesSet();

    CMISMapping cmisMapping11 = new CMISMapping();
    cmisMapping11.setCmisVersion(CmisVersion.CMIS_1_1);
    cmisMapping11.setFilter(qnameFilter);
    cmisMapping11.setNamespaceService(namespaceService);
    cmisMapping11.setDictionaryService(dictionaryService);
    cmisMapping11.afterPropertiesSet();

    Map<DictionaryKey,CMISAbstractDictionaryService> dictionaries = new HashMap<DictionaryKey,CMISAbstractDictionaryService>();

    DictionaryKey key = new DictionaryKey(CmisVersion.CMIS_1_0, CMISStrictDictionaryService.DEFAULT);
    dictionaries.put(key, newInstance(cmisMapping, dictionaryService, dictionaryDAO));
    CMISMapping mappingWithExclusions = newInstanceOfExcludedCMISMapping(cmisMapping, qnameFilter);
    key = new DictionaryKey(CmisVersion.CMIS_1_0, DICTIONARY_FILTERED_WITH_EXCLUSIONS);
    dictionaries.put(key, newInstance(mappingWithExclusions, dictionaryService, dictionaryDAO));
    
    key = new DictionaryKey(CmisVersion.CMIS_1_1, CMISStrictDictionaryService.DEFAULT);
    dictionaries.put(key, newInstance(cmisMapping11, dictionaryService, dictionaryDAO));
    CMISMapping mappingWithExclusions11 = newInstanceOfExcludedCMISMapping(cmisMapping11, qnameFilter);
    key = new DictionaryKey(CmisVersion.CMIS_1_1, DICTIONARY_FILTERED_WITH_EXCLUSIONS);
    dictionaries.put(key, newInstance(mappingWithExclusions11, dictionaryService, dictionaryDAO));

    return dictionaries;
}
 
Example 2
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 3
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 4
Source File: CmisTypeDefinitionFactoryBean.java    From spring-content with Apache License 2.0 5 votes vote down vote up
public MutableFolderTypeDefinition createFolderTypeDefinition(Class<?> entityClass, Class<?> repoClass, CmisFolder metadata, CmisVersion cmisVersion, String parentId) {
	MutableFolderTypeDefinition folderType = new FolderTypeDefinitionImpl();
	folderType.setBaseTypeId(BaseTypeId.CMIS_FOLDER);
	folderType.setParentTypeId(parentId);
	folderType.setIsControllableAcl(false);
	folderType.setIsControllablePolicy(false);
	folderType.setIsCreatable(repoClass != null);
	folderType.setDescription("Folder");
	folderType.setDisplayName("Folder");
	folderType.setIsFileable(isFileable(repoClass));
	folderType.setIsFulltextIndexed(false);
	folderType.setIsIncludedInSupertypeQuery(true);
	folderType.setLocalName("Folder");
	folderType.setLocalNamespace("");
	folderType.setIsQueryable(false);
	folderType.setQueryName("cmis:folder");
	folderType.setId(BaseTypeId.CMIS_FOLDER.value());
	if (cmisVersion != CmisVersion.CMIS_1_0) {
		TypeMutabilityImpl typeMutability = new TypeMutabilityImpl();
		typeMutability.setCanCreate(false);
		typeMutability.setCanUpdate(false);
		typeMutability.setCanDelete(false);
		folderType.setTypeMutability(typeMutability);
	}

	this.addBasePropertyDefinitions(folderType, entityClass, cmisVersion, parentId != null);
	this.addFolderPropertyDefinitions(folderType, cmisVersion, parentId != null);
	return folderType;
}
 
Example 5
Source File: CMISConnector.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CmisVersion getRequestCmisVersion()
{
    CallContext callContext = AlfrescoCmisServiceCall.get();
    CmisVersion cmisVersion = (callContext != null ? callContext.getCmisVersion() : CmisVersion.CMIS_1_0);
    return cmisVersion;
}
 
Example 6
Source File: AbstractTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Adds all property definitions owned by that type.
 */
protected void createOwningPropertyDefinitions(CMISMapping cmisMapping,
        PropertyAccessorMapping propertyAccessorMapping, PropertyLuceneBuilderMapping luceneBuilderMapping,
        DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    PropertyDefinition<?> propertyDefintion;

    for (org.alfresco.service.cmr.dictionary.PropertyDefinition alfrescoPropDef : cmisClassDef.getProperties()
            .values())
    {
        if (!isBaseType())
        {
            if (!alfrescoPropDef.getContainerClass().equals(cmisClassDef))
            {
                continue;
            }
        }

        // compile property id
        String propertyId = cmisMapping.buildPrefixEncodedString(alfrescoPropDef.getName());

        if(propertyId.equals("cmis:secondaryObjectTypeIds") && cmisMapping.getCmisVersion() == CmisVersion.CMIS_1_0)
        {
        	continue;
        }

        // create property definition
        propertyDefintion = createPropertyDefinition(cmisMapping, propertyId, alfrescoPropDef.getName(),
                dictionaryService, alfrescoPropDef, false);

        // if the datatype is not supported, the property defintion will be
        // null
        if (propertyDefintion != null)
        {
            CMISPropertyAccessor propertyAccessor = null;
            if (propertyAccessorMapping != null)
            {
                propertyAccessor = propertyAccessorMapping.getPropertyAccessor(propertyId);
                if (propertyAccessor == null)
                {
                    propertyAccessor = propertyAccessorMapping.createDirectPropertyAccessor(propertyId,
                            alfrescoPropDef.getName());
                }
            }

            CMISPropertyLuceneBuilder luceneBuilder = null;
            if (luceneBuilderMapping != null)
            {
                luceneBuilder = luceneBuilderMapping.getPropertyLuceneBuilder(propertyId);
                if (luceneBuilder == null)
                {
                    luceneBuilder = luceneBuilderMapping.createDirectPropertyLuceneBuilder(alfrescoPropDef
                            .getName());
                }
            }

            registerProperty(new BasePropertyDefintionWrapper(propertyDefintion, alfrescoPropDef.getName(), this,
                    propertyAccessor, luceneBuilder));
        }
    }
}
 
Example 7
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));
	}
}