diff --git a/marketplace/release-notes/11.0.1.txt b/marketplace/release-notes/11.0.1.txt index 8089354..5017d17 100644 --- a/marketplace/release-notes/11.0.1.txt +++ b/marketplace/release-notes/11.0.1.txt @@ -1,4 +1,5 @@ - The StringFromFile Java action now removes BOM from strings. (Ticket #242904) - We have upgraded the Guava dependency to 33.4.7. This also removes the dependency on the jsr305 version 3.0.2 dependency, which causes some code quality scanning tools to report issues. - We have added a warning about possible deadlocks to the commitInSeparateDatabaseTransaction Java action. -- We added the objectHasChangedMemberValue and memberHasChangedValue Java actions. These actions can be used to check if an object or member has a changed value that is different from the original value. \ No newline at end of file +- We added the objectHasChangedMemberValue and memberHasChangedValue Java actions. These actions can be used to check if an object or member has a changed value that is different from the original value. +- We added the ORM.cloneObject(IContext, IMendixObject, IMendixObject, Boolean, Boolean) method. This is an overload for the ORM.cloneObject with an extra Boolean parameter 'skipIsBoth' that can be used to skip 1-on-1 associations. \ No newline at end of file diff --git a/src/CommunityCommons/javasource/communitycommons/ORM.java b/src/CommunityCommons/javasource/communitycommons/ORM.java index 7ede587..a78a1c3 100644 --- a/src/CommunityCommons/javasource/communitycommons/ORM.java +++ b/src/CommunityCommons/javasource/communitycommons/ORM.java @@ -276,6 +276,11 @@ private static boolean isFileDocument(IMendixObject object) { public static Boolean cloneObject(IContext c, IMendixObject source, IMendixObject target, Boolean withAssociations) { + return cloneObject(c, source, target, withAssociations, false); + } + + public static Boolean cloneObject(IContext c, IMendixObject source, + IMendixObject target, Boolean withAssociations, Boolean skipIsBoth) { Map> members = source.getMembers(c); for (var entry : members.entrySet()) { @@ -290,6 +295,10 @@ public static Boolean cloneObject(IContext c, IMendixObject source, continue; } if (withAssociations || ((!(m instanceof MendixObjectReference) && !(m instanceof MendixObjectReferenceSet) && !(m instanceof MendixAutoNumber)))) { + if (skipIsBoth && ( + (m instanceof MendixObjectReference && ((MendixObjectReference) m).isBoth()) || + (m instanceof MendixObjectReferenceSet && ((MendixObjectReferenceSet) m).isBoth()))) + continue; target.setValue(c, entry.getKey(), m.getValue(c)); } }