• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ContentStreamAllowed类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed的典型用法代码示例。如果您正苦于以下问题:Java ContentStreamAllowed类的具体用法?Java ContentStreamAllowed怎么用?Java ContentStreamAllowed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ContentStreamAllowed类属于org.apache.chemistry.opencmis.commons.enums包,在下文中一共展示了ContentStreamAllowed类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTypeDefinition

点赞 3

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
public TypeDefinition getTypeDefinition() {

    DocumentTypeDefinitionImpl unversionedDocument = new DocumentTypeDefinitionImpl();
    unversionedDocument.initialize(super.getTypeDefinition());

    unversionedDocument.setDescription(CMISConstants.DESC_UNVERSIONED_DOCUMENT);
    unversionedDocument.setDisplayName(CMISConstants.DESC_UNVERSIONED_DOCUMENT);
    unversionedDocument.setLocalName(CMISConstants.DESC_UNVERSIONED_DOCUMENT);
    unversionedDocument.setIsQueryable(true);
    unversionedDocument.setQueryName(DOCUMENT_UNVERSIONED_TYPE_ID);
    unversionedDocument.setId(DOCUMENT_UNVERSIONED_TYPE_ID);
    unversionedDocument.setParentTypeId(RegistryTypeManager.DOCUMENT_TYPE_ID);

    unversionedDocument.setIsVersionable(false);
    unversionedDocument.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);

    RegistryTypeManager.addBasePropertyDefinitions(unversionedDocument);
    RegistryTypeManager.addDocumentPropertyDefinitions(unversionedDocument);

    return unversionedDocument;
}
 

开发者ID:wso2,
项目名称:carbon-registry,
代码行数:23,
代码来源:UnversionedDocumentTypeHandler.java

示例2: getTypeDefinition

点赞 3

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
public TypeDefinition getTypeDefinition() {
    DocumentTypeDefinitionImpl documentType = new DocumentTypeDefinitionImpl();
    documentType.setBaseTypeId(BaseTypeId.CMIS_DOCUMENT);
    documentType.setIsControllableAcl(false);
    documentType.setIsControllablePolicy(false);
    documentType.setIsCreatable(true);
    documentType.setDescription("Document");
    documentType.setDisplayName("Document");
    documentType.setIsFileable(true);
    documentType.setIsFulltextIndexed(false);
    documentType.setIsIncludedInSupertypeQuery(true);
    documentType.setLocalName("Document");
    documentType.setLocalNamespace(RegistryTypeManager.NAMESPACE);
    documentType.setIsQueryable(true);
    documentType.setQueryName(RegistryTypeManager.DOCUMENT_TYPE_ID);
    documentType.setId(RegistryTypeManager.DOCUMENT_TYPE_ID);
    documentType.setIsVersionable(true);
    documentType.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);

    RegistryTypeManager.addBasePropertyDefinitions(documentType);
    RegistryTypeManager.addDocumentPropertyDefinitions(documentType);

    return documentType;
}
 

开发者ID:wso2,
项目名称:carbon-registry,
代码行数:25,
代码来源:DocumentTypeHandler.java

示例3: getVersionableCmisType

点赞 3

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
private String getVersionableCmisType(List<Tree<ObjectType>> trees) {
    for (Tree<ObjectType> tree : trees) {
        ObjectType objectType = tree.getItem();
        if (objectType instanceof DocumentType) {
            DocumentType documentType = (DocumentType) objectType;
            if (documentType.getContentStreamAllowed() == ContentStreamAllowed.ALLOWED
                    && documentType.isVersionable()) {
                return documentType.getId();
            }
        }

        String versionableCmisType = getVersionableCmisType(tree.getChildren());
        if (versionableCmisType != null) {
            return versionableCmisType;
        }
    }

    return null;
}
 

开发者ID:federicamazza,
项目名称:vaadin-cmis-browser,
代码行数:20,
代码来源:CmisClient.java

示例4: checkDocumentTypeForContent

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
private void checkDocumentTypeForContent(TypeDefinitionWrapper type)
{
    if (type == null)
    {
        throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
    }
    if (!(type instanceof DocumentTypeDefinitionWrapper))
    {
        throw new CmisStreamNotSupportedException("Object is not a document!");
    }
    if (((DocumentTypeDefinition) type.getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
    {
        throw new CmisConstraintException("Document cannot have content!");
    }
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:16,
代码来源:CMISConnector.java

示例5: appendContentStream

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
        ContentStream contentStream, boolean isLastChunk, ExtensionsData extension)
{
    if ((contentStream == null) || (contentStream.getStream() == null))
    {
        throw new CmisInvalidArgumentException("No content!");
    }

    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
    NodeRef nodeRef = info.getNodeRef();

    if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
    {
        throw new CmisStreamNotSupportedException("Document type doesn't allow content!");
    }

    try
    {
    	connector.appendContent(info, contentStream, isLastChunk);
        objectId.setValue(connector.createObjectId(nodeRef));
    }
	catch(IOException e)
	{
		throw new ContentIOException("", e);
	}
}
 

开发者ID:Alfresco,
项目名称:community-edition-old,
代码行数:30,
代码来源:AlfrescoCmisServiceImpl.java

示例6: deleteContentStream

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
    public void deleteContentStream(
            String repositoryId, Holder<String> objectId, Holder<String> changeToken,
            ExtensionsData extension)
    {
        checkRepositoryId(repositoryId);

        CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

        if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION) && !info.isVariant(CMISObjectVariant.PWC))
        {
            throw new CmisStreamNotSupportedException("Content can only be deleted from ondocuments!");
        }

        final NodeRef nodeRef = info.getNodeRef();

        if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.REQUIRED)
        {
            throw new CmisInvalidArgumentException("Document type requires content!");
        }

        connector.getNodeService().setProperty(nodeRef, ContentModel.PROP_CONTENT, null);
        
//        connector.createVersion(nodeRef, VersionType.MINOR, "Delete content");

        connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);

        objectId.setValue(connector.createObjectId(nodeRef));
    }
 

开发者ID:Alfresco,
项目名称:community-edition-old,
代码行数:30,
代码来源:AlfrescoCmisServiceImpl.java

示例7: appendContentStream

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
        ContentStream contentStream, boolean isLastChunk, ExtensionsData extension)
{
    if ((contentStream == null) || (contentStream.getStream() == null))
    {
        throw new CmisInvalidArgumentException("No content!");
    }

    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
    NodeRef nodeRef = info.getNodeRef();

    if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
    {
        throw new CmisStreamNotSupportedException("Document type doesn't allow content!");
    }

    //ALF-21852 - Separated appendContent and objectId.setValue in two different transactions because
    //after executing appendContent, the new objectId is not visible.
    RetryingTransactionHelper helper = connector.getRetryingTransactionHelper();
    helper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
       public Void execute() throws Throwable
       {
           try
           {
               connector.appendContent(info, contentStream, isLastChunk);
           }
           catch(IOException e)
           {
                throw new ContentIOException("", e);
           }
            return null;
       }
    }, false, true);

   String objId = helper.doInTransaction(new RetryingTransactionCallback<String>()
   {
       public String execute() throws Throwable
       {
           return connector.createObjectId(nodeRef);
       }
   }, true, true);

   objectId.setValue(objId);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:49,
代码来源:AlfrescoCmisServiceImpl.java

示例8: setContentStream

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
public void setContentStream(
        String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
        Holder<String> changeToken, final ContentStream contentStream, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

    if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION) && !info.isVariant(CMISObjectVariant.PWC))
    {
        throw new CmisStreamNotSupportedException("Content can only be set on private working copies or current versions.");
    }

    final NodeRef nodeRef = info.getNodeRef();

    if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
    {
        throw new CmisStreamNotSupportedException("Document type doesn't allow content!");
    }

    boolean existed = connector.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT) != null;
    if (existed && !overwriteFlag)
    {
        throw new CmisContentAlreadyExistsException("Content already exists!");
    }

    if ((contentStream == null) || (contentStream.getStream() == null))
    {
        throw new CmisInvalidArgumentException("No content!");
    }

    //ALF-21852 - Separated setContent and objectId.setValue in two different transactions because
    //after executing setContent, the new objectId is not visible.
    RetryingTransactionHelper helper = connector.getRetryingTransactionHelper();
    helper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            String mimeType = parseMimeType(contentStream);
            final File tempFile = copyToTempFile(contentStream);
            String encoding = getEncoding(tempFile, mimeType);

            try
            {
                ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
                writer.setMimetype(mimeType);
                writer.setEncoding(encoding);
                writer.putContent(tempFile);
            }
            finally
            {
                removeTempFile(tempFile);
            }

            connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
            return null;
        }
    }, false, true);

    String objId = helper.doInTransaction(new RetryingTransactionCallback<String>()
    {
        public String execute() throws Throwable
        {
            return connector.createObjectId(nodeRef);
        }
    }, true, true);

    objectId.setValue(objId);
}
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:71,
代码来源:AlfrescoCmisServiceImpl.java

示例9: deleteContentStream

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
    public void deleteContentStream(
            String repositoryId, Holder<String> objectId, Holder<String> changeToken,
            ExtensionsData extension)
    {
        checkRepositoryId(repositoryId);

        CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

        if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION) && !info.isVariant(CMISObjectVariant.PWC))
        {
            throw new CmisStreamNotSupportedException("Content can only be deleted from ondocuments!");
        }

        final NodeRef nodeRef = info.getNodeRef();

        if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.REQUIRED)
        {
            throw new CmisInvalidArgumentException("Document type requires content!");
        }

        //ALF-21852 - Separated deleteContent and objectId.setValue in two different transactions because
        //after executing deleteContent, the new objectId is not visible.
        RetryingTransactionHelper helper = connector.getRetryingTransactionHelper();
        helper.doInTransaction(new RetryingTransactionCallback<Void>()
        {
            public Void execute() throws Throwable
            {

                connector.getNodeService().setProperty(nodeRef, ContentModel.PROP_CONTENT, null);

//              connector.createVersion(nodeRef, VersionType.MINOR, "Delete content");

                connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
                return null;
            }
        }, false, true);

        String objId = helper.doInTransaction(new RetryingTransactionCallback<String>()
        {
            public String execute() throws Throwable
            {
                return connector.createObjectId(nodeRef);
            }
        }, true, true);

        objectId.setValue(objId);
    }
 

开发者ID:Alfresco,
项目名称:alfresco-repository,
代码行数:49,
代码来源:AlfrescoCmisServiceImpl.java

示例10: DocumentTypeDefinitionWrapper

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
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);
}
 

开发者ID:Alfresco,
项目名称:alfresco-data-model,
代码行数:48,
代码来源:DocumentTypeDefinitionWrapper.java

示例11: setContentStream

点赞 2

import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed; //导入依赖的package包/类
@Override
public void setContentStream(
        String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
        Holder<String> changeToken, final ContentStream contentStream, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

    if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION) && !info.isVariant(CMISObjectVariant.PWC))
    {
        throw new CmisStreamNotSupportedException("Content can only be set ondocuments!");
    }

    final NodeRef nodeRef = info.getNodeRef();

    if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
    {
        throw new CmisStreamNotSupportedException("Document type doesn't allow content!");
    }

    boolean existed = connector.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT) != null;
    if (existed && !overwriteFlag)
    {
        throw new CmisContentAlreadyExistsException("Content already exists!");
    }

    if ((contentStream == null) || (contentStream.getStream() == null))
    {
        throw new CmisInvalidArgumentException("No content!");
    }

    // copy stream to temp file
    final File tempFile = copyToTempFile(contentStream);
    final Charset encoding = getEncoding(tempFile, contentStream.getMimeType());

    try
    {
        ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
        String mimeType = parseMimeType(contentStream);
        writer.setMimetype(mimeType);
        writer.setEncoding(encoding.name());
        writer.putContent(tempFile);
    }
    finally
    {
        removeTempFile(tempFile);
    }

    objectId.setValue(connector.createObjectId(nodeRef));

    connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
}
 

开发者ID:Alfresco,
项目名称:community-edition-old,
代码行数:54,
代码来源:AlfrescoCmisServiceImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)