mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Morning merge.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2889 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -56,4 +56,11 @@ public interface VersionCount
|
||||
* @see #incrementVersionCount()
|
||||
*/
|
||||
public int getVersionCount();
|
||||
|
||||
/**
|
||||
* Sets the current version counter
|
||||
*
|
||||
* @param versionCount the new version counter
|
||||
*/
|
||||
public void setVersionCount(int versionCount);
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ public class ChildAssocImpl implements ChildAssoc
|
||||
this.qName,
|
||||
child.getNodeRef(),
|
||||
this.isPrimary,
|
||||
-1);
|
||||
index);
|
||||
}
|
||||
return childAssocRef;
|
||||
}
|
||||
|
@@ -74,13 +74,24 @@ public class NodeAssocImpl implements NodeAssoc
|
||||
|
||||
public AssociationRef getNodeAssocRef()
|
||||
{
|
||||
boolean trashReference = false;
|
||||
// first check if it is available
|
||||
refReadLock.lock();
|
||||
try
|
||||
{
|
||||
if (nodeAssocRef != null)
|
||||
{
|
||||
return nodeAssocRef;
|
||||
// double check that the parent and child node references match those of our reference
|
||||
if (nodeAssocRef.getSourceRef() != source.getNodeRef() ||
|
||||
nodeAssocRef.getTargetRef() != target.getNodeRef())
|
||||
{
|
||||
trashReference = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we are sure that the reference is correct
|
||||
return nodeAssocRef;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -92,7 +103,7 @@ public class NodeAssocImpl implements NodeAssoc
|
||||
try
|
||||
{
|
||||
// double check
|
||||
if (nodeAssocRef == null )
|
||||
if (nodeAssocRef == null || trashReference)
|
||||
{
|
||||
nodeAssocRef = new AssociationRef(
|
||||
getSource().getNodeRef(),
|
||||
|
@@ -85,7 +85,7 @@ public class VersionCountImpl implements VersionCount
|
||||
/**
|
||||
* For Hibernate use
|
||||
*/
|
||||
private void setVersionCount(int versionCount)
|
||||
public void setVersionCount(int versionCount)
|
||||
{
|
||||
this.versionCount = versionCount;
|
||||
}
|
||||
|
@@ -179,4 +179,22 @@ public class VersionCounterDaoComponentImpl
|
||||
// get an incremented count
|
||||
versionCounter.resetVersionCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the version number for a specified store.
|
||||
*
|
||||
* WARNING: calling this method will completely reset the current
|
||||
* version count for the specified store and cannot be undone.
|
||||
*
|
||||
* @param storeRef the store reference
|
||||
* @param versionCount the new version count
|
||||
*/
|
||||
public synchronized void setVersionNumber(StoreRef storeRef, int versionCount)
|
||||
{
|
||||
// get the version counter
|
||||
VersionCount versionCounter = getVersionCounter(storeRef);
|
||||
// get an incremented count
|
||||
versionCounter.setVersionCount(versionCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user