sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [01/50] [abbrv] git commit: SQOOP-1467: Sqoop2: Make MAccountableEntity inherit from MValidatedElement rather then MPersistableEntity
Date Fri, 10 Oct 2014 03:06:53 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 6a9c93d6e -> d7e049043


SQOOP-1467: Sqoop2: Make MAccountableEntity inherit from MValidatedElement rather then MPersistableEntity


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/58bb8dd0
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/58bb8dd0
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/58bb8dd0

Branch: refs/heads/sqoop2
Commit: 58bb8dd07a0288d30d20755df5ee69f7990a7061
Parents: 2873a4b
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Mon Aug 25 11:04:43 2014 -0700
Committer: Abraham Elmahrek <abraham@elmahrek.com>
Committed: Thu Oct 9 17:58:17 2014 -0700

----------------------------------------------------------------------
 .../apache/sqoop/model/MAccountableEntity.java  |  3 ++-
 .../org/apache/sqoop/model/MConnection.java     | 12 +---------
 .../main/java/org/apache/sqoop/model/MJob.java  | 15 ------------
 .../org/apache/sqoop/model/MNamedElement.java   | 25 +++++++++++++++-----
 .../apache/sqoop/model/MValidatedElement.java   |  6 +++++
 5 files changed, 28 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/58bb8dd0/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
index 781331b..094af39 100644
--- a/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
+++ b/common/src/main/java/org/apache/sqoop/model/MAccountableEntity.java
@@ -23,7 +23,7 @@ import java.util.Date;
  * Accountable entity provides additional fields that might help with identifying
  * what and when has happened.
  */
-abstract public class MAccountableEntity extends MPersistableEntity {
+abstract public class MAccountableEntity extends MValidatedElement {
 
   private final boolean DEFAULT_ENABLED = true;
 
@@ -59,6 +59,7 @@ abstract public class MAccountableEntity extends MPersistableEntity {
    * the accountable entity is enabled.
    */
   public MAccountableEntity() {
+    super((String)null);
     this.creationUser = null;
     this.creationDate = new Date();
     this.lastUpdateUser = this.creationUser;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/58bb8dd0/common/src/main/java/org/apache/sqoop/model/MConnection.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MConnection.java b/common/src/main/java/org/apache/sqoop/model/MConnection.java
index da9691f..e5a4fb8 100644
--- a/common/src/main/java/org/apache/sqoop/model/MConnection.java
+++ b/common/src/main/java/org/apache/sqoop/model/MConnection.java
@@ -23,7 +23,6 @@ package org.apache.sqoop.model;
  */
 public class MConnection extends MAccountableEntity implements MClonable {
   private long connectorId;
-  private String name;
 
   private final MConnectionForms connectorPart;
   private final MConnectionForms frameworkPart;
@@ -65,28 +64,19 @@ public class MConnection extends MAccountableEntity implements MClonable
{
   public MConnection(MConnection other, MConnectionForms connectorPart, MConnectionForms
frameworkPart) {
     super(other);
     this.connectorId = other.connectorId;
-    this.name = other.name;
     this.connectorPart = connectorPart;
     this.frameworkPart = frameworkPart;
   }
 
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder("connection: ").append(name);
+    StringBuilder sb = new StringBuilder("connection: ").append(getName());
     sb.append(" connector-part: ").append(connectorPart);
     sb.append(", framework-part: ").append(frameworkPart);
 
     return sb.toString();
   }
 
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
   public long getConnectorId() {
     return connectorId;
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/58bb8dd0/common/src/main/java/org/apache/sqoop/model/MJob.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MJob.java b/common/src/main/java/org/apache/sqoop/model/MJob.java
index 3835113..11839fc 100644
--- a/common/src/main/java/org/apache/sqoop/model/MJob.java
+++ b/common/src/main/java/org/apache/sqoop/model/MJob.java
@@ -42,11 +42,6 @@ public class MJob extends MAccountableEntity implements MClonable {
   private final long fromConnectionId;
   private final long toConnectionId;
 
-  /**
-   * User name for this object
-   */
-  private String name;
-
   private final MJobForms fromConnectorPart;
   private final MJobForms toConnectorPart;
   private final MJobForms frameworkPart;
@@ -104,8 +99,6 @@ public class MJob extends MAccountableEntity implements MClonable {
   public MJob(MJob other, MJobForms fromPart, MJobForms toPart, MJobForms frameworkPart)
{
     super(other);
 
-    this.name = other.name;
-
     this.fromConnectorId = other.getConnectorId(Direction.FROM);
     this.toConnectorId = other.getConnectorId(Direction.TO);
     this.fromConnectionId = other.getConnectionId(Direction.FROM);
@@ -125,14 +118,6 @@ public class MJob extends MAccountableEntity implements MClonable {
     return sb.toString();
   }
 
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
   public long getConnectionId(Direction type) {
     switch(type) {
       case FROM:

http://git-wip-us.apache.org/repos/asf/sqoop/blob/58bb8dd0/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MNamedElement.java b/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
index 42c9954..ddacfcd 100644
--- a/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
+++ b/common/src/main/java/org/apache/sqoop/model/MNamedElement.java
@@ -24,15 +24,16 @@ public abstract class MNamedElement extends MPersistableEntity {
   private static final String LABEL_KEY_SUFFIX = ".label";
   private static final String HELP_KEY_SUFFIX = ".help";
 
-  private final String name;
-  private final String labelKey;
-  private final String helpKey;
+  private String name;
+  private String labelKey;
+  private String helpKey;
 
   protected MNamedElement(String name) {
-    this.name = name;
+    setName(name);
+  }
 
-    labelKey = name + LABEL_KEY_SUFFIX;
-    helpKey = name + HELP_KEY_SUFFIX;
+  protected MNamedElement(MNamedElement other) {
+    this(other.name);
   }
 
   /**
@@ -43,6 +44,18 @@ public abstract class MNamedElement extends MPersistableEntity {
   }
 
   /**
+   * Set new name for this entity.
+   *
+   * @param name
+   */
+  public void setName(String name) {
+    this.name = name;
+
+    labelKey = name + LABEL_KEY_SUFFIX;
+    helpKey = name + HELP_KEY_SUFFIX;
+  }
+
+  /**
    * @return the label key to be used for this parameter
    */
   public String getLabelKey() {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/58bb8dd0/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java b/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
index 0eafad8..ab5473c 100644
--- a/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
+++ b/common/src/main/java/org/apache/sqoop/model/MValidatedElement.java
@@ -55,6 +55,12 @@ public abstract class MValidatedElement extends MNamedElement {
     this.validationStatus = Status.getDefault();
   }
 
+  public MValidatedElement(MValidatedElement other) {
+    super(other);
+    this.validationMessage = other.validationMessage;
+    this.validationStatus = other.validationStatus;
+  }
+
   /**
    * Set validation message and given severity.
    *


Mime
View raw message