Merged V2.0 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5212 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5220 .
      - Installer updates (minor)
      - VersionService implementation


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5221 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-02-27 01:01:03 +00:00
parent 7643ba276c
commit 2e252ee520
8 changed files with 231 additions and 29 deletions

View File

@@ -308,17 +308,8 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
if (versionHistoryRef == null)
{
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(PROP_QNAME_VERSIONED_NODE_ID, nodeRef.getId());
// Create a new version history node
ChildAssociationRef childAssocRef = this.dbNodeService.createNode(
getRootNode(),
ContentModel.ASSOC_CHILDREN,
CHILD_QNAME_VERSION_HISTORIES,
TYPE_QNAME_VERSION_HISTORY,
props);
versionHistoryRef = childAssocRef.getChildRef();
// Create the version history
versionHistoryRef = createVersionHistory(nodeRef);
}
else
{
@@ -387,6 +378,28 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
// Return the data object representing the newly created version
return version;
}
/**
* Creates a new version history node, applying the root version aspect is required
*
* @param nodeRef the node ref
* @return the version history node reference
*/
private NodeRef createVersionHistory(NodeRef nodeRef)
{
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, nodeRef.getId());
props.put(PROP_QNAME_VERSIONED_NODE_ID, nodeRef.getId());
// Create a new version history node
ChildAssociationRef childAssocRef = this.dbNodeService.createNode(
getRootNode(),
CHILD_QNAME_VERSION_HISTORIES,
QName.createQName(VersionModel.NAMESPACE_URI, nodeRef.getId()),
TYPE_QNAME_VERSION_HISTORY,
props);
return childAssocRef.getChildRef();
}
/**
* @see org.alfresco.service.cmr.version.VersionService#getVersionHistory(NodeRef)
@@ -771,20 +784,7 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
*/
private NodeRef getVersionHistoryNodeRef(NodeRef nodeRef)
{
NodeRef result = null;
Collection<ChildAssociationRef> versionHistories = this.dbNodeService.getChildAssocs(getRootNode());
for (ChildAssociationRef versionHistory : versionHistories)
{
String nodeId = (String)this.dbNodeService.getProperty(versionHistory.getChildRef(), VersionModel.PROP_QNAME_VERSIONED_NODE_ID);
if (nodeId != null && nodeId.equals(nodeRef.getId()) == true)
{
result = versionHistory.getChildRef();
break;
}
}
return result;
return this.dbNodeService.getChildByName(getRootNode(), CHILD_QNAME_VERSION_HISTORIES, nodeRef.getId());
}
/**