cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [7/9] cayenne git commit: add toString for all maven options objects
Date Thu, 11 Dec 2014 10:49:52 GMT
add toString for all maven options objects


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

Branch: refs/heads/master
Commit: 233918a976524505eda5b6418e3bb2b6cd6aad72
Parents: dd6920c
Author: alexkolonitsky <Alex.Kolonitsky@gmail.com>
Authored: Wed Dec 10 20:20:12 2014 +0300
Committer: alexkolonitsky <Alex.Kolonitsky@gmail.com>
Committed: Wed Dec 10 20:20:12 2014 +0300

----------------------------------------------------------------------
 .../cayenne/tools/dbimport/config/Catalog.java  | 11 ++++++++
 .../tools/dbimport/config/FilterContainer.java  | 29 +++++++++++++++++++-
 .../dbimport/config/ReverseEngineering.java     | 17 ++++++++++++
 .../cayenne/tools/dbimport/config/Schema.java   | 12 ++++++++
 4 files changed, 68 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/233918a9/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
index 4423080..d025abe 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
@@ -95,4 +95,15 @@ public class Catalog extends FilterContainer {
         }
         return true;
     }
+
+    @Override
+    public String toString() {
+        return toString("    ");
+    }
+
+    @Override
+    public String toString(String indent) {
+        return indent + "Catalog '" + name + "': "
+             + super.toString(indent + "    ");
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/233918a9/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
index 259ba4c..b450138 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
@@ -26,7 +26,7 @@ import java.util.LinkedList;
 /**
  * @since 4.0.
  */
-public class FilterContainer {
+public abstract class FilterContainer {
 
     private Collection<IncludeTable> includeTables = new LinkedList<IncludeTable>();
     private Collection<ExcludeTable> excludeTables = new LinkedList<ExcludeTable>();
@@ -113,4 +113,31 @@ public class FilterContainer {
             && includeTables.isEmpty()     && excludeTables.isEmpty()
             && includeProcedures.isEmpty() && excludeProcedures.isEmpty();
     }
+
+    @Override
+    public String toString() {
+        return toString("    ");
+    }
+
+    public String toString(String indent) {
+        return toStringFilters(indent + "Filter Tables     - ", includeTables, excludeTables)
+             + toStringFilters(indent + "Filter Columns    - ", includeColumns, excludeColumns)
+             + toStringFilters(indent + "Filter Procedures - ", includeProcedures, excludeProcedures);
+
+    }
+
+    private String toStringFilters(String name, Collection<? extends PatternParam>
include, Collection<? extends PatternParam> exclude) {
+        if (include.isEmpty() && exclude.isEmpty()) {
+            return "";
+        }
+
+        String res = "\n" + name + ": ";
+        if (!include.isEmpty()) {
+            res += include + " ";
+        }
+        if (!exclude.isEmpty()) {
+            res += exclude + " ";
+        }
+        return res;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/233918a9/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
index 377e8ac..1d372f2 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
@@ -67,4 +67,21 @@ public class ReverseEngineering extends FilterContainer {
         this.catalogs.add(catalog);
     }
 
+    @Override
+    public String toString() {
+        StringBuilder res = new StringBuilder("    ReverseEngineering: ");
+        for (Catalog catalog : catalogs) {
+            res.append("\n").append(catalog.toString("        "));
+        }
+        for (Schema schema : schemas) {
+            res.append("\n").append(schema.toString("        "));
+        }
+
+        if (skipRelationshipsLoading != null && skipRelationshipsLoading) {
+            res.append("\n").append("        Skip Relationships Loading");
+        }
+        res.append(super.toString("    "));
+
+        return res.toString();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/233918a9/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Schema.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Schema.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Schema.java
index 79b1f57..dd71ea8 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Schema.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Schema.java
@@ -55,4 +55,16 @@ public class Schema extends FilterContainer {
 
         setName(name);
     }
+
+    @Override
+    public String toString() {
+        return toString("    ");
+    }
+
+    @Override
+    public String toString(String indent) {
+        return indent + "Schema '" + name + "': "
+                + super.toString(indent + "    ");
+    }
+
 }


Mime
View raw message