Fixed CMIS checkedout versioning state

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31419 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Florian Mü
2011-10-22 13:02:00 +00:00
parent 1dca4cd1fc
commit fe2f0e718d

View File

@@ -812,17 +812,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
*/ */
public void applyVersioningState(NodeRef nodeRef, VersioningState versioningState) public void applyVersioningState(NodeRef nodeRef, VersioningState versioningState)
{ {
if (versioningState == VersioningState.CHECKEDOUT) if ((versioningState == VersioningState.MAJOR) || (versioningState == VersioningState.MINOR)
{ || (versioningState == VersioningState.CHECKEDOUT))
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
{
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_INITIAL_VERSION, false);
props.put(ContentModel.PROP_AUTO_VERSION, false);
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, props);
}
getCheckOutCheckInService().checkout(nodeRef);
} else if ((versioningState == VersioningState.MAJOR) || (versioningState == VersioningState.MINOR))
{ {
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
{ {
@@ -833,12 +824,17 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
} }
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(5); Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(5);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, versionProperties.put(VersionModel.PROP_VERSION_TYPE, versioningState == VersioningState.MAJOR
versioningState == VersioningState.MAJOR ? VersionType.MAJOR : VersionType.MINOR); || versioningState == VersioningState.CHECKEDOUT ? VersionType.MAJOR : VersionType.MINOR);
versionProperties.put(VersionModel.PROP_DESCRIPTION, "Initial Version"); versionProperties.put(VersionModel.PROP_DESCRIPTION, "Initial Version");
versionService.createVersion(nodeRef, versionProperties); versionService.createVersion(nodeRef, versionProperties);
} }
if (versioningState == VersioningState.CHECKEDOUT)
{
getCheckOutCheckInService().checkout(nodeRef);
}
} }
/** /**