Java Code Examples for org.alfresco.opencmis.mapping.CMISMapping#getAlfrescoClass()

The following examples show how to use org.alfresco.opencmis.mapping.CMISMapping#getAlfrescoClass() . 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: 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 2
Source File: SecondaryTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public SecondaryTypeDefinitionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping propertyAccessorMapping, 
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new SecondaryTypeDefinitionImpl();

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

    if (BaseTypeId.CMIS_SECONDARY.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 (parentQName == null)
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(CMISMapping.SECONDARY_TYPES_QNAME));
        } else if (cmisMapping.isValidCmisSecondaryType(parentQName))
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_SECONDARY, parentQName));
        } else
        {
            throw new IllegalStateException("The CMIS type model should ignore aspects that inherit from excluded aspects");
        }
    }

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

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

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

    createOwningPropertyDefinitions(cmisMapping, propertyAccessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(propertyAccessorMapping, BaseTypeId.CMIS_SECONDARY);
}
 
Example 3
Source File: FolderTypeDefintionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FolderTypeDefintionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping accessorMapping, 
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new FolderTypeDefinitionImpl();

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

    boolean isSystemFolder = false;
    if (BaseTypeId.CMIS_FOLDER.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.isValidCmisFolder(parentQName))
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_FOLDER, parentQName));
        }

        if (alfrescoName.equals(ContentModel.TYPE_SYSTEM_FOLDER)
                || cmisMapping.getDictionaryService().isSubClass(alfrescoName, ContentModel.TYPE_SYSTEM_FOLDER))
        {
            isSystemFolder = true;
        }
    }

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

    typeDef.setIsCreatable(!isSystemFolder);
    typeDef.setIsQueryable(true);
    typeDef.setIsFulltextIndexed(true);
    typeDef.setIsControllablePolicy(false);
    typeDef.setIsControllableAcl(true);
    typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
    typeDef.setIsFileable(true);

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

    createOwningPropertyDefinitions(cmisMapping, accessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(accessorMapping, BaseTypeId.CMIS_FOLDER);
}
 
Example 4
Source File: ItemTypeDefinitionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ItemTypeDefinitionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping accessorMapping, 
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new ItemTypeDefinitionImpl();

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

    if (BaseTypeId.CMIS_ITEM.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(parentQName != null)
        {         
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_ITEM, parentQName));
        }
    }

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

    if (BaseTypeId.CMIS_ITEM.value().equals(typeId) )
    {
    	typeDef.setIsCreatable(false);   // cmis:item is abstract
    	 // TEMP work around for select * from cmis:item which lists folders and files
    	typeDef.setIsQueryable(false);
    }
    else
    {
    	typeDef.setIsCreatable(true);
    	typeDef.setIsQueryable(true);
    }
  
    typeDef.setIsFulltextIndexed(true);
    typeDef.setIsControllablePolicy(true);
    typeDef.setIsControllableAcl(true);
    typeDef.setIsIncludedInSupertypeQuery(cmisClassDef.getIncludedInSuperTypeQuery());
    typeDef.setIsFileable(false);

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

    createOwningPropertyDefinitions(cmisMapping, accessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(accessorMapping, BaseTypeId.CMIS_ITEM);
}
 
Example 5
Source File: PolicyTypeDefintionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public PolicyTypeDefintionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping propertyAccessorMapping, 
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new PolicyTypeDefinitionImpl();

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

    if (BaseTypeId.CMIS_POLICY.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 (parentQName == null)
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(CMISMapping.ASPECTS_QNAME));
        } else if (cmisMapping.isValidCmisPolicy(parentQName))
        {
            typeDef.setParentTypeId(cmisMapping.getCmisTypeId(BaseTypeId.CMIS_POLICY, parentQName));
        } else
        {
            throw new IllegalStateException("The CMIS type model should ignore aspects that inherit from excluded aspects");
        }
    }

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

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

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

    createOwningPropertyDefinitions(cmisMapping, propertyAccessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(propertyAccessorMapping, BaseTypeId.CMIS_POLICY);
}
 
Example 6
Source File: RelationshipTypeDefintionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public RelationshipTypeDefintionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping accessorMapping,
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, ClassDefinition cmisClassDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisClassDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new RelationshipTypeDefinitionImpl();

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

    if (BaseTypeId.CMIS_RELATIONSHIP.value().equals(typeId))
    {
        typeDef.setQueryName(ISO9075.encodeSQL(typeId));
        typeDef.setParentTypeId(null);
        typeDef.setIsCreatable(false);
    } else
    {
        typeDef.setQueryName(ISO9075.encodeSQL(cmisMapping.buildPrefixEncodedString(alfrescoName)));
        typeDef.setParentTypeId(BaseTypeId.CMIS_RELATIONSHIP.value());
        typeDef.setIsCreatable(true);
    }
    
    typeDef.setDisplayName(null);
    typeDef.setDescription(null);

    typeDef.setIsQueryable(false);
    typeDef.setIsFulltextIndexed(false);
    typeDef.setIsControllablePolicy(false);
    typeDef.setIsControllableAcl(false);
    typeDef.setIsIncludedInSupertypeQuery(true);
    typeDef.setIsFileable(false);

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

    createOwningPropertyDefinitions(cmisMapping, accessorMapping, luceneBuilderMapping, dictionaryService, cmisClassDef);
    createActionEvaluators(accessorMapping, BaseTypeId.CMIS_RELATIONSHIP);
}
 
Example 7
Source File: RelationshipTypeDefintionWrapper.java    From alfresco-data-model with GNU Lesser General Public License v3.0 4 votes vote down vote up
public RelationshipTypeDefintionWrapper(CMISMapping cmisMapping, PropertyAccessorMapping accessorMapping,
        PropertyLuceneBuilderMapping luceneBuilderMapping, String typeId, DictionaryService dictionaryService, AssociationDefinition cmisAssocDef)
{
    this.dictionaryService = dictionaryService;
    alfrescoName = cmisAssocDef.getName();
    alfrescoClass = cmisMapping.getAlfrescoClass(alfrescoName);

    typeDef = new RelationshipTypeDefinitionImpl();

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

    typeDef.setQueryName(cmisMapping.buildPrefixEncodedString(alfrescoName));
    typeDef.setParentTypeId(BaseTypeId.CMIS_RELATIONSHIP.value());

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

    typeDef.setIsCreatable(true);
    typeDef.setIsQueryable(false);
    typeDef.setIsFulltextIndexed(false);
    typeDef.setIsControllablePolicy(false);
    typeDef.setIsControllableAcl(false);
    typeDef.setIsIncludedInSupertypeQuery(true);
    typeDef.setIsFileable(false);

    ArrayList<String> both = new ArrayList<String>(2);
    both.add(BaseTypeId.CMIS_DOCUMENT.value());
    both.add(BaseTypeId.CMIS_FOLDER.value());
    
    String sourceTypeId = cmisMapping.getCmisTypeId(cmisMapping
            .getCmisType(cmisAssocDef.getSourceClass().getName()));
    if (sourceTypeId != null)
    {
        typeDef.setAllowedSourceTypes(Collections.singletonList(sourceTypeId));
    }
    else
    {
        typeDef.setAllowedSourceTypes(both);
    }

    String targetTypeId = cmisMapping.getCmisTypeId(cmisMapping
            .getCmisType(cmisAssocDef.getTargetClass().getName()));
    if (targetTypeId != null)
    {
        typeDef.setAllowedTargetTypes(Collections.singletonList(targetTypeId));
    }
    else
    {
        typeDef.setAllowedTargetTypes(both);
    }

    typeDefInclProperties = CMISUtils.copy(typeDef);
    setTypeDefinition(typeDef, typeDefInclProperties);
    createActionEvaluators(accessorMapping, BaseTypeId.CMIS_RELATIONSHIP);
}