← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18432: wip, support MERGE/REPLACE as synonyms in MergeStrategy

 

------------------------------------------------------------
revno: 18432
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-26 22:04:54 +0700
message:
  wip, support MERGE/REPLACE as synonyms in MergeStrategy
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/MergeStrategy.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportStrategy.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/MergeStrategy.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/MergeStrategy.java	2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/MergeStrategy.java	2015-02-26 15:04:54 +0000
@@ -33,5 +33,16 @@
  */
 public enum MergeStrategy
 {
-    MERGE_ALWAYS, MERGE_IF_NOT_NULL
+    MERGE_ALWAYS, MERGE_IF_NOT_NULL,
+    MERGE, REPLACE;
+
+    public boolean isMerge()
+    {
+        return this == MERGE_IF_NOT_NULL || this == MERGE;
+    }
+
+    public boolean isReplace()
+    {
+        return this == MERGE_ALWAYS || this == REPLACE;
+    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportStrategy.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportStrategy.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportStrategy.java	2015-02-26 15:04:54 +0000
@@ -45,21 +45,21 @@
 
     public boolean isCreate()
     {
-        return this.equals( NEW ) || this.equals( CREATE );
+        return this == NEW || this == CREATE;
     }
 
     public boolean isUpdate()
     {
-        return this.equals( UPDATES ) || this.equals( UPDATE );
+        return this == UPDATES || this == UPDATE;
     }
 
     public boolean isCreateAndUpdate()
     {
-        return this.equals( NEW_AND_UPDATES ) || this.equals( CREATE_AND_UPDATE );
+        return this == NEW_AND_UPDATES || this == CREATE_AND_UPDATE;
     }
 
     public boolean isDelete()
     {
-        return this.equals( DELETE ) || this.equals( DELETES );
+        return this == DELETE || this == DELETES;
     }
 }