本文整理汇总了Java中org.apache.chemistry.opencmis.commons.enums.VersioningState.MAJOR属性的典型用法代码示例。如果您正苦于以下问题:Java VersioningState.MAJOR属性的具体用法?Java VersioningState.MAJOR怎么用?Java VersioningState.MAJOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.chemistry.opencmis.commons.enums.VersioningState
的用法示例。
在下文中一共展示了VersioningState.MAJOR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyVersioningState
/**
* Applies a versioning state to a document.
*/
public void applyVersioningState(NodeRef nodeRef, VersioningState versioningState)
{
if (versioningState == VersioningState.CHECKEDOUT)
{
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
{
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
}
// MNT-14687 : Creating a document as checkedout and then cancelling the checkout should delete the document
nodeService.addAspect(nodeRef, ContentModel.ASPECT_CMIS_CREATED_CHECKEDOUT, null);
getCheckOutCheckInService().checkout(nodeRef);
}
else if ((versioningState == VersioningState.MAJOR) || (versioningState == VersioningState.MINOR))
{
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
{
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
}
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(5);
versionProperties.put(
VersionModel.PROP_VERSION_TYPE,
versioningState == VersioningState.MAJOR ? VersionType.MAJOR : VersionType.MINOR);
versionProperties.put(VersionModel.PROP_DESCRIPTION, "Initial Version");
versionService.createVersion(nodeRef, versionProperties);
}
}
示例2: 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;
}
示例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);
}
示例4: 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);
}
}