mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/V2.3 to HEAD:
120140: RM-2194: Review feedback 120142: RM-2562: review feedback git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@120258 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -79,7 +79,7 @@ rm.completerecord.mandatorypropertiescheck.enabled=true
|
|||||||
rm.patch.v22.convertToStandardFilePlan=false
|
rm.patch.v22.convertToStandardFilePlan=false
|
||||||
|
|
||||||
#
|
#
|
||||||
# Extended auto-version behaviour. If true and other auto-version properties are satisified, then
|
# Extended auto-version behaviour. If true and other auto-version properties are satisfied, then
|
||||||
# a document will be auto-versioned when it's type is changed.
|
# a document will be auto-versioned when its type is changed.
|
||||||
#
|
#
|
||||||
version.store.enableAutoVersionOnTypeChange=false
|
version.store.enableAutoVersionOnTypeChange=false
|
||||||
|
@@ -142,13 +142,13 @@ public class ExtendedVersionableAspect implements NodeServicePolicies.OnSetNodeT
|
|||||||
public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType)
|
public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType)
|
||||||
{
|
{
|
||||||
if (isAutoVersionOnTypeChange &&
|
if (isAutoVersionOnTypeChange &&
|
||||||
nodeService.exists(nodeRef) == true &&
|
nodeService.exists(nodeRef) &&
|
||||||
!LockUtils.isLockedAndReadOnly(nodeRef, lockService) &&
|
!LockUtils.isLockedAndReadOnly(nodeRef, lockService) &&
|
||||||
nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true &&
|
nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) &&
|
||||||
nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) == false)
|
!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY))
|
||||||
{
|
{
|
||||||
Map<NodeRef, NodeRef> versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
|
Map<NodeRef, NodeRef> versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
|
||||||
if (versionedNodeRefs == null || versionedNodeRefs.containsKey(nodeRef) == false)
|
if (versionedNodeRefs == null || !versionedNodeRefs.containsKey(nodeRef))
|
||||||
{
|
{
|
||||||
// Determine whether the node is auto versionable (for content updates) or not
|
// Determine whether the node is auto versionable (for content updates) or not
|
||||||
boolean autoVersion = false;
|
boolean autoVersion = false;
|
||||||
|
@@ -345,7 +345,7 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
* When I delete version record 1.2
|
* When I delete version record 1.2
|
||||||
* Then 1.1 is the most recent version
|
* Then 1.1 is the most recent version
|
||||||
*/
|
*/
|
||||||
public void testDeleteLatestVersion()
|
public void testDeleteCurrentVersion()
|
||||||
{
|
{
|
||||||
final NodeRef myDocument = createDocumentWithRecordVersions();
|
final NodeRef myDocument = createDocumentWithRecordVersions();
|
||||||
|
|
||||||
@@ -361,44 +361,43 @@ public class DeleteRecordVersionTest extends RecordableVersionsBaseTest
|
|||||||
|
|
||||||
public void when()
|
public void when()
|
||||||
{
|
{
|
||||||
Version version10 = versionHistory.getVersion("1.0");
|
Version version12 = versionHistory.getVersion("1.2");
|
||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
||||||
|
|
||||||
// delete record version 1.0
|
// delete record version 1.2
|
||||||
nodeService.deleteNode(recordVersion10);
|
nodeService.deleteNode(recordVersion12);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void then()
|
public void then()
|
||||||
{
|
{
|
||||||
// check the deleted version
|
// check 1.2
|
||||||
Version version10 = versionHistory.getVersion("1.0");
|
Version version12 = versionHistory.getVersion("1.2");
|
||||||
assertNotNull(version10);
|
assertNotNull(version12);
|
||||||
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version10));
|
assertTrue(recordableVersionService.isRecordedVersionDestroyed(version12));
|
||||||
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
assertNull(recordableVersionService.getVersionRecord(version12));
|
||||||
assertNull(recordVersion10);
|
|
||||||
|
|
||||||
// verify 1.2 setup as expected
|
// verify 1.1
|
||||||
Version version12 = versionHistory.getHeadVersion();
|
Version version11 = versionHistory.getVersion("1.1");
|
||||||
assertEquals("1.2", version12.getVersionLabel());
|
assertNotNull(version11);
|
||||||
NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12);
|
|
||||||
assertNotNull(recordVersion12);
|
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
|
||||||
|
|
||||||
Set<Relationship> from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS);
|
|
||||||
assertEquals(1, from12.size());
|
|
||||||
|
|
||||||
// verify 1.1 setup as expected
|
|
||||||
Version version11 = versionHistory.getPredecessor(version12);
|
|
||||||
assertEquals("1.1", version11.getVersionLabel());
|
|
||||||
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11);
|
||||||
assertNotNull(recordVersion11);
|
assertNotNull(recordVersion11);
|
||||||
|
|
||||||
Set<Relationship> to11 = relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS);
|
assertTrue(relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
assertEquals(1, to11.size());
|
|
||||||
assertEquals(recordVersion12, to11.iterator().next().getSource());
|
|
||||||
|
|
||||||
assertTrue(relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
Set<Relationship> from11 = relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
|
assertEquals(1, from11.size());
|
||||||
|
|
||||||
|
// verify 1.0
|
||||||
|
Version version10 = versionHistory.getVersion("1.0");
|
||||||
|
assertNotNull(version10);
|
||||||
|
NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10);
|
||||||
|
assertNotNull(recordVersion10);
|
||||||
|
|
||||||
|
Set<Relationship> to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS);
|
||||||
|
assertEquals(1, to10.size());
|
||||||
|
assertEquals(recordVersion11, to10.iterator().next().getSource());
|
||||||
|
|
||||||
|
assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user