Skip to content

Commit b33754d

Browse files
authored
Merge pull request #163 from mendix/run/4663-backport-change-methods
[RUN-4663] Upgrade project to 9.24.36 and backport objectHasChangedMemberValue and memberHasChangedValue Java actions
2 parents 9085653 + 5c1bfbd commit b33754d

File tree

59 files changed

+3124
-3006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3124
-3006
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sourceCompatibility = '11'
1313
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
1414

1515
project.ext {
16-
mendixPublicApiVersion = '9.18.0'
16+
mendixPublicApiVersion = '9.24.36'
1717
}
1818

1919
def mprDir = "$projectDir/src/CommunityCommons"
@@ -26,7 +26,7 @@ mxMarketplace {
2626
appDirectory = "src/CommunityCommons"
2727
versionPathPrefix = "_Version " // the path prefix within the module to the version folder
2828
createMigrationFile = true
29-
includeFiles = ["$mprDir/License.txt", "$mprDir/SiemensMendixCommunityCommons__10.2.0__READMEOSS.html"]
29+
includeFiles = ["$mprDir/License.txt", "$mprDir/SiemensMendixCommunityCommons__10.3.0__READMEOSS.html"]
3030
}
3131

3232
def userLibDir = "$mprDir/userlib"
@@ -111,7 +111,7 @@ clean {
111111
release {
112112
tagTemplate = '$name-$version'
113113
git {
114-
requireBranch = 'lts/9.18'
114+
requireBranch = 'lts/9.24'
115115
}
116116
}
117117

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=10.2.1-SNAPSHOT
1+
version=10.3.0-SNAPSHOT
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- We upgraded the Community Commons module to Mendix version 9.24.36.
2+
- 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.
-13.1 MB
Binary file not shown.

src/CommunityCommons/SiemensMendixCommunityCommons__10.2.0__READMEOSS.html renamed to src/CommunityCommons/SiemensMendixCommunityCommons__10.3.0__READMEOSS.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/CommunityCommons/java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
21

src/CommunityCommons/javasource/communitycommons/ORM.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ public static boolean objectHasChanged(IMendixObject anyobject) {
4747
return anyobject.isChanged();
4848
}
4949

50+
/** Returns true if any member has a value other than its original value. */
51+
public static boolean objectHasChangedMemberValue(IContext context, IMendixObject object) {
52+
if (object == null) throw new IllegalArgumentException("The provided object is empty");
53+
return object.hasChangedMemberValue(context);
54+
}
55+
5056
/**
5157
* checks whether a certain member of an object has changed. If the objects itself is still new,
5258
* we consider to be changes as well.
@@ -66,6 +72,13 @@ public static boolean memberHasChanged(IContext context, IMendixObject item, Str
6672
return item.getMember(context, member).getState() == MemberState.CHANGED || item.getState() != ObjectState.NORMAL;
6773
}
6874

75+
/** Check if the value of the member was changed to something other than its original value. */
76+
public static boolean memberHasChangedValue(IContext context, IMendixObject item, String member) {
77+
if (item == null) throw new IllegalArgumentException("The provided object is empty");
78+
if (!item.hasMember(member)) throw new IllegalArgumentException("Unknown member: " + member);
79+
return item.getMember(context, member).isValueChanged(context);
80+
}
81+
6982
public static void deepClone(IContext c, IMendixObject source, IMendixObject target, String membersToSkip, String membersToKeep, String reverseAssociations, String excludeEntities, String excludeModules) throws CoreException {
7083
List<String> toskip = Arrays.asList((membersToSkip + ",createdDate,changedDate").split(","));
7184
List<String> tokeep = Arrays.asList((membersToKeep + ",System.owner,System.changedBy").split(","));
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
// This file was generated by Mendix Studio Pro.
2-
//
3-
// WARNING: Only the following code will be retained when actions are regenerated:
4-
// - the import list
5-
// - the code between BEGIN USER CODE and END USER CODE
6-
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7-
// Other code you write will be lost the next time you deploy the project.
8-
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9-
10-
package communitycommons.actions;
11-
12-
import com.mendix.systemwideinterfaces.core.IMendixObject;
13-
import communitycommons.StringUtils;
14-
import com.mendix.systemwideinterfaces.core.IContext;
15-
import com.mendix.webui.CustomJavaAction;
16-
17-
/**
18-
* Stores an base 64 encoded string plain in the provided target file document
19-
*
20-
* Note that targetFile will be committed.
21-
*/
22-
public class Base64DecodeToFile extends CustomJavaAction<java.lang.Boolean>
23-
{
24-
private java.lang.String encoded;
25-
private IMendixObject __targetFile;
26-
private system.proxies.FileDocument targetFile;
27-
28-
public Base64DecodeToFile(IContext context, java.lang.String encoded, IMendixObject targetFile)
29-
{
30-
super(context);
31-
this.encoded = encoded;
32-
this.__targetFile = targetFile;
33-
}
34-
35-
@java.lang.Override
36-
public java.lang.Boolean executeAction() throws Exception
37-
{
38-
this.targetFile = this.__targetFile == null ? null : system.proxies.FileDocument.initialize(getContext(), __targetFile);
39-
40-
// BEGIN USER CODE
41-
StringUtils.base64DecodeToFile(getContext(), encoded, targetFile);
42-
return true;
43-
// END USER CODE
44-
}
45-
46-
/**
47-
* Returns a string representation of this action
48-
* @return a string representation of this action
49-
*/
50-
@java.lang.Override
51-
public java.lang.String toString()
52-
{
53-
return "Base64DecodeToFile";
54-
}
55-
56-
// BEGIN EXTRA CODE
57-
// END EXTRA CODE
58-
}
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9+
10+
package communitycommons.actions;
11+
12+
import com.mendix.systemwideinterfaces.core.IMendixObject;
13+
import communitycommons.StringUtils;
14+
import com.mendix.systemwideinterfaces.core.IContext;
15+
import com.mendix.webui.CustomJavaAction;
16+
17+
/**
18+
* Stores an base 64 encoded string plain in the provided target file document
19+
*
20+
* Note that targetFile will be committed.
21+
*/
22+
public class Base64DecodeToFile extends CustomJavaAction<java.lang.Boolean>
23+
{
24+
private java.lang.String encoded;
25+
private IMendixObject __targetFile;
26+
private system.proxies.FileDocument targetFile;
27+
28+
public Base64DecodeToFile(IContext context, java.lang.String encoded, IMendixObject targetFile)
29+
{
30+
super(context);
31+
this.encoded = encoded;
32+
this.__targetFile = targetFile;
33+
}
34+
35+
@java.lang.Override
36+
public java.lang.Boolean executeAction() throws Exception
37+
{
38+
this.targetFile = this.__targetFile == null ? null : system.proxies.FileDocument.initialize(getContext(), __targetFile);
39+
40+
// BEGIN USER CODE
41+
StringUtils.base64DecodeToFile(getContext(), encoded, targetFile);
42+
return true;
43+
// END USER CODE
44+
}
45+
46+
/**
47+
* Returns a string representation of this action
48+
* @return a string representation of this action
49+
*/
50+
@java.lang.Override
51+
public java.lang.String toString()
52+
{
53+
return "Base64DecodeToFile";
54+
}
55+
56+
// BEGIN EXTRA CODE
57+
// END EXTRA CODE
58+
}
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
// This file was generated by Mendix Studio Pro.
2-
//
3-
// WARNING: Only the following code will be retained when actions are regenerated:
4-
// - the import list
5-
// - the code between BEGIN USER CODE and END USER CODE
6-
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7-
// Other code you write will be lost the next time you deploy the project.
8-
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9-
10-
package communitycommons.actions;
11-
12-
import com.mendix.systemwideinterfaces.core.IMendixObject;
13-
import communitycommons.ORM;
14-
import com.mendix.systemwideinterfaces.core.IContext;
15-
import com.mendix.webui.CustomJavaAction;
16-
17-
/**
18-
* Clones objects
19-
*
20-
* - Source: the original object to copy
21-
* - Target: the object to copy it into (should be of the same type, or a specialization)
22-
* - includeAssociations: whether to clone associations.
23-
*
24-
* If associated objects need to be cloned as well, use deepClone, this function only copies the references, not the reffered objects. Target is not committed automatically.
25-
*/
26-
public class Clone extends CustomJavaAction<java.lang.Boolean>
27-
{
28-
private IMendixObject source;
29-
private IMendixObject target;
30-
private java.lang.Boolean withAssociations;
31-
32-
public Clone(IContext context, IMendixObject source, IMendixObject target, java.lang.Boolean withAssociations)
33-
{
34-
super(context);
35-
this.source = source;
36-
this.target = target;
37-
this.withAssociations = withAssociations;
38-
}
39-
40-
@java.lang.Override
41-
public java.lang.Boolean executeAction() throws Exception
42-
{
43-
// BEGIN USER CODE
44-
return ORM.cloneObject(this.getContext(), source, target, withAssociations);
45-
// END USER CODE
46-
}
47-
48-
/**
49-
* Returns a string representation of this action
50-
* @return a string representation of this action
51-
*/
52-
@java.lang.Override
53-
public java.lang.String toString()
54-
{
55-
return "Clone";
56-
}
57-
58-
// BEGIN EXTRA CODE
59-
// END EXTRA CODE
60-
}
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9+
10+
package communitycommons.actions;
11+
12+
import com.mendix.systemwideinterfaces.core.IMendixObject;
13+
import communitycommons.ORM;
14+
import com.mendix.systemwideinterfaces.core.IContext;
15+
import com.mendix.webui.CustomJavaAction;
16+
17+
/**
18+
* Clones objects
19+
*
20+
* - Source: the original object to copy
21+
* - Target: the object to copy it into (should be of the same type, or a specialization)
22+
* - includeAssociations: whether to clone associations.
23+
*
24+
* If associated objects need to be cloned as well, use deepClone, this function only copies the references, not the reffered objects. Target is not committed automatically.
25+
*/
26+
public class Clone extends CustomJavaAction<java.lang.Boolean>
27+
{
28+
private IMendixObject source;
29+
private IMendixObject target;
30+
private java.lang.Boolean withAssociations;
31+
32+
public Clone(IContext context, IMendixObject source, IMendixObject target, java.lang.Boolean withAssociations)
33+
{
34+
super(context);
35+
this.source = source;
36+
this.target = target;
37+
this.withAssociations = withAssociations;
38+
}
39+
40+
@java.lang.Override
41+
public java.lang.Boolean executeAction() throws Exception
42+
{
43+
// BEGIN USER CODE
44+
return ORM.cloneObject(this.getContext(), source, target, withAssociations);
45+
// END USER CODE
46+
}
47+
48+
/**
49+
* Returns a string representation of this action
50+
* @return a string representation of this action
51+
*/
52+
@java.lang.Override
53+
public java.lang.String toString()
54+
{
55+
return "Clone";
56+
}
57+
58+
// BEGIN EXTRA CODE
59+
// END EXTRA CODE
60+
}

0 commit comments

Comments
 (0)