cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [2/4] cayenne git commit: minor cleanup
Date Fri, 30 Sep 2016 19:18:38 GMT
minor cleanup


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/49a6ca39
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/49a6ca39
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/49a6ca39

Branch: refs/heads/master
Commit: 49a6ca3909b5d17d09edc6c9dbd55175bafd8336
Parents: 603117c
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Fri Sep 30 21:45:31 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Fri Sep 30 21:45:31 2016 +0300

----------------------------------------------------------------------
 .../dbsync/merge/AbstractToModelToken.java      | 39 ++++++++++----------
 .../cayenne/dbsync/merge/AddColumnToDb.java     |  8 ++--
 .../dbsync/merge/AddRelationshipToDb.java       | 29 +++++++--------
 .../dbsync/merge/CreateTableToModel.java        |  2 +-
 .../cayenne/dbsync/merge/DropColumnToModel.java |  8 ++--
 .../dbsync/merge/DropRelationshipToDb.java      | 25 +++++--------
 .../dbsync/merge/DropRelationshipToModel.java   | 18 ++++-----
 .../cayenne/dbsync/merge/DropTableToDb.java     |  9 +++--
 .../cayenne/dbsync/merge/DropTableToModel.java  |  2 +
 .../cayenne/dbsync/merge/DummyReverseToken.java | 10 ++---
 .../cayenne/dbsync/merge/SetAllowNullToDb.java  |  7 ++--
 .../dbsync/merge/SetAllowNullToModel.java       |  2 +
 .../cayenne/dbsync/merge/SetColumnTypeToDb.java | 16 ++------
 .../dbsync/merge/SetColumnTypeToModel.java      | 13 ++-----
 .../cayenne/dbsync/merge/SetNotNullToDb.java    |  7 ++--
 .../cayenne/dbsync/merge/SetNotNullToModel.java |  4 +-
 .../cayenne/dbsync/merge/SetPrimaryKeyToDb.java | 11 +++---
 .../dbsync/merge/SetPrimaryKeyToModel.java      | 10 +++--
 .../dbsync/merge/SetValueForNullToDb.java       |  5 ++-
 19 files changed, 107 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AbstractToModelToken.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AbstractToModelToken.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AbstractToModelToken.java
index 0c4b22e..424c8dc 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AbstractToModelToken.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AbstractToModelToken.java
@@ -27,7 +27,6 @@ import org.apache.cayenne.map.ObjRelationship;
 /**
  * Common abstract superclass for all {@link MergerToken}s going from the database to the
  * model.
- * 
  */
 public abstract class AbstractToModelToken implements MergerToken {
 
@@ -37,15 +36,6 @@ public abstract class AbstractToModelToken implements MergerToken {
         this.tokenName = tokenName;
     }
 
-    @Override
-    public final String getTokenName() {
-        return tokenName;
-    }
-
-    public final MergeDirection getDirection() {
-        return MergeDirection.TO_MODEL;
-    }
-
     protected static void remove(ModelMergeDelegate mergerContext, DbRelationship rel, boolean
reverse) {
         if (rel == null) {
             return;
@@ -58,7 +48,7 @@ public abstract class AbstractToModelToken implements MergerToken {
         for (ObjEntity objEntity : dbEntity.mappedObjEntities()) {
             remove(mergerContext, objEntity.getRelationshipForDbRelationship(rel), true);
         }
-        
+
         rel.getSourceEntity().removeRelationship(rel.getName());
         mergerContext.dbRelationshipRemoved(rel);
     }
@@ -75,12 +65,22 @@ public abstract class AbstractToModelToken implements MergerToken {
     }
 
     @Override
+    public final String getTokenName() {
+        return tokenName;
+    }
+
+    @Override
+    public final MergeDirection getDirection() {
+        return MergeDirection.TO_MODEL;
+    }
+
+    @Override
     public String toString() {
         return getTokenName() + ' ' + getTokenValue() + ' ' + getDirection();
     }
-    
+
     abstract static class Entity extends AbstractToModelToken {
-        
+
         private final DbEntity entity;
 
         protected Entity(String tokenName, DbEntity entity) {
@@ -91,17 +91,17 @@ public abstract class AbstractToModelToken implements MergerToken {
         public DbEntity getEntity() {
             return entity;
         }
-        
+
         public String getTokenValue() {
             return getEntity().getName();
         }
-        
+
     }
-    
+
     abstract static class EntityAndColumn extends Entity {
-        
+
         private final DbAttribute column;
-        
+
         protected EntityAndColumn(String tokenName, DbEntity entity, DbAttribute column)
{
             super(tokenName, entity);
             this.column = column;
@@ -115,8 +115,7 @@ public abstract class AbstractToModelToken implements MergerToken {
         public String getTokenValue() {
             return getEntity().getName() + "." + getColumn().getName();
         }
-        
-    }
 
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddColumnToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddColumnToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddColumnToDb.java
index 977128c..2a87b98 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddColumnToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddColumnToDb.java
@@ -18,9 +18,6 @@
  */
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.QuotingStrategy;
@@ -28,6 +25,9 @@ import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.Collections;
+import java.util.List;
+
 public class AddColumnToDb extends AbstractToDbToken.EntityAndColumn {
 
     public AddColumnToDb(DbEntity entity, DbAttribute column) {
@@ -58,8 +58,8 @@ public class AddColumnToDb extends AbstractToDbToken.EntityAndColumn {
         return Collections.singletonList(sqlBuffer.toString());
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createDropColumnToModel(getEntity(), getColumn());
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddRelationshipToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddRelationshipToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddRelationshipToDb.java
index 5c851a6..150ac98 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddRelationshipToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/AddRelationshipToDb.java
@@ -18,22 +18,22 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.cayenne.access.DbGenerator;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
 
+import java.util.Collections;
+import java.util.List;
+
 public class AddRelationshipToDb extends AbstractToDbToken.Entity {
 
-    private DbRelationship rel;
+    private DbRelationship relationship;
 
-    public AddRelationshipToDb(DbEntity entity, DbRelationship rel) {
+    public AddRelationshipToDb(DbEntity entity, DbRelationship relationship) {
         super("Add foreign key", entity);
-        this.rel = rel;
+        this.relationship = relationship;
     }
 
     /**
@@ -44,7 +44,7 @@ public class AddRelationshipToDb extends AbstractToDbToken.Entity {
         // TODO: skip FK to a different DB
 
         if (this.shouldGenerateFkConstraint()) {
-            String fksql = adapter.createFkConstraint(rel);
+            String fksql = adapter.createFkConstraint(relationship);
             if (fksql != null) {
                 return Collections.singletonList(fksql);
             }
@@ -53,28 +53,25 @@ public class AddRelationshipToDb extends AbstractToDbToken.Entity {
     }
 
     public boolean shouldGenerateFkConstraint() {
-        return !rel.isToMany()
-                && rel.isToPK() // TODO it is not necessary primary key it can be
unique index
-                && !rel.isToDependentPK();
+        return !relationship.isToMany()
+                && relationship.isToPK() // TODO it is not necessary primary key
it can be unique index
+                && !relationship.isToDependentPK();
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
-        return factory.createDropRelationshipToModel(getEntity(), rel);
+        return factory.createDropRelationshipToModel(getEntity(), relationship);
     }
 
     @Override
     public String getTokenValue() {
         if (this.shouldGenerateFkConstraint()) {
-            return rel.getSourceEntity().getName() + "->" + rel.getTargetEntityName();
+            return relationship.getSourceEntity().getName() + "->" + relationship.getTargetEntityName();
         } else {
             return "Skip. No sql representation.";
         }
     }
     
-    public DbRelationship getRelationship() {
-        return rel;
-    }
-    
     @Override
     public int compareTo(MergerToken o) {
         // add all AddRelationshipToDb to the end.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/CreateTableToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/CreateTableToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/CreateTableToModel.java
index 98a8f3a..a8483b9 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/CreateTableToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/CreateTableToModel.java
@@ -36,7 +36,7 @@ public class CreateTableToModel extends AbstractToModelToken.Entity {
      * special class name.
      * Setting this to <code>null</code>, because by default class name should
be generated
      */
-    private String objEntityClassName = null; //CayenneDataObject.class.getName();
+    private String objEntityClassName;
 
     public CreateTableToModel(DbEntity entity) {
         super("Create Table", entity);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropColumnToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropColumnToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropColumnToModel.java
index 70d1b1c..e92df93 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropColumnToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropColumnToModel.java
@@ -18,9 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -29,6 +26,9 @@ import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * A {@link MergerToken} to remove a {@link DbAttribute} from a {@link DbEntity}.
  * 
@@ -39,10 +39,12 @@ public class DropColumnToModel extends AbstractToModelToken.EntityAndColumn
{
         super("Drop Column", entity, column);
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createAddColumnToDb(getEntity(), getColumn());
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
 
         // remove relationships mapped to column. duplicate List to prevent

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToDb.java
index 238a44a..3c7dd82 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToDb.java
@@ -18,9 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
@@ -28,18 +25,21 @@ import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.DbRelationshipDetected;
 
+import java.util.Collections;
+import java.util.List;
+
 public class DropRelationshipToDb extends AbstractToDbToken.Entity {
 
-    private DbRelationship rel;
+    private DbRelationship relationship;
 
-    public DropRelationshipToDb(DbEntity entity, DbRelationship rel) {
+    public DropRelationshipToDb(DbEntity entity, DbRelationship relationship) {
         super("Drop foreign key", entity);
-        this.rel = rel;
+        this.relationship = relationship;
     }
     
     public String getFkName() {
-        if (rel instanceof DbRelationshipDetected) {
-            return ((DbRelationshipDetected) rel).getFkName();
+        if (relationship instanceof DbRelationshipDetected) {
+            return ((DbRelationshipDetected) relationship).getFkName();
         }
         return null;
     }
@@ -57,16 +57,11 @@ public class DropRelationshipToDb extends AbstractToDbToken.Entity {
     }
 
     public MergerToken createReverse(MergerTokenFactory factory) {
-        return factory.createAddRelationshipToModel(getEntity(), rel);
+        return factory.createAddRelationshipToModel(getEntity(), relationship);
     }
 
     @Override
     public String getTokenValue() {
-        return rel.getSourceEntity().getName() + "->" + rel.getTargetEntityName();
-    }
-    
-    public DbRelationship getRelationship() {
-        return rel;
+        return relationship.getSourceEntity().getName() + "->" + relationship.getTargetEntityName();
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToModel.java
index 082c33a..3908dbd 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropRelationshipToModel.java
@@ -24,28 +24,26 @@ import org.apache.cayenne.map.DbRelationship;
 
 public class DropRelationshipToModel extends AbstractToModelToken.Entity {
 
-    private final DbRelationship rel;
+    private final DbRelationship relationship;
 
-    public DropRelationshipToModel(DbEntity entity, DbRelationship rel) {
+    public DropRelationshipToModel(DbEntity entity, DbRelationship relationship) {
         super("Drop db-relationship ", entity);
-        this.rel = rel;
+        this.relationship = relationship;
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
-        return factory.createAddRelationshipToDb(getEntity(), rel);
+        return factory.createAddRelationshipToDb(getEntity(), relationship);
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
-        remove(mergerContext.getDelegate(), rel, true);
+        remove(mergerContext.getDelegate(), relationship, true);
     }
 
     @Override
     public String getTokenValue() {
-        return AddRelationshipToModel.getTokenValue(rel);
-    }
-    
-    public DbRelationship getRelationship() {
-        return rel;
+        return AddRelationshipToModel.getTokenValue(relationship);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToDb.java
index 6b76646..3f416c7 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToDb.java
@@ -18,13 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class DropTableToDb extends AbstractToDbToken.Entity {
 
     public DropTableToDb(DbEntity entity) {
@@ -33,7 +33,7 @@ public class DropTableToDb extends AbstractToDbToken.Entity {
 
     @Override
     public List<String> createSql(DbAdapter adapter) {
-        List<String> sqls = new ArrayList<String>();
+        List<String> sqls = new ArrayList<>();
         // TODO: fix. some adapters drop the complete AUTO_PK_SUPPORT here
         /*
         sqls.addAll(adapter.getPkGenerator().dropAutoPkStatements(
@@ -43,6 +43,7 @@ public class DropTableToDb extends AbstractToDbToken.Entity {
         return sqls;
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createCreateTableToModel(getEntity());
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToModel.java
index 3bdd8f3..b6eabee 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DropTableToModel.java
@@ -34,10 +34,12 @@ public class DropTableToModel extends AbstractToModelToken.Entity {
         super("Drop Table", entity);
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createCreateTableToDb(getEntity());
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
         for (ObjEntity objEntity : getEntity().mappedObjEntities()) {
             objEntity.getDataMap().removeObjEntity(objEntity.getName(), true);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DummyReverseToken.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DummyReverseToken.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DummyReverseToken.java
index 54b779b..3f9b35c 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DummyReverseToken.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DummyReverseToken.java
@@ -33,28 +33,28 @@ class DummyReverseToken implements MergerToken {
         this.reverse = reverse;
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return reverse;
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
         // can not execute
     }
 
+    @Override
     public MergeDirection getDirection() {
         return reverse.getDirection().reverseDirection();
     }
 
+    @Override
     public String getTokenName() {
         return "Can not execute the reverse of " + reverse.getTokenName();
     }
 
+    @Override
     public String getTokenValue() {
         return reverse.getTokenValue();
     }
-
-    public boolean isReversible() {
-        return true;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToDb.java
index c69fb6f..68078c2 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToDb.java
@@ -18,15 +18,15 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.Collections;
+import java.util.List;
+
 /**
  * A {@link MergerToken} to add a "allow null" clause to a column.
  * 
@@ -50,6 +50,7 @@ public class SetAllowNullToDb extends AbstractToDbToken.EntityAndColumn
{
         return Collections.singletonList(sqlBuffer.toString());
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetNotNullToModel(getEntity(), getColumn());
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToModel.java
index 5d9c890..463f912 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetAllowNullToModel.java
@@ -32,10 +32,12 @@ public class SetAllowNullToModel extends AbstractToModelToken.EntityAndColumn
{
         super("Set Allow Null", entity, column);
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetNotNullToDb(getEntity(), getColumn());
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
         getColumn().setMandatory(false);
         mergerContext.getDelegate().dbAttributeModified(getColumn());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToDb.java
index 74a0034..2434dd1 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToDb.java
@@ -18,9 +18,6 @@
  */
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.QuotingStrategy;
@@ -29,6 +26,9 @@ import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.Collections;
+import java.util.List;
+
 /**
  * An {@link MergerToken} to use to set type, length and precision.
  */
@@ -104,16 +104,8 @@ public class SetColumnTypeToDb extends AbstractToDbToken.Entity {
         return sb.toString();
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetColumnTypeToModel(getEntity(), columnNew, columnOriginal);
     }
-
-    public DbAttribute getColumnOriginal() {
-        return columnOriginal;
-    }
-
-    public DbAttribute getColumnNew() {
-        return columnNew;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToModel.java
index cf2b1e0..a960467 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetColumnTypeToModel.java
@@ -34,17 +34,18 @@ public class SetColumnTypeToModel extends AbstractToModelToken.Entity
{
     private DbAttribute columnOriginal;
     private DbAttribute columnNew;
 
-    public SetColumnTypeToModel(DbEntity entity, DbAttribute columnOriginal,
-            DbAttribute columnNew) {
+    public SetColumnTypeToModel(DbEntity entity, DbAttribute columnOriginal, DbAttribute
columnNew) {
         super("Set Column Type", entity);
         this.columnOriginal = columnOriginal;
         this.columnNew = columnNew;
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetColumnTypeToDb(getEntity(), columnNew, columnOriginal);
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
         columnOriginal.setType(columnNew.getType());
         columnOriginal.setMaxLength(columnNew.getMaxLength());
@@ -91,12 +92,4 @@ public class SetColumnTypeToModel extends AbstractToModelToken.Entity {
         return sb.toString();
     }
     
-    public DbAttribute getColumnOriginal() {
-        return columnOriginal;
-    }
-
-    public DbAttribute getColumnNew() {
-        return columnNew;
-    }
-    
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToDb.java
index 169ea34..0591c2a 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToDb.java
@@ -18,15 +18,15 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.Collections;
+import java.util.List;
+
 /**
  * A {@link MergerToken} to add a "not null" clause to a column.
  */
@@ -44,6 +44,7 @@ public class SetNotNullToDb extends AbstractToDbToken.EntityAndColumn {
                 + " ALTER COLUMN " + context.quotedName(getColumn()) + " SET NOT NULL");
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetAllowNullToModel(getEntity(), getColumn());
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToModel.java
index 7402f57..dfc9b15 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetNotNullToModel.java
@@ -31,11 +31,13 @@ public class SetNotNullToModel extends AbstractToModelToken.EntityAndColumn
{
     public SetNotNullToModel(DbEntity entity, DbAttribute column) {
         super("Set Not Null", entity, column);
     }
-    
+
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetAllowNullToDb(getEntity(), getColumn());
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
         getColumn().setMandatory(true);
         mergerContext.getDelegate().dbAttributeModified(getColumn());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToDb.java
index 8161b87..077b6ef 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToDb.java
@@ -18,17 +18,17 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 public class SetPrimaryKeyToDb extends AbstractToDbToken.Entity {
 
     private Collection<DbAttribute> primaryKeyOriginal;
@@ -79,6 +79,7 @@ public class SetPrimaryKeyToDb extends AbstractToDbToken.Entity {
         sqls.add(sql.toString());
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetPrimaryKeyToModel(getEntity(), primaryKeyNew, primaryKeyOriginal,
                 detectedPrimaryKeyName);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToModel.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToModel.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToModel.java
index 198fe4f..a2198ba 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToModel.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetPrimaryKeyToModel.java
@@ -18,15 +18,15 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.event.AttributeEvent;
 
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
 public class SetPrimaryKeyToModel extends AbstractToModelToken.Entity {
 
     private Collection<DbAttribute> primaryKeyOriginal;
@@ -48,6 +48,7 @@ public class SetPrimaryKeyToModel extends AbstractToModelToken.Entity {
         }
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return factory.createSetPrimaryKeyToDb(
                 getEntity(),
@@ -56,6 +57,7 @@ public class SetPrimaryKeyToModel extends AbstractToModelToken.Entity {
                 detectedPrimaryKeyName);
     }
 
+    @Override
     public void execute(MergerContext mergerContext) {
         DbEntity e = getEntity();
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/49a6ca39/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetValueForNullToDb.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetValueForNullToDb.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetValueForNullToDb.java
index 1ffdd49..340f2bf 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetValueForNullToDb.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/SetValueForNullToDb.java
@@ -18,13 +18,13 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.merge;
 
-import java.util.List;
-
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dbsync.merge.factory.MergerTokenFactory;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
+import java.util.List;
+
 
 public class SetValueForNullToDb extends AbstractToDbToken.EntityAndColumn {
     
@@ -40,6 +40,7 @@ public class SetValueForNullToDb extends AbstractToDbToken.EntityAndColumn
{
         return valueForNullProvider.createSql(getEntity(), getColumn());
     }
 
+    @Override
     public MergerToken createReverse(MergerTokenFactory factory) {
         return new DummyReverseToken(this);
     }


Mime
View raw message