. JavaScript API enhancements checkpoint:

- checkout() - perform a checkout of a node, returning the working-copy as the result
 - checkin() - perform a checkin of a working-copy node, returning the original as the result
 - cancelCheckout() - cancel the checkout of a work-copy node
. Fix from Roy to VersionableAspect to correctly handle making a node versionable, setting content and checking in/out all within a single transaction

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3434 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-07-28 15:27:28 +00:00
parent 8814fac8bc
commit 0c35c285bd
3 changed files with 134 additions and 31 deletions

View File

@@ -178,7 +178,7 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
*/
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
if (aspectTypeQName.equals(ContentModel.ASPECT_VERSIONABLE) == true)
if (this.nodeService.exists(nodeRef) == true && aspectTypeQName.equals(ContentModel.ASPECT_VERSIONABLE) == true)
{
boolean initialVersion = true;
Boolean value = (Boolean)this.nodeService.getProperty(nodeRef, ContentModel.PROP_INITIAL_VERSION);
@@ -190,10 +190,14 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
if (initialVersion == true)
{
// Queue create version action
Map<String, Serializable> versionDetails = new HashMap<String, Serializable>(1);
versionDetails.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_INITIAL_VERSION));
this.versionService.createVersion(nodeRef, versionDetails);
Map<NodeRef, NodeRef> versionedNodeRefs = (Map)AlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
if (versionedNodeRefs == null || versionedNodeRefs.containsKey(nodeRef) == false)
{
// Queue create version action
Map<String, Serializable> versionDetails = new HashMap<String, Serializable>(1);
versionDetails.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_INITIAL_VERSION));
this.versionService.createVersion(nodeRef, versionDetails);
}
}
}
}