当前位置: 首页>>代码示例>>Java>>正文


Java VersioningState.NONE属性代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.enums.VersioningState.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java VersioningState.NONE属性的具体用法?Java VersioningState.NONE怎么用?Java VersioningState.NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.chemistry.opencmis.commons.enums.VersioningState的用法示例。


在下文中一共展示了VersioningState.NONE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDocumentDefaultVersioningState

/**
 * Gets default value of <code>VersioningState</code> based on whether document is versionable or not.
 * 
 * @param versioningState
 * @param type
 * @return <code>VersioningState.MAJOR</code> if versioningState is {@code null} and object is versionable
 *         <code>VersioningState.NONE</code> if versioningState is {@code null} and object is not versionable
 *         versioningState if it's value is not {@code null}
 */
private VersioningState getDocumentDefaultVersioningState(VersioningState versioningState, TypeDefinitionWrapper type)
{
    if (versioningState == null)
    {
        DocumentTypeDefinition docType = (DocumentTypeDefinition) type.getTypeDefinition(false);
        versioningState = docType.isVersionable() ? VersioningState.MAJOR : VersioningState.NONE;
    }
    return versioningState;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AlfrescoCmisServiceImpl.java

示例2: createFileFromUpload

@Override
public FileCustom createFileFromUpload(ByteArrayInOutStream file, String mimeType, String filename, 
		long length, String typeFichier, String prefixe, Candidature candidature, Boolean commune) throws FileException{
	try{
		String name = prefixe+"_"+filename;
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value());
		properties.put(PropertyIds.NAME, name);

		ByteArrayInputStream bis = file.getInputStream();
		ContentStream contentStream = new ContentStreamImpl(name, BigInteger.valueOf(length), mimeType, bis);	
		Folder master;
		if (typeFichier.equals(ConstanteUtils.TYPE_FICHIER_GESTIONNAIRE)){
			master = getFolderGestionnaire();
		}else{
			master = getFolderCandidature(candidature, commune);
		}
		
		//versioning
		VersioningState versioningState = VersioningState.NONE;
		if (enableVersioningCmis!=null && enableVersioningCmis){
			versioningState = VersioningState.MINOR;
		}
		
		Document d = master.createDocument(properties, contentStream, versioningState);
		file.close();
		bis.close();
		return getFileFromDoc(d,filename, prefixe);
	}catch(Exception e){
		logger.error("Stockage de fichier - CMIS : erreur de creation du fichier ",e);
		throw new FileException(applicationContext.getMessage("file.error.create", null, UI.getCurrent().getLocale()),e);
	}		
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:33,代码来源:FileManagerCmisImpl.java

示例3: storeDocument

private Document storeDocument(Folder parentFolder, Map<String, Object> cmisProperties, ContentStream contentStream) throws Exception {
    if (!cmisProperties.containsKey(PropertyIds.OBJECT_TYPE_ID)) {
        cmisProperties.put(PropertyIds.OBJECT_TYPE_ID, CamelCMISConstants.CMIS_DOCUMENT);
    }

    VersioningState versioningState = VersioningState.NONE;
    if (getSessionFacade().isObjectTypeVersionable((String) cmisProperties.get(PropertyIds.OBJECT_TYPE_ID))) {
        versioningState = VersioningState.MAJOR;
    }
    LOG.debug("Creating document with properties: {}", cmisProperties);
    return parentFolder.createDocument(cmisProperties, contentStream, versioningState);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:CMISProducer.java

示例4: createDocument

/**
 * CMIS createDocument.
 */
public String createDocument(CallContext context, Properties properties, String folderId,
        ContentStream contentStream, VersioningState versioningState) {
    checkUser(context, true);

    // check versioning state
    if (VersioningState.NONE != versioningState) {
        throw new CmisConstraintException("Versioning not supported!");
    }

    // get parent File
    File parent = getFile(folderId);
    if (!parent.isDirectory()) {
        throw new CmisObjectNotFoundException("Parent is not a folder!");
    }

    // check properties
    checkNewProperties(properties, BaseTypeId.CMIS_DOCUMENT);

    // check the file
    String name = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
    File newFile = new File(parent, name);
    if (newFile.exists()) {
        throw new CmisNameConstraintViolationException("Document already exists!");
    }

    // create the file
    try {
        newFile.createNewFile();
    } catch (IOException e) {
        throw new CmisStorageException("Could not create file: " + e.getMessage(), e);
    }

    // write content, if available
    if (contentStream != null && contentStream.getStream() != null) {
        writeContent(newFile, contentStream.getStream());
    }

    return getId(newFile);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:42,代码来源:FileBridgeRepository.java

示例5: createDocument

public RegistryObject createDocument(RegistryFolder parentFolder, String name, Properties properties, ContentStream contentStream, VersioningState versioningState) {
    try {
    	Resource fileNode = repository.newResource();
    	
    	// write content, if available
        if(contentStream != null && contentStream.getStream() != null){
        	//set stream
            fileNode.setProperty(CMISConstants.GREG_DATA, "true");
        	fileNode.setContentStream(contentStream.getStream());
        }

        //Put to registry AS A PWC (Look at getDestPathOfNode() )
        String destinationPath = CommonUtil.getTargetPathOfNode(parentFolder, name);
        repository.put(destinationPath, fileNode);
        fileNode = repository.get(destinationPath);
        
    	// compile the properties
        RegistryFolder.setProperties(repository, fileNode, getTypeDefinition(), properties);

        //Set MIMETYPE
        if (contentStream != null && contentStream.getMimeType() != null) {
        	fileNode.setProperty(CMISConstants.GREG_MIMETYPE, contentStream.getMimeType());
            fileNode.setMediaType(contentStream.getMimeType());
        }

        repository.put(destinationPath, fileNode);
        fileNode = repository.get(destinationPath);

        if (versioningState == VersioningState.NONE) {
            fileNode.setProperty(CMISConstants.GREG_UNVERSIONED_TYPE, "true");
            repository.put(destinationPath, fileNode);
            return new RegistryUnversionedDocument(repository, fileNode, typeManager, pathManager);
        }

        //Else, create as a PWC. See spec
        //TODO Set the destination of this PWC to a temp and put it to it's intended location when checked in
        fileNode.setProperty(CMISConstants.GREG_IS_CHECKED_OUT, "true");

        //Put to registry
        repository.put(destinationPath, fileNode);

        RegistryObject gregFileNode = getGregNode(fileNode);
        RegistryVersionBase gregVersion = gregFileNode.asVersion();
        if(versioningState==VersioningState.CHECKEDOUT){

            //Put to checked out tracker
            Resource resource = null;
            if(repository.resourceExists(CMISConstants.GREG_CHECKED_OUT_TRACKER)){
                resource  = repository.get(CMISConstants.GREG_CHECKED_OUT_TRACKER);
            } else{
                resource = repository.newResource();
                //Have to set content, otherwise Greg will throw exception when browsing this file in Workbench
                resource.setContent("tracker");
            }
            resource.setProperty(gregVersion.getNode().getPath(), "true");
            repository.put(CMISConstants.GREG_CHECKED_OUT_TRACKER, resource);

            //Set property saying this was created as a PWC
            gregVersion.getNode().setProperty(CMISConstants.GREG_CREATED_AS_PWC, "true");
            repository.put(gregVersion.getNode().getPath(), gregVersion.getNode());
            gregVersion = getGregNode(repository.get(gregVersion.getNode().getPath())).asVersion();
            return gregVersion.getPwc();
        } else  {
            if( versioningState == VersioningState.MAJOR){
                gregVersion.getNode().addProperty(CMISConstants.GREG_VERSION_STATE, CMISConstants.GREG_MAJOR_VERSION);
            } else if (versioningState==VersioningState.MINOR){
                gregVersion.getNode().addProperty(CMISConstants.GREG_VERSION_STATE, CMISConstants.GREG_MINOR_VERSION);
            }
            //put properties
            repository.put(gregVersion.getNode().getPath(), gregVersion.getNode());

            return gregVersion.checkin(null, null, "auto checkin");
        }
    }
    catch (RegistryException e) {
        log.debug(e.getMessage(), e);
        throw new CmisStorageException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:79,代码来源:DocumentTypeHandler.java

示例6: createDocument

/**
 * CMIS createDocument.
 */
public String createDocument(CallContext context, Properties properties,
		String folderId, ContentStream contentStream,
		VersioningState versioningState) {
	checkUser(context, true);

	// check versioning state
	if (VersioningState.NONE != versioningState) {
		throw new CmisConstraintException("Versioning not supported!");
	}

	// get parent File
	File parent = getFile(folderId);
	if (!parent.isDirectory()) {
		throw new CmisObjectNotFoundException("Parent is not a folder!");
	}

	// check properties
	checkNewProperties(properties);

	// check the file
	String name = FileBridgeUtils.getStringProperty(properties,
			PropertyIds.NAME);
	File newFile = new File(parent, name);
	if (newFile.exists()) {
		throw new CmisNameConstraintViolationException(
				"Document already exists!");
	}

	// create the file
	try {
		newFile.createNewFile();
	} catch (IOException e) {
		throw new CmisStorageException("Could not create file: "
				+ e.getMessage(), e);
	}

	// write content, if available
	if (contentStream != null && contentStream.getStream() != null) {
		writeContent(newFile, contentStream.getStream());
	}

	return getId(newFile);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:46,代码来源:FileBridgeRepository.java


注:本文中的org.apache.chemistry.opencmis.commons.enums.VersioningState.NONE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。