You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2013/08/13 22:51:06 UTC
svn commit: r1513647 [1/3] - in /oozie/trunk: ./
core/src/main/java/org/apache/oozie/
core/src/main/java/org/apache/oozie/client/rest/
core/src/main/java/org/apache/oozie/command/coord/
core/src/main/java/org/apache/oozie/executor/jpa/ core/src/main/ja...
Author: virag
Date: Tue Aug 13 20:51:05 2013
New Revision: 1513647
URL: http://svn.apache.org/r1513647
Log:
OOZIE-1463 Remove discriminator column (virag)
Removed:
oozie/trunk/core/src/main/java/org/apache/oozie/client/rest/JsonBundleJob.java
oozie/trunk/core/src/main/java/org/apache/oozie/client/rest/JsonCoordinatorAction.java
oozie/trunk/core/src/main/java/org/apache/oozie/client/rest/JsonCoordinatorJob.java
oozie/trunk/core/src/main/java/org/apache/oozie/client/rest/JsonWorkflowAction.java
oozie/trunk/core/src/main/java/org/apache/oozie/client/rest/JsonWorkflowJob.java
Modified:
oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/LocalOozieClientCoord.java
oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowActionBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowJobBean.java
oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BulkJPAExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSubsetJPAExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetJPAExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowsJobGetJPAExecutor.java
oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java
oozie/trunk/core/src/main/java/org/apache/oozie/servlet/V1JobServlet.java
oozie/trunk/core/src/main/java/org/apache/oozie/store/StoreStatusFilter.java
oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java
oozie/trunk/core/src/main/java/org/apache/oozie/util/GraphGenerator.java
oozie/trunk/core/src/test/java/org/apache/oozie/TestCoordinatorJobBean.java
oozie/trunk/core/src/test/java/org/apache/oozie/client/rest/TestJsonCoordinatorAction.java
oozie/trunk/core/src/test/java/org/apache/oozie/client/rest/TestJsonCoordinatorJob.java
oozie/trunk/core/src/test/java/org/apache/oozie/client/rest/TestJsonWorkflowAction.java
oozie/trunk/core/src/test/java/org/apache/oozie/client/rest/TestJsonWorkflowJob.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestFutureActionsTimeOut.java
oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestPastActionsTimeOut.java
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsGetForPurgeJPAExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsToBeMaterializedJPAExecutor.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCoordMaterializeTriggerService.java
oozie/trunk/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java
oozie/trunk/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java
oozie/trunk/core/src/test/java/org/apache/oozie/servlet/MockDagEngineService.java
oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
oozie/trunk/core/src/test/java/org/apache/oozie/util/TestGraphGenerator.java
oozie/trunk/release-log.txt
oozie/trunk/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java?rev=1513647&r1=1513646&r2=1513647&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java Tue Aug 13 20:51:05 2013
@@ -25,8 +25,6 @@ import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
@@ -42,13 +40,12 @@ import org.json.simple.JSONObject;
@Entity
@Table(name = "BUNDLE_ACTIONS")
-@DiscriminatorColumn(name = "bean_type", discriminatorType = DiscriminatorType.STRING)
@NamedQueries( {
@NamedQuery(name = "DELETE_BUNDLE_ACTION", query = "delete from BundleActionBean w where w.bundleActionId = :bundleActionId"),
@NamedQuery(name = "GET_BUNDLE_ACTIONS_FOR_BUNDLE", query = "select OBJECT(w) from BundleActionBean w where w.bundleId = :bundleId"),
- @NamedQuery(name = "GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE", query = "select w.coordId, w.status, w.pending from BundleActionBean w where w.bundleId = :bundleId"),
+ @NamedQuery(name = "GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE", query = "select w.coordId, w.statusStr, w.pending from BundleActionBean w where w.bundleId = :bundleId"),
@NamedQuery(name = "GET_BUNDLE_ACTIONS", query = "select OBJECT(w) from BundleActionBean w"),
@@ -64,15 +61,15 @@ import org.json.simple.JSONObject;
@NamedQuery(name = "GET_BUNDLE_ACTIONS_PENDING_TRUE_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.pending > 0"),
- @NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_EQUAL_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.status <> :status"),
+ @NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_EQUAL_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.statusStr <> :status"),
- @NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_TERMINATE_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND (w.status = 'PREP' OR w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.status = 'SUSPENDED' OR w.status = 'SUSPENDEDWITHERROR' OR w.status = 'PREPSUSPENDED' OR w.status = 'PAUSED' OR w.status = 'PAUSEDWITHERROR' OR w.status = 'PREPPAUSED')"),
+ @NamedQuery(name = "GET_BUNDLE_ACTIONS_NOT_TERMINATE_STATUS_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.statusStr = 'SUSPENDED' OR w.statusStr = 'SUSPENDEDWITHERROR' OR w.statusStr = 'PREPSUSPENDED' OR w.statusStr = 'PAUSED' OR w.statusStr = 'PAUSEDWITHERROR' OR w.statusStr = 'PREPPAUSED')"),
- @NamedQuery(name = "GET_BUNDLE_ACTIONS_FAILED_NULL_COORD_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.status = 'FAILED' AND w.coordId IS NULL"),
+ @NamedQuery(name = "GET_BUNDLE_ACTIONS_FAILED_NULL_COORD_COUNT", query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.statusStr = 'FAILED' AND w.coordId IS NULL"),
@NamedQuery(name = "GET_BUNDLE_ACTIONS_OLDER_THAN", query = "select OBJECT(w) from BundleActionBean w order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "DELETE_COMPLETED_ACTIONS_FOR_BUNDLE", query = "delete from BundleActionBean a where a.bundleId = :bundleId and (a.status = 'SUCCEEDED' OR a.status = 'FAILED' OR a.status= 'KILLED' OR a.status = 'DONEWITHERROR')"),
+ @NamedQuery(name = "DELETE_COMPLETED_ACTIONS_FOR_BUNDLE", query = "delete from BundleActionBean a where a.bundleId = :bundleId and (a.statusStr = 'SUCCEEDED' OR a.statusStr = 'FAILED' OR a.statusStr= 'KILLED' OR a.statusStr = 'DONEWITHERROR')"),
@NamedQuery(name = "DELETE_ACTIONS_FOR_BUNDLE", query = "delete from BundleActionBean a where a.bundleId = :bundleId")})
public class BundleActionBean implements Writable, JsonBean {
@@ -93,7 +90,7 @@ public class BundleActionBean implements
@Basic
@Column(name = "status")
- private String status = null;
+ private String statusStr = null;
@Basic
@Column(name = "critical")
@@ -185,7 +182,7 @@ public class BundleActionBean implements
* @return status object
*/
public Status getStatus() {
- return Status.valueOf(this.status);
+ return Status.valueOf(this.statusStr);
}
/**
@@ -194,7 +191,16 @@ public class BundleActionBean implements
* @return status string
*/
public String getStatusStr() {
- return status;
+ return statusStr;
+ }
+
+ /**
+ * Set the Status of the Bundle Action
+ *
+ * @return status string
+ */
+ public void setStatusStr(String statusStr) {
+ this.statusStr = statusStr;
}
/**
@@ -203,7 +209,7 @@ public class BundleActionBean implements
* @param val
*/
public void setStatus(Status val) {
- this.status = val.toString();
+ this.statusStr = val.toString();
}
/**
@@ -335,9 +341,6 @@ public class BundleActionBean implements
return lastModifiedTimestamp;
}
- /* (non-Javadoc)
- * @see org.apache.hadoop.io.Writable#write(java.io.DataOutput)
- */
@Override
public void write(DataOutput dataOutput) throws IOException {
WritableUtils.writeStr(dataOutput, getBundleActionId());
@@ -350,9 +353,6 @@ public class BundleActionBean implements
dataOutput.writeLong((getLastModifiedTimestamp() != null) ? getLastModifiedTimestamp().getTime() : -1);
}
- /* (non-Javadoc)
- * @see org.apache.hadoop.io.Writable#readFields(java.io.DataInput)
- */
@Override
public void readFields(DataInput dataInput) throws IOException {
setBundleActionId(WritableUtils.readStr(dataInput));
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java?rev=1513647&r1=1513646&r2=1513647&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java Tue Aug 13 20:51:05 2013
@@ -21,28 +21,41 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.sql.Timestamp;
+import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Transient;
import org.apache.hadoop.io.Writable;
import org.apache.oozie.client.BundleJob;
+import org.apache.oozie.client.CoordinatorJob;
import org.apache.oozie.client.Job;
-import org.apache.oozie.client.rest.JsonBundleJob;
+import org.apache.oozie.client.BundleJob.Timeunit;
+import org.apache.oozie.client.Job.Status;
+import org.apache.oozie.client.rest.JsonBean;
+import org.apache.oozie.client.rest.JsonTags;
+import org.apache.oozie.client.rest.JsonUtils;
import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.WritableUtils;
import org.apache.openjpa.persistence.jdbc.Index;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
@Entity
@NamedQueries( {
- @NamedQuery(name = "UPDATE_BUNDLE_JOB", query = "update BundleJobBean w set w.appName = :appName, w.appPath = :appPath, w.conf = :conf, w.externalId = :externalId, w.timeOut = :timeOut, w.createdTimestamp = :createdTimestamp, w.endTimestamp = :endTimestamp, w.jobXml = :jobXml, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.origJobXml = :origJobXml, w.startTimestamp = :startTimestamp, w.status = :status, w.timeUnitStr = :timeUnit, w.pending = :pending where w.id = :id"),
+ @NamedQuery(name = "UPDATE_BUNDLE_JOB", query = "update BundleJobBean w set w.appName = :appName, w.appPath = :appPath, w.conf = :conf, w.externalId = :externalId, w.timeOut = :timeOut, w.createdTimestamp = :createdTimestamp, w.endTimestamp = :endTimestamp, w.jobXml = :jobXml, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.origJobXml = :origJobXml, w.startTimestamp = :startTimestamp, w.statusStr = :status, w.timeUnitStr = :timeUnit, w.pending = :pending where w.id = :id"),
- @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS", query = "update BundleJobBean w set w.status = :status, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.pending = :pending where w.id = :id"),
+ @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS", query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.pending = :pending where w.id = :id"),
@NamedQuery(name = "DELETE_BUNDLE_JOB", query = "delete from BundleJobBean w where w.id = :id"),
@@ -52,39 +65,74 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_BUNDLE_JOBS_COUNT", query = "select count(w) from BundleJobBean w"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_COLUMNS", query = "select w.id, w.appName, w.appPath, w.conf, w.status, w.kickoffTimestamp, w.startTimestamp, w.endTimestamp, w.pauseTimestamp, w.createdTimestamp, w.user, w.group, w.timeUnitStr, w.timeOut from BundleJobBean w order by w.createdTimestamp desc"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_COLUMNS", query = "select w.id, w.appName, w.appPath, w.conf, w.statusStr, w.kickoffTimestamp, w.startTimestamp, w.endTimestamp, w.pauseTimestamp, w.createdTimestamp, w.user, w.group, w.timeUnitStr, w.timeOut from BundleJobBean w order by w.createdTimestamp desc"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_RUNNING_OR_PENDING", query = "select OBJECT(w) from BundleJobBean w where w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.pending = 1 order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_RUNNING_OR_PENDING", query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.pending = 1 order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_NEED_START", query = "select OBJECT(w) from BundleJobBean w where w.status = 'PREP' AND (w.kickoffTimestamp IS NULL OR (w.kickoffTimestamp IS NOT NULL AND w.kickoffTimestamp <= :currentTime)) order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_NEED_START", query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'PREP' AND (w.kickoffTimestamp IS NULL OR (w.kickoffTimestamp IS NOT NULL AND w.kickoffTimestamp <= :currentTime)) order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_PAUSED", query = "select OBJECT(w) from BundleJobBean w where w.status = 'PAUSED' OR w.status = 'PAUSEDWITHERROR' OR w.status = 'PREPPAUSED' order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_PAUSED", query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'PAUSED' OR w.statusStr = 'PAUSEDWITHERROR' OR w.statusStr = 'PREPPAUSED' order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_UNPAUSED", query = "select OBJECT(w) from BundleJobBean w where w.status = 'RUNNING' OR w.status = 'RUNNINGWITHERROR' OR w.status = 'PREP' order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_UNPAUSED", query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.statusStr = 'PREP' order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN", query = "select OBJECT(w) from BundleJobBean w where w.startTimestamp <= :matTime AND (w.status = 'PREP' OR w.status = 'RUNNING' or w.status = 'RUNNINGWITHERROR') order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN", query = "select OBJECT(w) from BundleJobBean w where w.startTimestamp <= :matTime AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' or w.statusStr = 'RUNNINGWITHERROR') order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN_STATUS", query = "select OBJECT(w) from BundleJobBean w where w.status = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_BUNDLE_JOBS_OLDER_THAN_STATUS", query = "select OBJECT(w) from BundleJobBean w where w.statusStr = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "GET_COMPLETED_BUNDLE_JOBS_OLDER_THAN", query = "select w.id from BundleJobBean w where ( w.status = 'SUCCEEDED' OR w.status = 'FAILED' OR w.status = 'KILLED' OR w.status = 'DONEWITHERROR') AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
+ @NamedQuery(name = "GET_COMPLETED_BUNDLE_JOBS_OLDER_THAN", query = "select w.id from BundleJobBean w where ( w.statusStr = 'SUCCEEDED' OR w.statusStr = 'FAILED' OR w.statusStr = 'KILLED' OR w.statusStr = 'DONEWITHERROR') AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "BULK_MONITOR_BUNDLE_QUERY", query = "SELECT b.id, b.status, b.user FROM BundleJobBean b WHERE b.appName = :appName"),
+ @NamedQuery(name = "BULK_MONITOR_BUNDLE_QUERY", query = "SELECT b.id, b.statusStr, b.user FROM BundleJobBean b WHERE b.appName = :appName"),
// Join query
@NamedQuery(name = "BULK_MONITOR_ACTIONS_QUERY", query = "SELECT a.id, a.actionNumber, a.errorCode, a.errorMessage, a.externalId, " +
- "a.externalStatus, a.status, a.createdTimestamp, a.nominalTimestamp, a.missingDependencies, " +
- "c.id, c.appName, c.status FROM CoordinatorActionBean a, CoordinatorJobBean c " +
+ "a.externalStatus, a.statusStr, a.createdTimestamp, a.nominalTimestamp, a.missingDependencies, " +
+ "c.id, c.appName, c.statusStr FROM CoordinatorActionBean a, CoordinatorJobBean c " +
"WHERE a.jobId = c.id AND c.bundleId = :bundleId ORDER BY a.jobId, a.createdTimestamp"),
@NamedQuery(name = "BULK_MONITOR_COUNT_QUERY", query = "SELECT COUNT(a) FROM CoordinatorActionBean a, CoordinatorJobBean c"),
@NamedQuery(name = "GET_BUNDLE_JOB_FOR_USER", query = "select w.user from BundleJobBean w where w.id = :id") })
-public class BundleJobBean extends JsonBundleJob implements Writable {
+@Table(name = "BUNDLE_JOBS")
+public class BundleJobBean implements Writable, BundleJob, JsonBean {
+
+ @Id
+ private String id;
+
+ @Basic
+ @Column(name = "app_path")
+ private String appPath = null;
+
+ @Basic
+ @Column(name = "app_name")
+ private String appName = null;
+
+ @Basic
+ @Column(name = "external_id")
+ private String externalId = null;
+
+ @Column(name = "conf")
+ @Lob
+ private String conf = null;
+
+ @Basic
+ @Column(name = "time_out")
+ private int timeOut = 0;
+
+ @Basic
+ @Column(name = "user_name")
+ private String user = null;
+
+ @Basic
+ @Column(name = "group_name")
+ private String group = null;
+
+ @Transient
+ private String consoleUrl;
@Basic
@Index
@Column(name = "status")
- private String status = Job.Status.PREP.toString();
+ private String statusStr = Job.Status.PREP.toString();
@Basic
@Column(name = "kickoff_time")
@@ -133,6 +181,14 @@ public class BundleJobBean extends JsonB
@Lob
private String origJobXml = null;
+
+ @Transient
+ private List<CoordinatorJobBean> coordJobs;
+
+ public BundleJobBean() {
+ coordJobs = new ArrayList<CoordinatorJobBean>();
+ }
+
/**
* @return the kickoffTimestamp
*/
@@ -151,7 +207,6 @@ public class BundleJobBean extends JsonB
* @param kickoffTimestamp the kickoffTimestamp to set
*/
public void setKickoffTimestamp(java.sql.Timestamp kickoffTimestamp) {
- super.setKickoffTime(DateUtils.toDate(kickoffTimestamp));
this.kickoffTimestamp = kickoffTimestamp;
}
@@ -159,7 +214,6 @@ public class BundleJobBean extends JsonB
* @param startTimestamp the startTimestamp to set
*/
public void setStartTimestamp(java.sql.Timestamp startTimestamp) {
- super.setStartTime(DateUtils.toDate(startTimestamp));
this.startTimestamp = startTimestamp;
}
@@ -168,9 +222,7 @@ public class BundleJobBean extends JsonB
*
* @param startTime the startTime to set
*/
- @Override
public void setStartTime(Date startTime) {
- super.setStartTime(startTime);
this.startTimestamp = DateUtils.convertDateToTimestamp(startTime);
}
@@ -185,7 +237,6 @@ public class BundleJobBean extends JsonB
* @param endTimestamp the endTimestamp to set
*/
public void setEndTimestamp(java.sql.Timestamp endTimestamp) {
- super.setEndTime(DateUtils.toDate(endTimestamp));
this.endTimestamp = endTimestamp;
}
@@ -200,7 +251,6 @@ public class BundleJobBean extends JsonB
* @param pauseTimestamp the pauseTimestamp to set
*/
public void setPauseTimestamp(java.sql.Timestamp pauseTimestamp) {
- super.setPauseTime(DateUtils.toDate(pauseTimestamp));
this.pauseTimestamp = pauseTimestamp;
}
@@ -240,7 +290,6 @@ public class BundleJobBean extends JsonB
*/
@Override
public void setPending() {
- super.setPending();
this.pending = 1;
}
@@ -251,7 +300,6 @@ public class BundleJobBean extends JsonB
*/
@Override
public void resetPending() {
- super.resetPending();
this.pending = 0;
}
@@ -323,9 +371,7 @@ public class BundleJobBean extends JsonB
/**
* @param createTime the createdTime to set
*/
- @Override
public void setCreatedTime(Date createTime) {
- super.setCreatedTime(createTime);
this.createdTimestamp = DateUtils.convertDateToTimestamp(createTime);
}
@@ -345,9 +391,6 @@ public class BundleJobBean extends JsonB
return DateUtils.toDate(lastModifiedTimestamp);
}
- /* (non-Javadoc)
- * @see org.apache.hadoop.io.Writable#write(java.io.DataOutput)
- */
@Override
public void write(DataOutput dataOutput) throws IOException {
WritableUtils.writeStr(dataOutput, getAppPath());
@@ -365,9 +408,6 @@ public class BundleJobBean extends JsonB
dataOutput.writeInt(getTimeout());
}
- /* (non-Javadoc)
- * @see org.apache.hadoop.io.Writable#readFields(java.io.DataInput)
- */
@Override
public void readFields(DataInput dataInput) throws IOException {
@@ -396,103 +436,296 @@ public class BundleJobBean extends JsonB
setTimeOut(dataInput.readInt());
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#getStatus()
- */
- @Override
- public Status getStatus() {
- return Status.valueOf(this.status);
- }
-
- /**
- * @return status string
- */
- public String getStatusStr() {
- return status;
- }
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#getEndTime()
- */
- @Override
public Date getEndTime() {
return DateUtils.toDate(endTimestamp);
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#getKickoffTime()
- */
@Override
public Date getKickoffTime() {
return DateUtils.toDate(kickoffTimestamp);
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#getTimeUnit()
- */
@Override
public Timeunit getTimeUnit() {
return Timeunit.valueOf(this.timeUnitStr);
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#setEndTime(java.util.Date)
- */
- @Override
public void setEndTime(Date endTime) {
- super.setEndTime(endTime);
this.endTimestamp = DateUtils.convertDateToTimestamp(endTime);
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#setKickoffTime(java.util.Date)
- */
- @Override
public void setKickoffTime(Date kickoffTime) {
- super.setKickoffTime(kickoffTime);
this.kickoffTimestamp = DateUtils.convertDateToTimestamp(kickoffTime);
}
@Override
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#getPauseTime()
- */
public Date getPauseTime() {
return DateUtils.toDate(pauseTimestamp);
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#setPauseTime(java.util.Date)
- */
- @Override
public void setPauseTime(Date pauseTime) {
- super.setPauseTime(pauseTime);
this.pauseTimestamp = DateUtils.convertDateToTimestamp(pauseTime);
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#setStatus(org.apache.oozie.client.BundleJob.Status)
+ /**
+ * @param return the suspendTime
*/
+ public void setSuspendedTime(Date suspendTime) {
+ this.suspendedTimestamp = DateUtils.convertDateToTimestamp(suspendTime);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public JSONObject toJSONObject() {
+ return toJSONObject("GMT");
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public JSONObject toJSONObject(String timeZoneId) {
+ JSONObject json = new JSONObject();
+ json.put(JsonTags.BUNDLE_JOB_PATH, appPath);
+ json.put(JsonTags.BUNDLE_JOB_NAME, appName);
+ json.put(JsonTags.BUNDLE_JOB_ID, id);
+ json.put(JsonTags.BUNDLE_JOB_EXTERNAL_ID, externalId);
+ json.put(JsonTags.BUNDLE_JOB_CONF, conf);
+ json.put(JsonTags.BUNDLE_JOB_STATUS, getStatus().toString());
+ json.put(JsonTags.BUNDLE_JOB_TIMEUNIT, getTimeUnit().toString());
+ json.put(JsonTags.BUNDLE_JOB_TIMEOUT, timeOut);
+ json.put(JsonTags.BUNDLE_JOB_KICKOFF_TIME, JsonUtils.formatDateRfc822(getKickoffTime(), timeZoneId));
+ json.put(JsonTags.BUNDLE_JOB_START_TIME, JsonUtils.formatDateRfc822(getStartTime(), timeZoneId));
+ json.put(JsonTags.BUNDLE_JOB_END_TIME, JsonUtils.formatDateRfc822(getEndTime(), timeZoneId));
+ json.put(JsonTags.BUNDLE_JOB_PAUSE_TIME, JsonUtils.formatDateRfc822(getPauseTime(), timeZoneId));
+ json.put(JsonTags.BUNDLE_JOB_CREATED_TIME, JsonUtils.formatDateRfc822(getCreatedTime(), timeZoneId));
+ json.put(JsonTags.BUNDLE_JOB_USER, getUser());
+ json.put(JsonTags.BUNDLE_JOB_GROUP, getGroup());
+ json.put(JsonTags.BUNDLE_JOB_ACL, getAcl());
+ json.put(JsonTags.BUNDLE_JOB_CONSOLE_URL, getConsoleUrl());
+ json.put(JsonTags.BUNDLE_COORDINATOR_JOBS, CoordinatorJobBean.toJSONArray(coordJobs, timeZoneId));
+ json.put(JsonTags.TO_STRING, toString());
+
+ return json;
+ }
+
+ @Override
+ public String getAppName() {
+ return appName;
+ }
+
@Override
- public void setStatus(org.apache.oozie.client.BundleJob.Status val) {
- super.setStatus(val);
- this.status = val.toString();
+ public String getAppPath() {
+ return appPath;
}
- /* (non-Javadoc)
- * @see org.apache.oozie.client.rest.JsonBundleJob#setTimeUnit(org.apache.oozie.client.BundleJob.Timeunit)
+ @Override
+ public String getConf() {
+ return conf;
+ }
+
+ @Override
+ public String getConsoleUrl() {
+ return consoleUrl;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<CoordinatorJob> getCoordinators() {
+ return (List) coordJobs;
+ }
+
+ @Override
+ @Deprecated
+ public String getGroup() {
+ return group;
+ }
+
+ @Override
+ public String getAcl() {
+ return getGroup();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ public int getTimeout() {
+ return timeOut;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ * Set id
+ *
+ * @param id the id to set
*/
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Set bundlePath
+ *
+ * @param bundlePath the bundlePath to set
+ */
+ public void setAppPath(String bundlePath) {
+ this.appPath = bundlePath;
+ }
+
+ /**
+ * Set bundleName
+ *
+ * @param bundleName the bundleName to set
+ */
+ public void setAppName(String bundleName) {
+ this.appName = bundleName;
+ }
+
+ /**
+ * Return externalId
+ *
+ * @return externalId
+ */
+ public String getExternalId() {
+ return this.externalId;
+ }
+
+ /**
+ * Set externalId
+ *
+ * @param externalId the externalId to set
+ */
+ public void setExternalId(String externalId) {
+ this.externalId = externalId;
+ }
+
+ /**
+ * Set conf
+ *
+ * @param conf the conf to set
+ */
+ public void setConf(String conf) {
+ this.conf = conf;
+ }
+
+ /**
+ * Set status
+ *
+ * @param status the status to set
+ */
+ public void setStatus(Status status) {
+ this.statusStr = status.toString();
+ }
+
+
@Override
+ public Status getStatus() {
+ return Status.valueOf(this.statusStr);
+ }
+
+ /**
+ * Set status
+ *
+ * @param status the status to set
+ */
+ public void setStatus(String statusStr) {
+ this.statusStr = statusStr;
+ }
+
+
+ /**
+ * @return status string
+ */
+ public String getStatusStr() {
+ return statusStr;
+ }
+
+
+ /**
+ * Set timeUnit
+ *
+ * @param timeUnit the timeUnit to set
+ */
public void setTimeUnit(Timeunit timeUnit) {
- super.setTimeUnit(timeUnit);
this.timeUnitStr = timeUnit.toString();
}
/**
- * @param return the suspendTime
+ * Set timeOut
+ *
+ * @param timeOut the timeOut to set
*/
- public void setSuspendedTime(Date suspendTime) {
- this.suspendedTimestamp = DateUtils.convertDateToTimestamp(suspendTime);
+ public void setTimeOut(int timeOut) {
+ this.timeOut = timeOut;
+ }
+
+ /**
+ * Set user
+ *
+ * @param user the user to set
+ */
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ /**
+ * Set group
+ *
+ * @param group the group to set
+ */
+ public void setGroup(String group) {
+ this.group = group;
+ }
+
+ /**
+ * Set consoleUrl
+ *
+ * @param consoleUrl the consoleUrl to set
+ */
+ public void setConsoleUrl(String consoleUrl) {
+ this.consoleUrl = consoleUrl;
+ }
+
+ /**
+ * Set coordJobs
+ *
+ * @param coordJobs the coordJobs to set
+ */
+ public void setCoordJobs(List<CoordinatorJobBean> coordJobs) {
+ this.coordJobs = (coordJobs != null) ? coordJobs : new ArrayList<CoordinatorJobBean>();
+ }
+
+ /**
+ * Convert a Bundle job list into a JSONArray.
+ *
+ * @param application list.
+ * @param timeZoneId time zone to use for dates in the JSON array.
+ * @return the corresponding JSON array.
+ */
+ @SuppressWarnings("unchecked")
+ public static JSONArray toJSONArray(List<BundleJobBean> applications, String timeZoneId) {
+ JSONArray array = new JSONArray();
+ if (applications != null) {
+ for (BundleJobBean application : applications) {
+ array.add(application.toJSONObject(timeZoneId));
+ }
+ }
+ return array;
+ }
+
+
+ @Override
+ public String toString() {
+ return MessageFormat.format("Bundle id[{0}] status[{1}]", getId(), getStatus());
+ }
+
+ @Override
+ public Date getStartTime() {
+ return DateUtils.toDate(startTimestamp);
}
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java?rev=1513647&r1=1513646&r2=1513647&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java Tue Aug 13 20:51:05 2013
@@ -21,25 +21,33 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.sql.Timestamp;
+import java.text.MessageFormat;
import java.util.Date;
+import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.ColumnResult;
import javax.persistence.Entity;
+import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SqlResultSetMapping;
+import javax.persistence.Table;
import org.apache.hadoop.io.Writable;
import org.apache.oozie.client.CoordinatorAction;
-import org.apache.oozie.client.rest.JsonCoordinatorAction;
+import org.apache.oozie.client.rest.JsonBean;
+import org.apache.oozie.client.rest.JsonTags;
+import org.apache.oozie.client.rest.JsonUtils;
import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.WritableUtils;
import org.apache.openjpa.persistence.jdbc.Index;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
@SqlResultSetMapping(
name = "CoordActionJobIdLmt",
@@ -49,25 +57,25 @@ import org.apache.openjpa.persistence.jd
@Entity
@NamedQueries({
- @NamedQuery(name = "UPDATE_COORD_ACTION", query = "update CoordinatorActionBean w set w.actionNumber = :actionNumber, w.actionXml = :actionXml, w.consoleUrl = :consoleUrl, w.createdConf = :createdConf, w.errorCode = :errorCode, w.errorMessage = :errorMessage, w.externalStatus = :externalStatus, w.missingDependencies = :missingDependencies, w.runConf = :runConf, w.timeOut = :timeOut, w.trackerUri = :trackerUri, w.type = :type, w.createdTimestamp = :createdTime, w.externalId = :externalId, w.jobId = :jobId, w.lastModifiedTimestamp = :lastModifiedTime, w.nominalTimestamp = :nominalTime, w.slaXml = :slaXml, w.status = :status where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_ACTION", query = "update CoordinatorActionBean w set w.actionNumber = :actionNumber, w.actionXml = :actionXml, w.consoleUrl = :consoleUrl, w.createdConf = :createdConf, w.errorCode = :errorCode, w.errorMessage = :errorMessage, w.externalStatus = :externalStatus, w.missingDependencies = :missingDependencies, w.runConf = :runConf, w.timeOut = :timeOut, w.trackerUri = :trackerUri, w.type = :type, w.createdTimestamp = :createdTime, w.externalId = :externalId, w.jobId = :jobId, w.lastModifiedTimestamp = :lastModifiedTime, w.nominalTimestamp = :nominalTime, w.slaXml = :slaXml, w.statusStr = :status where w.id = :id"),
- @NamedQuery(name = "UPDATE_COORD_ACTION_MIN", query = "update CoordinatorActionBean w set w.actionXml = :actionXml, w.missingDependencies = :missingDependencies, w.lastModifiedTimestamp = :lastModifiedTime, w.status = :status where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_ACTION_MIN", query = "update CoordinatorActionBean w set w.actionXml = :actionXml, w.missingDependencies = :missingDependencies, w.lastModifiedTimestamp = :lastModifiedTime, w.statusStr = :status where w.id = :id"),
// Query to update the action status, pending status and last modified time stamp of a Coordinator action
- @NamedQuery(name = "UPDATE_COORD_ACTION_STATUS_PENDING_TIME", query = "update CoordinatorActionBean w set w.status =:status, w.pending =:pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_ACTION_STATUS_PENDING_TIME", query = "update CoordinatorActionBean w set w.statusStr =:status, w.pending =:pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
// Update query for InputCheck
- @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_INPUTCHECK", query = "update CoordinatorActionBean w set w.status = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.missingDependencies = :missingDependencies where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_INPUTCHECK", query = "update CoordinatorActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.missingDependencies = :missingDependencies where w.id = :id"),
// Update query for Push-based missing dependency check
- @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK", query = "update CoordinatorActionBean w set w.status = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.pushMissingDependencies = :pushMissingDependencies where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK", query = "update CoordinatorActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.pushMissingDependencies = :pushMissingDependencies where w.id = :id"),
// Update query for Start
- @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_START", query = "update CoordinatorActionBean w set w.status =:status, w.lastModifiedTimestamp = :lastModifiedTime, w.runConf = :runConf, w.externalId = :externalId, w.pending = :pending, w.errorCode = :errorCode, w.errorMessage = :errorMessage where w.id = :id"),
+ @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_START", query = "update CoordinatorActionBean w set w.statusStr =:status, w.lastModifiedTimestamp = :lastModifiedTime, w.runConf = :runConf, w.externalId = :externalId, w.pending = :pending, w.errorCode = :errorCode, w.errorMessage = :errorMessage where w.id = :id"),
@NamedQuery(name = "UPDATE_COORD_ACTION_FOR_MODIFIED_DATE", query = "update CoordinatorActionBean w set w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
- @NamedQuery(name = "DELETE_COMPLETED_ACTIONS_FOR_COORDINATOR", query = "delete from CoordinatorActionBean a where a.jobId = :jobId and (a.status = 'SUCCEEDED' OR a.status = 'FAILED' OR a.status= 'KILLED')"),
+ @NamedQuery(name = "DELETE_COMPLETED_ACTIONS_FOR_COORDINATOR", query = "delete from CoordinatorActionBean a where a.jobId = :jobId and (a.statusStr = 'SUCCEEDED' OR a.statusStr = 'FAILED' OR a.statusStr= 'KILLED')"),
@NamedQuery(name = "DELETE_ACTIONS_FOR_COORDINATOR", query = "delete from CoordinatorActionBean a where a.jobId = :jobId"),
- @NamedQuery(name = "DELETE_UNSCHEDULED_ACTION", query = "delete from CoordinatorActionBean a where a.id = :id and (a.status = 'WAITING' OR a.status = 'READY')"),
+ @NamedQuery(name = "DELETE_UNSCHEDULED_ACTION", query = "delete from CoordinatorActionBean a where a.id = :id and (a.statusStr = 'WAITING' OR a.statusStr = 'READY')"),
// Query used by XTestcase to setup tables
@NamedQuery(name = "GET_COORD_ACTIONS", query = "select OBJECT(w) from CoordinatorActionBean w"),
@@ -75,70 +83,70 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_COORD_ACTION", query = "select OBJECT(a) from CoordinatorActionBean a where a.id = :id"),
// Select query used by SLAService on restart
- @NamedQuery(name = "GET_COORD_ACTION_FOR_SLA", query = "select a.id, a.jobId, a.status, a.externalId, a.lastModifiedTimestamp from CoordinatorActionBean a where a.id = :id"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_SLA", query = "select a.id, a.jobId, a.statusStr, a.externalId, a.lastModifiedTimestamp from CoordinatorActionBean a where a.id = :id"),
// Select query used by ActionInfo command
- @NamedQuery(name = "GET_COORD_ACTION_FOR_INFO", query = "select a.id, a.jobId, a.actionNumber, a.consoleUrl, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.trackerUri, a.createdTimestamp, a.nominalTimestamp, a.status, a.lastModifiedTimestamp, a.missingDependencies, a.pushMissingDependencies from CoordinatorActionBean a where a.id = :id"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_INFO", query = "select a.id, a.jobId, a.actionNumber, a.consoleUrl, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.trackerUri, a.createdTimestamp, a.nominalTimestamp, a.statusStr, a.lastModifiedTimestamp, a.missingDependencies, a.pushMissingDependencies from CoordinatorActionBean a where a.id = :id"),
// Select Query used by Timeout command
- @NamedQuery(name = "GET_COORD_ACTION_FOR_TIMEOUT", query = "select a.id, a.jobId, a.status, a.runConf, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_TIMEOUT", query = "select a.id, a.jobId, a.statusStr, a.runConf, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
// Select query used by InputCheck command
- @NamedQuery(name = "GET_COORD_ACTION_FOR_INPUTCHECK", query = "select a.id, a.jobId, a.status, a.runConf, a.nominalTimestamp, a.createdTimestamp, a.actionXml, a.missingDependencies, a.pushMissingDependencies, a.timeOut from CoordinatorActionBean a where a.id = :id"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_INPUTCHECK", query = "select a.id, a.jobId, a.statusStr, a.runConf, a.nominalTimestamp, a.createdTimestamp, a.actionXml, a.missingDependencies, a.pushMissingDependencies, a.timeOut from CoordinatorActionBean a where a.id = :id"),
// Select query used by CoordActionUpdate command
- @NamedQuery(name = "GET_COORD_ACTION_FOR_EXTERNALID", query = "select a.id, a.jobId, a.status, a.pending, a.externalId, a.lastModifiedTimestamp, a.slaXml, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.externalId = :externalId"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_EXTERNALID", query = "select a.id, a.jobId, a.statusStr, a.pending, a.externalId, a.lastModifiedTimestamp, a.slaXml, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.externalId = :externalId"),
// Select query used by Check command
- @NamedQuery(name = "GET_COORD_ACTION_FOR_CHECK", query = "select a.id, a.jobId, a.status, a.pending, a.externalId, a.lastModifiedTimestamp, a.slaXml, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_CHECK", query = "select a.id, a.jobId, a.statusStr, a.pending, a.externalId, a.lastModifiedTimestamp, a.slaXml, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
// Select query used by Start command
- @NamedQuery(name = "GET_COORD_ACTION_FOR_START", query = "select a.id, a.jobId, a.status, a.pending, a.createdConf, a.slaXml, a.actionXml, a.externalId, a.errorMessage, a.errorCode, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
+ @NamedQuery(name = "GET_COORD_ACTION_FOR_START", query = "select a.id, a.jobId, a.statusStr, a.pending, a.createdConf, a.slaXml, a.actionXml, a.externalId, a.errorMessage, a.errorCode, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
- @NamedQuery(name = "GET_COORD_ACTIONS_FOR_JOB_FIFO", query = "select a.id, a.jobId, a.status, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND a.status = 'READY' order by a.nominalTimestamp"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_FOR_JOB_FIFO", query = "select a.id, a.jobId, a.statusStr, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'READY' order by a.nominalTimestamp"),
- @NamedQuery(name = "GET_COORD_ACTIONS_FOR_JOB_LIFO", query = "select a.id, a.jobId, a.status, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND a.status = 'READY' order by a.nominalTimestamp desc"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_FOR_JOB_LIFO", query = "select a.id, a.jobId, a.statusStr, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'READY' order by a.nominalTimestamp desc"),
- @NamedQuery(name = "GET_COORD_RUNNING_ACTIONS_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND (a.status = 'RUNNING' OR a.status='SUBMITTED')"),
+ @NamedQuery(name = "GET_COORD_RUNNING_ACTIONS_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'RUNNING' OR a.statusStr='SUBMITTED')"),
@NamedQuery(name = "GET_COORD_ACTIONS_COUNT_BY_JOBID", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId"),
- @NamedQuery(name = "GET_COORD_ACTIVE_ACTIONS_COUNT_BY_JOBID", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.status = 'WAITING'"),
+ @NamedQuery(name = "GET_COORD_ACTIVE_ACTIONS_COUNT_BY_JOBID", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'WAITING'"),
- @NamedQuery(name = "GET_COORD_ACTIONS_PENDING_FALSE_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0 AND (a.status = 'SUSPENDED' OR a.status = 'TIMEDOUT' OR a.status = 'SUCCEEDED' OR a.status = 'KILLED' OR a.status = 'FAILED')"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_PENDING_FALSE_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0 AND (a.statusStr = 'SUSPENDED' OR a.statusStr = 'TIMEDOUT' OR a.statusStr = 'SUCCEEDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'FAILED')"),
- @NamedQuery(name = "GET_COORD_ACTIONS_PENDING_FALSE_STATUS_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0 AND a.status = :status"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_PENDING_FALSE_STATUS_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0 AND a.statusStr = :status"),
@NamedQuery(name = "GET_ACTIONS_FOR_COORD_JOB", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId"),
// Query to retrieve Coordinator actions sorted by nominal time
- @NamedQuery(name = "GET_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME", query = "select a.id, a.actionNumber, a.consoleUrl, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.jobId, a.trackerUri, a.createdTimestamp, a.nominalTimestamp, a.status, a.lastModifiedTimestamp, a.missingDependencies, a.pushMissingDependencies, a.timeOut from CoordinatorActionBean a where a.jobId = :jobId order by a.nominalTimestamp"),
+ @NamedQuery(name = "GET_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME", query = "select a.id, a.actionNumber, a.consoleUrl, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.jobId, a.trackerUri, a.createdTimestamp, a.nominalTimestamp, a.statusStr, a.lastModifiedTimestamp, a.missingDependencies, a.pushMissingDependencies, a.timeOut from CoordinatorActionBean a where a.jobId = :jobId order by a.nominalTimestamp"),
// Query to maintain backward compatibility for coord job info command
@NamedQuery(name = "GET_ALL_COLS_FOR_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId order by a.nominalTimestamp"),
// Query to retrieve action id, action status, pending status and external Id of not completed Coordinator actions
- @NamedQuery(name = "GET_COORD_ACTIONS_NOT_COMPLETED", query = "select a.id, a.status, a.pending, a.externalId, a.pushMissingDependencies, a.nominalTimestamp, a.createdTimestamp, a.jobId from CoordinatorActionBean a where a.jobId = :jobId AND a.status <> 'FAILED' AND a.status <> 'TIMEDOUT' AND a.status <> 'SUCCEEDED' AND a.status <> 'KILLED'"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_NOT_COMPLETED", query = "select a.id, a.statusStr, a.pending, a.externalId, a.pushMissingDependencies, a.nominalTimestamp, a.createdTimestamp, a.jobId from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr <> 'FAILED' AND a.statusStr <> 'TIMEDOUT' AND a.statusStr <> 'SUCCEEDED' AND a.statusStr <> 'KILLED'"),
// Query to retrieve action id, action status, pending status and external Id of running Coordinator actions
- @NamedQuery(name = "GET_COORD_ACTIONS_RUNNING", query = "select a.id, a.status, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId and a.status = 'RUNNING'"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_RUNNING", query = "select a.id, a.statusStr, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId and a.statusStr = 'RUNNING'"),
// Query to retrieve action id, action status, pending status and external Id of suspended Coordinator actions
- @NamedQuery(name = "GET_COORD_ACTIONS_SUSPENDED", query = "select a.id, a.status, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId and a.status = 'SUSPENDED'"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_SUSPENDED", query = "select a.id, a.statusStr, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId and a.statusStr = 'SUSPENDED'"),
// Query to retrieve count of Coordinator actions which are pending
@NamedQuery(name = "GET_COORD_ACTIONS_PENDING_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending > 0"),
// Query to retrieve status of Coordinator actions
- @NamedQuery(name = "GET_COORD_ACTIONS_STATUS", query = "select a.status from CoordinatorActionBean a where a.jobId = :jobId"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_STATUS", query = "select a.statusStr from CoordinatorActionBean a where a.jobId = :jobId"),
@NamedQuery(name = "GET_COORD_ACTION_FOR_COORD_JOB_BY_ACTION_NUMBER", query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId AND a.actionNumber = :actionNumber"),
@NamedQuery(name = "GET_COORD_ACTIONS_BY_LAST_MODIFIED_TIME", query = "select a.jobId from CoordinatorActionBean a where a.lastModifiedTimestamp >= :lastModifiedTime"),
//Used by coordinator store only
- @NamedQuery(name = "GET_RUNNING_ACTIONS_FOR_COORD_JOB", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.status = 'RUNNING'"),
+ @NamedQuery(name = "GET_RUNNING_ACTIONS_FOR_COORD_JOB", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'RUNNING'"),
- @NamedQuery(name = "GET_RUNNING_ACTIONS_OLDER_THAN", query = "select a.id from CoordinatorActionBean a where a.status = 'RUNNING' AND a.lastModifiedTimestamp <= :lastModifiedTime"),
+ @NamedQuery(name = "GET_RUNNING_ACTIONS_OLDER_THAN", query = "select a.id from CoordinatorActionBean a where a.statusStr = 'RUNNING' AND a.lastModifiedTimestamp <= :lastModifiedTime"),
- @NamedQuery(name = "GET_COORD_ACTIONS_WAITING_SUBMITTED_OLDER_THAN", query = "select a.id, a.jobId, a.status, a.externalId, a.pushMissingDependencies from CoordinatorActionBean a where (a.status = 'WAITING' OR a.status = 'SUBMITTED') AND a.lastModifiedTimestamp <= :lastModifiedTime"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_WAITING_SUBMITTED_OLDER_THAN", query = "select a.id, a.jobId, a.statusStr, a.externalId, a.pushMissingDependencies from CoordinatorActionBean a where (a.statusStr = 'WAITING' OR a.statusStr = 'SUBMITTED') AND a.lastModifiedTimestamp <= :lastModifiedTime"),
- @NamedQuery(name = "GET_COORD_ACTIONS_FOR_RECOVERY_OLDER_THAN", query = "select a.id, a.jobId, a.status, a.externalId from CoordinatorActionBean a where a.pending > 0 AND (a.status = 'SUSPENDED' OR a.status = 'KILLED' OR a.status = 'RUNNING') AND a.lastModifiedTimestamp <= :lastModifiedTime"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_FOR_RECOVERY_OLDER_THAN", query = "select a.id, a.jobId, a.statusStr, a.externalId from CoordinatorActionBean a where a.pending > 0 AND (a.statusStr = 'SUSPENDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'RUNNING') AND a.lastModifiedTimestamp <= :lastModifiedTime"),
// Select query used by rerun, requires almost all columns so select * is used
- @NamedQuery(name = "GET_ACTIONS_FOR_DATES", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND (a.status = 'TIMEDOUT' OR a.status = 'SUCCEEDED' OR a.status = 'KILLED' OR a.status = 'FAILED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
+ @NamedQuery(name = "GET_ACTIONS_FOR_DATES", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'TIMEDOUT' OR a.statusStr = 'SUCCEEDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'FAILED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
// Select query used by log
- @NamedQuery(name = "GET_ACTION_IDS_FOR_DATES", query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId AND (a.status = 'TIMEDOUT' OR a.status = 'SUCCEEDED' OR a.status = 'KILLED' OR a.status = 'FAILED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
+ @NamedQuery(name = "GET_ACTION_IDS_FOR_DATES", query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'TIMEDOUT' OR a.statusStr = 'SUCCEEDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'FAILED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
// Select query used by rerun, requires almost all columns so select * is used
@NamedQuery(name = "GET_ACTION_FOR_NOMINALTIME", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.nominalTimestamp = :nominalTime"),
@@ -148,8 +156,13 @@ import org.apache.openjpa.persistence.jd
@NamedNativeQuery(name = "GET_READY_ACTIONS_GROUP_BY_JOBID", query = "select a.job_id as job_id, MIN(a.last_modified_time) as min_lmt from COORD_ACTIONS a where a.status = 'READY' GROUP BY a.job_id HAVING MIN(a.last_modified_time) < ?", resultSetMapping = "CoordActionJobIdLmt")
})
-public class CoordinatorActionBean extends JsonCoordinatorAction implements
- Writable {
+@Table(name = "COORD_ACTIONS")
+public class CoordinatorActionBean implements
+ Writable,CoordinatorAction,JsonBean {
+
+ @Id
+ private String id;
+
@Basic
@Index
@Column(name = "job_id")
@@ -158,7 +171,7 @@ public class CoordinatorActionBean exten
@Basic
@Index
@Column(name = "status")
- private String status = null;
+ private String statusStr = CoordinatorAction.Status.WAITING.toString();
@Basic
@Index
@@ -193,6 +206,63 @@ public class CoordinatorActionBean exten
@Column(name = "pending")
private int pending = 0;
+ @Basic
+ @Column(name = "job_type")
+ private String type;
+
+ @Basic
+ @Column(name = "action_number")
+ private int actionNumber;
+
+ @Column(name = "created_conf")
+ @Lob
+ private String createdConf;
+
+ @Basic
+ @Column(name = "time_out")
+ private int timeOut = 0;
+
+ @Column(name = "run_conf")
+ @Lob
+ private String runConf;
+
+ @Column(name = "action_xml")
+ @Lob
+ private String actionXml;
+
+ @Column(name = "missing_dependencies")
+ @Lob
+ private String missingDependencies;
+
+ @Column(name = "push_missing_dependencies")
+ @Lob
+ private String pushMissingDependencies;
+
+ @Basic
+ @Column(name = "external_status")
+ private String externalStatus;
+
+ @Basic
+ @Column(name = "tracker_uri")
+ private String trackerUri;
+
+ @Basic
+ @Column(name = "console_url")
+ private String consoleUrl;
+
+ @Basic
+ @Column(name = "error_code")
+ private String errorCode;
+
+ @Basic
+ @Column(name = "error_message")
+ private String errorMessage;
+
+ @SuppressWarnings("unchecked")
+ public JSONObject toJSONObject() {
+ return toJSONObject("GMT");
+ }
+
public CoordinatorActionBean() {
}
@@ -257,15 +327,13 @@ public class CoordinatorActionBean exten
return this.jobId;
}
- @Override
public void setJobId(String id) {
- super.setJobId(id);
this.jobId = id;
}
@Override
public Status getStatus() {
- return Status.valueOf(status);
+ return Status.valueOf(statusStr);
}
/**
@@ -273,38 +341,33 @@ public class CoordinatorActionBean exten
* @return
*/
public String getStatusStr() {
- return status;
+ return statusStr;
}
- @Override
public void setStatus(Status status) {
- super.setStatus(status);
- this.status = status.toString();
+ this.statusStr = status.toString();
+ }
+
+ public void setStatusStr(String statusStr) {
+ this.statusStr = statusStr;
}
- @Override
public void setCreatedTime(Date createdTime) {
this.createdTimestamp = DateUtils.convertDateToTimestamp(createdTime);
- super.setCreatedTime(createdTime);
}
public void setRerunTime(Date rerunTime) {
this.rerunTimestamp = DateUtils.convertDateToTimestamp(rerunTime);
}
- @Override
public void setNominalTime(Date nominalTime) {
this.nominalTimestamp = DateUtils.convertDateToTimestamp(nominalTime);
- super.setNominalTime(nominalTime);
}
- @Override
public void setLastModifiedTime(Date lastModifiedTime) {
this.lastModifiedTimestamp = DateUtils.convertDateToTimestamp(lastModifiedTime);
- super.setLastModifiedTime(lastModifiedTime);
}
- @Override
public Date getCreatedTime() {
return DateUtils.toDate(createdTimestamp);
}
@@ -344,9 +407,7 @@ public class CoordinatorActionBean exten
return externalId;
}
- @Override
public void setExternalId(String externalId) {
- super.setExternalId(externalId);
this.externalId = externalId;
}
@@ -440,4 +501,222 @@ public class CoordinatorActionBean exten
public boolean isPending() {
return pending > 0 ? true : false;
}
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void setActionNumber(int actionNumber) {
+ this.actionNumber = actionNumber;
+ }
+
+ @Override
+ public int getActionNumber() {
+ return actionNumber;
+ }
+
+ @Override
+ public String getCreatedConf() {
+ return createdConf;
+ }
+
+ public void setCreatedConf(String createdConf) {
+ this.createdConf = createdConf;
+ }
+
+
+ public void setRunConf(String runConf) {
+ this.runConf = runConf;
+ }
+
+ @Override
+ public String getRunConf() {
+ return runConf;
+ }
+
+ public void setMissingDependencies(String missingDependencies) {
+ this.missingDependencies = missingDependencies;
+ }
+
+ @Override
+ public String getMissingDependencies() {
+ return missingDependencies;
+ }
+
+ @Override
+ public String getPushMissingDependencies() {
+ return pushMissingDependencies;
+ }
+
+ public void setPushMissingDependencies(String pushMissingDependencies) {
+ this.pushMissingDependencies = pushMissingDependencies;
+ }
+
+ public String getExternalStatus() {
+ return externalStatus;
+ }
+
+ public void setExternalStatus(String externalStatus) {
+ this.externalStatus = externalStatus;
+ }
+
+ @Override
+ public String getTrackerUri() {
+ return trackerUri;
+ }
+
+ public void setTrackerUri(String trackerUri) {
+ this.trackerUri = trackerUri;
+ }
+
+ @Override
+ public String getConsoleUrl() {
+ return consoleUrl;
+ }
+
+ public void setConsoleUrl(String consoleUrl) {
+ this.consoleUrl = consoleUrl;
+ }
+
+ @Override
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ @Override
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorInfo(String errorCode, String errorMessage) {
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ }
+
+ public String getActionXml() {
+ return actionXml;
+ }
+
+ public void setActionXml(String actionXml) {
+ this.actionXml = actionXml;
+ }
+
+ @Override
+ public String toString() {
+ return MessageFormat.format("CoordinatorAction name[{0}] status[{1}]",
+ getId(), getStatus());
+ }
+
+ public int getTimeOut() {
+ return timeOut;
+ }
+
+ public void setTimeOut(int timeOut) {
+ this.timeOut = timeOut;
+ }
+
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ @SuppressWarnings("unchecked")
+ public JSONObject toJSONObject(String timeZoneId) {
+ JSONObject json = new JSONObject();
+ json.put(JsonTags.COORDINATOR_ACTION_ID, id);
+ json.put(JsonTags.COORDINATOR_JOB_ID, jobId);
+ json.put(JsonTags.COORDINATOR_ACTION_TYPE, type);
+ json.put(JsonTags.COORDINATOR_ACTION_NUMBER, actionNumber);
+ json.put(JsonTags.COORDINATOR_ACTION_CREATED_CONF, createdConf);
+ json.put(JsonTags.COORDINATOR_ACTION_CREATED_TIME, JsonUtils
+ .formatDateRfc822(getCreatedTime(), timeZoneId));
+ json.put(JsonTags.COORDINATOR_ACTION_NOMINAL_TIME, JsonUtils
+ .formatDateRfc822(getNominalTime(), timeZoneId));
+ json.put(JsonTags.COORDINATOR_ACTION_EXTERNALID, externalId);
+ // json.put(JsonTags.COORDINATOR_ACTION_START_TIME, JsonUtils
+ // .formatDateRfc822(startTime), timeZoneId);
+ json.put(JsonTags.COORDINATOR_ACTION_STATUS, statusStr);
+ json.put(JsonTags.COORDINATOR_ACTION_RUNTIME_CONF, runConf);
+ json.put(JsonTags.COORDINATOR_ACTION_LAST_MODIFIED_TIME, JsonUtils
+ .formatDateRfc822(getLastModifiedTime(), timeZoneId));
+ // json.put(JsonTags.COORDINATOR_ACTION_START_TIME, JsonUtils
+ // .formatDateRfc822(startTime), timeZoneId);
+ // json.put(JsonTags.COORDINATOR_ACTION_END_TIME, JsonUtils
+ // .formatDateRfc822(endTime), timeZoneId);
+ json.put(JsonTags.COORDINATOR_ACTION_MISSING_DEPS, missingDependencies);
+ json.put(JsonTags.COORDINATOR_ACTION_PUSH_MISSING_DEPS, pushMissingDependencies);
+ json.put(JsonTags.COORDINATOR_ACTION_EXTERNAL_STATUS, externalStatus);
+ json.put(JsonTags.COORDINATOR_ACTION_TRACKER_URI, trackerUri);
+ json.put(JsonTags.COORDINATOR_ACTION_CONSOLE_URL, consoleUrl);
+ json.put(JsonTags.COORDINATOR_ACTION_ERROR_CODE, errorCode);
+ json.put(JsonTags.COORDINATOR_ACTION_ERROR_MESSAGE, errorMessage);
+ json.put(JsonTags.TO_STRING, toString());
+ return json;
+ }
+
+ /**
+ * Convert a nodes list into a JSONArray.
+ *
+ * @param actions nodes list.
+ * @param timeZoneId time zone to use for dates in the JSON array.
+ * @return the corresponding JSON array.
+ */
+ @SuppressWarnings("unchecked")
+ public static JSONArray toJSONArray(List<CoordinatorActionBean> actions, String timeZoneId) {
+ JSONArray array = new JSONArray();
+ for (CoordinatorActionBean action : actions) {
+ array.add(action.toJSONObject(timeZoneId));
+ }
+ return array;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CoordinatorActionBean other = (CoordinatorActionBean) obj;
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ }
+ else if (!id.equals(other.id)) {
+ return false;
+ }
+ return true;
+ }
+
+
}