Table Of Contents

Previous topic

7. Specifications

Next topic

2. Lifecycle

This Page

Languages

Previous versions

1.2
1.1

1. Part and document cloning: specifications

This document describes which parts and documents can be cloned, which data are copied and how an user should be able to clone a part.

1.1. Permissions

A user who is a contributor and who can read (access to the attributes pages) can clone a part or a document.

1.2. Cloneable elements

All parts and documents may be cloned. Their state and lifecycle do not matter: even a cancelled object may be cloned.

A new property PLMObject.is_cloneable is available and returns True if the PLMObject can be cloned. The implementation of this property by PLMObject must returns True. A custom part or document may override this property to exclude some plmobjects from the cloning process.

All users and groups can NOT be cloned. All other data can not be cloned.

1.3. Cloning process

1.3.1. Cloning button

A clone button can appear on the attributes page after the “Download as PDF” button.

This clone button appears if:

  • the current user is a contributor
  • the current user can read this object
  • the call to PLMObject.is_cloneable on the current object returns True

A click on this clone button redirects to the URL /object/type/reference/revision/clone/.

1.3.2. Cloning page

The cloning page handles the URL /object/type/reference/revision/clone/

It must raises a PermissionError if the user is not a contributor or can not read the object.

This page is not accessible to a restricted account.

This page must show at the beginning a message explaining that the current object will be cloned.

Then it should put a creation form filled and a form to select Document-Part links and Parent-Child links which will be cloned.

1.3.2.1. Creation form

A creation form must be filled to clone a plmobject.

The type of this creation form is the type of the cloned plmobject. The user must not be able to change this type.

This form must have a new reference.

The revision field must be set to the default new revision.

The lifecycle field should be set to the original lifecycle if it is not the “cancelled” lifecycle. If the cloned plmobject is cancelled, the lifecycle field must be set to the default lifecycle. The user may change this lifecycle to a “normal” lifecycle (not cancelled).

If the user belongs to the plmobject’s group, the group field must be set to the original group. If the user does not belong to the plmobject’s group, the group field must be unset. Available group choices are the groups the user belongs to.

All other creation fields (name, description...) are set from the cloned object.

1.3.3. Object creation

Once the user click on the create button, a new PLMObject is create using the controller associated to the object’s type.

The owner and creator field are set to the current user. The dates of creation and last modification are the current date.

Other fields are set according to the creation form.

The state of the created object is the first state of its lifecycle.

The signers are not copied, they are set like if the object was simply created.

Notification links are not copied.

Revision links are not copied.

Parts-documents links and Document-parts link are copied according to the links forms.

If the cloned plmobject is a document, all non deprecated files are copied, including their thumbnail, original filename and size.

1.3.4. Errors handling

If the creation form is invalid, the object must not be created and the cloning page must be reloaded with all errors notified.

If an error happens while creating the links, the object must be deleted (or the database creation must be rollback) and all created files must be deleted. The creation page must be reloaded with an error message explaining that something wrong happens.

1.3.5. Implementation

The cloning process must be implemented by a new method PLMObjectController.clone() whose signature is overridden by PartController and DocumentController to handle links creation and errors recovery.