cancel
Showing results for 
Search instead for 
Did you mean: 
resplin
Elite Collaborator
Elite Collaborator

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Design Discussions


Introduction


This page gives details of the problems with the current checkout/checkin code and discusses the necessary refactoring.
In the diagrams, ^ indicates a checked out node and <wc> is the 'Working Copy' aspect and <cf> is the 'Copied From' aspect.


Problem


Assume the following node structure:

Parent P
  Primary child N
    <cf>
    Association to A
    Association to B
    Primary child X
    Primary child Y

Currently after checkout:

Parent P
  Primary child N
    <cf>
    Association to A
    Association to B
    Primary child X
    Primary child Y
  Primary child N^
    <cf>
    Association to A
    Association to B
    Secondary child X
    Secondary child Y

If X or Y are the target of a 1:* association, then the checkout will fail.  The problem is primarily an overloading of the CopyService to support checkout and checkin.  The CopyService should support a shallow and a deep copy.  Merging or any other model-specific behaviour should be left up to the calling code; in this case the CheckinCheckoutService implementation can use the CopyService's deep copy functionality where required but won't rely on the CopyService to do any merging of the node structures.


Required Behaviour


Initially:

Parent P
  Primary child N
    <cf>
    Association to A
    Association to B
    Primary child X
    Primary child Y

After Checkout:

Parent P
  Primary child N
    <cf>
    Association to A
    Association to B
    Primary child X
    Primary child Y
  Primary child N^
    <cf>
    <wc>
    Association to A
    Association to B
    Primary child X^
      <wc>
    Primary child Y^
      <wc>

After Edit:

Parent P
  Primary child N
    <cf>
    Association to A
    Association to B
    Primary child X
    Primary child Y
  Primary child N^
    <cf>
    <wc>
    Association to A
    (deleted) Association to B
    Primary child X^
      <wc>
    (deleted) Primary child Y^
    (added)   Primary child Z

After Checkin:

Parent P
  (deleted) Primary child N
  Primary child N^
    <cf>
    Association to A
    Primary child X^
    (added)   Primary child Z




Changes Required


  1. Copy
    1. Remove overlay copy.  The code may be required later, but must not be part of the CopyService implementation.
    2. No interpretation of the model.
    3. Just deep or shallow copy.
    4. Copy aspects and properties.
    5. Regular (non-child) associations are not copied.
    6. Keep the use of onCopy.
  2. Checkout
    1. Perform deep copy of node.
    2. Fire onCheckout (similar to onCopy).
    3. Mark new nodes with workingCopy aspect.
      1. Add property workingCopySource to the aspect.
    4. Copy normal associations.
  3. Checkin
    1. Disable versioning.
    2. Do not use CopyService.
    3. Fire onCheckin.
    4. Delete orginal node (N).
    5. Move checked-out node (N^) to original parent.
      1. New association
      2. Low-level relink or move, i.e. without firing other policies.
    6. Update uuid of ex-workingCopy node (N^).
    7. Remote workingCopy aspect.
    8. Version the hierarchy.
  4. copiedFrom aspect
    1. onCopy: remote aspect.
    2. onCheckout: do nothing.
  5. Integrity
    1. workingCopy nodes ignore non-workingCopy and vice-versa.




Other


Moving the NodeService policy firing code into an interceptor may be required in order to allow the use of low-level node operations without having the associated policies fired.