Loading...
 

Copy of a CyberEnterprise® object

Copy of a CyberEnterprise® object

The InstantView® commands CopyPersObject and CopyTransObject are used to create a new object, which is a copy of the source object passed on the stack.

The class of the object determines what is copied. For certain classes, a mode can be specified (first parameter) to determine the amount of data to be taken into account when copying.

The general rule for copying objects applies:

  • All embedded data fields defined in a class are copied
  • Pointers to other objects are only copied, the referenced objects themselves are not copied
  • All entries of collections are copied, but the referenced objects themselves are not copied

Basic classes

Objects of the primitive basic classes (CX_NUMERIC, CX_VALUE, CX_VALUE_PER ..., CX_DATE, CX_SPAN_DATE; ...)
are copied in full: copy and original are completely identical.

The following table lists exceptions to this rule and other not so obvious cases for the base classes (CK J, class has its own copy constructor; PC J, class has an overloaded PersistentCopy() function)

Class derived from CK PC Fashion Flag
0 1 2 3
CX_CONDITIONED_BAG CX_AMOUNT J J Only the data field flags and the column variables are copied In addition, all entries (CX_FCONDITION / CX_NAMED_FCONDITION) are copied, but without copying the references (_object) The references of the entries are taken over The referenced objects are also copied
CX_FCONDITION CX_AMOUNT, CX_FORMULA J J Only the formula is copied The reference is accepted. If the CX_FCONDITION is persistent and the referenced object is transient, a persistent copy of the referenced object is created. In the opposite case, a transient copy is created. It must be clarified whether only the reference is really taken over by Assign() for primitiva (which would actually be wrong), or whether separate copies are created The referenced object is copied
CX_NAMED_FCONDITION CX_FCONDITION J J
CX_SUM_AMOUNT CX_AMOUNT, CX_VECTOR_AMOUNT
CX_PRODUCT_AMOUNT CX_AMOUNT, CX_VECTOR_AMOUNT
CX_DATETIME CX_TERM

Classes derived from CX_EXPANDABLE

In general, the following behaviour is inherited for all classes derived from CX_EXPANDABLE

  • All dynamic data fields (slots) - which are not of type RELxx - are transferred (see Copy constructor of CX_FRAME)
  • Reference validity is taken over, but the object controlling the validity itself is not copied ( see Copy constructor of CX_TERMED)
  • The data field "uniqueID" is copied
  • The data field "classID" is copied (important for pseudo classes)
  • The data field "domain" is not copied, but set to the current value - see SetDomain(..., WRITE)

Objects derived from the class CX_STRUCTURED (all business objects) do not copy the "structures" collection.

The following objects are overloaded with respect to CopyPersObject and CopyTransObject. (CK J, class has its own Copy constructor; PC J, class has an overloaded PersistentCopy() function)

Class C K P C Data field Fashion Flag
0 1 2
CX_SLOT_ATTRIBUTES J constraint only the reference is taken over
CX_FORMULA_ATTRIBUTES J J constraint only the reference is taken over
formula only the reference is taken over reference only
CX_CONDITIONED_ATTRIBUTES J J constraint only the reference is taken over
attributeTable will not be taken into account
CX_ATTRIBUTE_SET J constraint only the reference is taken over
attributes referenced objects are newly wrapped with CX_OVERWRITING_REF
CX_SINGLE_CHARGE charge reference only Copy referenced object
subCharge
CX_SINGLE_ALLOCATION amount reference only Copy referenced object
CX_LEGAL_PERSON name is not copied
CX_SCHEDULE term is not copied
CX_CALENDAR term is not copied
mainPeriod
subPeriods is not copied
CX_STRUCTURE J masterStructureis not copied (initialised with NULL)
castis not copied (initialised with NULL)
structureEnumis copied
attributeSetonly reference is copied
CX_STATE_STRUCTUREJ transitionsis copied with mode=1, the contained CX_FCONDITIONS are copied with mode=2.
CX_TRANSACTION transactionStatusEnum is not copied (initialised with 0)
transaction is not copied (initialised with NULL)
txnManagerID is not copied (initialised with 0)
monitors is not copied
CX_COMPOUND_TXN transactionStatusEnum is not copied (initialised with 0)
transaction is not copied (initialised with NULL)
txnManagerID is not copied (initialised with 0)
monitors are not copied
subTransactions
CX_ALLOCATION_TXN transactionStatusEnum is not copied (initialised with 0)
transaction is not copied (initialised with NULL)
txnManagerID is not copied (initialised with 0)
monitors is not copied
allocation is not copied (initialised with NULL)
object
amount
baseAmount
attributeSet

Another possibility to create an object copy is in: