Copies the specified Entity and its attribute values to a new Entity where Expressions (in the form attribute=value) override the corresponding cloned attribute values. The new Entity has no associations. Where an Entity specifies an Entity Identity, that identity is not copied to its clone entity. For each Entity in Collection, the operator creates a duplicate of Entity. The implementation is a shallow clone -- associations are not duplicated.
Note: If the cloned entity is database-enabled and contains primary keys, the primary key values must be specified in the qualifier clause or an exception will occur. If an Entity uses a Datastore Identity as its Identity Strategy, a new identifier is created by the database for each clone.
Nested clone calls are not supported, such as E1.clone[assoc1 += E1.assoc1.clone[…]].
RULESHEET EXAMPLE
The following Rulesheet uses .clone to create a new Entity2 element when the value of qtyOrdered in Entity1 is greater than the qtyShipped value. An alias is not required by the .clone operator, because it is possible to create a new entity at the root level, without inserting it into a collection.
SAMPLE RULETEST
A sample Ruletest provides two collections of Entity1. Input, Output, and Expected panels are as follows:
RULESHEET EXAMPLE: COLLECTION
The following Rulesheet uses .clone to create a new Entity2 element in collection1 when Entity1 has a non-zero qtyOrdered value.
SAMPLE RULETEST: COLLECTION
A sample Ruletest provides three collections of Entity1. Input and Output panels are illustrated below: