5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-03 22:20:52 +08:00

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

This commit is contained in:
Jarek Jarcec Cecho 2014-08-25 11:04:43 -07:00 committed by Abraham Elmahrek
parent bfb0f20694
commit af465a7b5f
5 changed files with 28 additions and 33 deletions

View File

@ -23,7 +23,7 @@
* 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;

View File

@ -23,7 +23,6 @@
*/
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 MConnection(MConnection other) {
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;
}

View File

@ -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 MJob(MJob other) {
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 String toString() {
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:

View File

@ -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);
}
/**
@ -42,6 +43,18 @@ public String getName() {
return name;
}
/**
* 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
*/

View File

@ -55,6 +55,12 @@ public MValidatedElement(String name) {
this.validationStatus = Status.getDefault();
}
public MValidatedElement(MValidatedElement other) {
super(other);
this.validationMessage = other.validationMessage;
this.validationStatus = other.validationStatus;
}
/**
* Set validation message and given severity.
*