Deep Clone settings question

4
The documentation of what to enter for "Members to skip", "Members to keep", "Reverse associations", "Exclude entities", and "Exclude modules" is quite sparse. What kind of things can we add in here and what syntax must be used? Also, what do we enter if we don't want to skip any members or exclude any entities/modules? Thanks.
asked
2 answers
5

Since a proper answer was not provided for a while, and what was answered by Austin was just a quote from the very ambiguous documentation, here’s a small input from my dive into the code:

List<String> toskip = Arrays.asList((membersToSkip + ",createdDate,changedDate").split(","));
List<String> tokeep = Arrays.asList((membersToKeep + ",System.owner,System.changedBy").split(","));

So, basically, you need to add a list of members from which you clone, separated by comma, without trailing space or any sort of space, really, example, a classic “Todo” entity would have ‘[Text] Body’, ‘[Boolean] Completed’ and ‘[DateTime] DateCompleted’:

members to skip: ‘Body,Completed’

That would pretty much NOT copy Body and Completed members to the new instance of the model/entity.

Just remember – comma-separated members.

 

EDIT:
Here’s a link to the GitHub: https://github.com/mendix/CommunityCommons/blob/master/src/CommunityCommons/javasource/communitycommons/ORM.java

answered
1

Hi Michael,

The syntax is included in the documentation part of the java action.

 

"

members format: <membername> or <module.association> or <module.objecttype/membername>, where objecttype is the concrete type of the object being cloned. 

reverseAssociation: 
<module.relation>

"

 

If you have a module called MyFirstModule and an entity called Order, you would use a string like this 

'MyFirstModule.Order/Number'

 

If you want to include everything try passing empty strings into those fields except for "members to keep". I think this one is mandatory.

answered