use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class WorkflowsJobGetJPAExecutor method getBeanForWorkflowFromArray.
private WorkflowJobBean getBeanForWorkflowFromArray(Object[] arr) {
WorkflowJobBean wfBean = new WorkflowJobBean();
wfBean.setId((String) arr[0]);
if (arr[1] != null) {
wfBean.setAppName((String) arr[1]);
}
if (arr[2] != null) {
wfBean.setStatus(Status.valueOf((String) arr[2]));
}
if (arr[3] != null) {
wfBean.setRun((Integer) arr[3]);
}
if (arr[4] != null) {
wfBean.setUser((String) arr[4]);
}
if (arr[5] != null) {
wfBean.setGroup((String) arr[5]);
}
if (arr[6] != null) {
wfBean.setCreatedTime((Timestamp) arr[6]);
}
if (arr[7] != null) {
wfBean.setStartTime((Timestamp) arr[7]);
}
if (arr[8] != null) {
wfBean.setLastModifiedTime((Timestamp) arr[8]);
}
if (arr[9] != null) {
wfBean.setEndTime((Timestamp) arr[9]);
}
if (arr[10] != null) {
wfBean.setExternalId((String) arr[10]);
}
if (arr[11] != null) {
wfBean.setParentId((String) arr[11]);
}
return wfBean;
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class WorkflowStore method getWorkflowOnly.
private WorkflowJobBean getWorkflowOnly(final String id, boolean locking) throws SQLException, InterruptedException, StoreException {
WorkflowJobBean wfBean = null;
Query q = entityManager.createNamedQuery("GET_WORKFLOW");
/*
* if (locking) { // q.setHint("openjpa.FetchPlan.ReadLockMode","READ");
* OpenJPAQuery oq = OpenJPAPersistence.cast(q); FetchPlan fetch =
* oq.getFetchPlan(); fetch.setReadLockMode(LockModeType.WRITE);
* fetch.setLockTimeout(-1); // unlimited }
*/
q.setParameter("id", id);
List<WorkflowJobBean> w = q.getResultList();
if (w.size() > 0) {
wfBean = w.get(0);
}
return wfBean;
// return getBeanForRunningWorkflow(wfBean);
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class WorkflowStore method getWorkflowInfo.
/**
* Load the Workflow and all Action details and return a WorkflowJobBean. Workflow Instance is not loaded
*
* @param id Workflow Id
* @return Workflow Bean
* @throws StoreException If Workflow doesn't exist
*/
public WorkflowJobBean getWorkflowInfo(final String id) throws StoreException {
ParamChecker.notEmpty(id, "WorkflowID");
WorkflowJobBean wfBean = doOperation("getWorkflowInfo", new Callable<WorkflowJobBean>() {
public WorkflowJobBean call() throws SQLException, StoreException, InterruptedException {
WorkflowJobBean wfBean = null;
wfBean = getWorkflowforInfo(id, false);
if (wfBean == null) {
throw new StoreException(ErrorCode.E0604, id);
} else {
wfBean.setActions(getActionsForWorkflow(id, false));
}
return wfBean;
}
});
return wfBean;
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class WorkflowStore method getBeanForWorkflowFromArray.
private WorkflowJobBean getBeanForWorkflowFromArray(Object[] arr) {
WorkflowJobBean wfBean = new WorkflowJobBean();
wfBean.setId((String) arr[0]);
if (arr[1] != null) {
wfBean.setAppName((String) arr[1]);
}
if (arr[2] != null) {
wfBean.setStatus(Status.valueOf((String) arr[2]));
}
if (arr[3] != null) {
wfBean.setRun((Integer) arr[3]);
}
if (arr[4] != null) {
wfBean.setUser((String) arr[4]);
}
if (arr[5] != null) {
wfBean.setGroup((String) arr[5]);
}
if (arr[6] != null) {
wfBean.setCreatedTime((Timestamp) arr[6]);
}
if (arr[7] != null) {
wfBean.setStartTime((Timestamp) arr[7]);
}
if (arr[8] != null) {
wfBean.setLastModifiedTime((Timestamp) arr[8]);
}
if (arr[9] != null) {
wfBean.setEndTime((Timestamp) arr[9]);
}
return wfBean;
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class WorkflowStore method getWorkflow.
/**
* Load the Workflow into a Bean and return it. Also load the Workflow Instance into the bean. And lock the Workflow
* depending on the locking parameter.
*
* @param id Workflow ID
* @param locking true if Workflow is to be locked
* @return WorkflowJobBean
* @throws StoreException
*/
public WorkflowJobBean getWorkflow(final String id, final boolean locking) throws StoreException {
ParamChecker.notEmpty(id, "WorkflowID");
WorkflowJobBean wfBean = doOperation("getWorkflow", new Callable<WorkflowJobBean>() {
public WorkflowJobBean call() throws SQLException, StoreException, WorkflowException, InterruptedException {
WorkflowJobBean wfBean = null;
wfBean = getWorkflowOnly(id, locking);
if (wfBean == null) {
throw new StoreException(ErrorCode.E0604, id);
}
/*
* WorkflowInstance wfInstance; //krishna and next line
* wfInstance = workflowLib.get(id); wfInstance =
* wfBean.get(wfBean.getWfInstance());
* wfBean.setWorkflowInstance(wfInstance);
* wfBean.setWfInstance(wfInstance);
*/
return wfBean;
}
});
return wfBean;
}
Aggregations