public ExecutionPlanPartBean[] getExecutionPlanParts( ExecutionPlanBean executionPlanBean, User user) { ExecutionPlan executionPlan = PlanViewAdapter.getInstance().gwt2Hib(executionPlanBean); List<ExecutionPlanPart> parts = ExecutionPlanPartHelper.getInstance().findByPlan(executionPlan); List<ExecutionPlanPartBean> viewBeans = hib2Gwt(parts); ExecutionPlanPartBean[] array = viewBeans.toArray(new ExecutionPlanPartBean[] {}); // Arrays.sort(array); // assure parent node is in front return array; }
public ExecutionPlanPartBean getRootExecutionPlanPart( ExecutionPlanBean executionPlanBean, User user) { ExecutionPlan executionPlan = PlanViewAdapter.getInstance().gwt2Hib(executionPlanBean); ExecutionPlanPart executionPlanPart = ExecutionPlanPartHelper.getInstance().getRootPart(executionPlan); ExecutionPlanPartBean partBean = null; if (executionPlanPart != null) { partBean = this.hib2Gwt(executionPlanPart); } return partBean; }
/* * (non-Javadoc) * * @see org.talend.gwtadministrator.server.remoterepositorymgt.view.AbstractViewAdapter#hib2Gwt(java.lang.Object) */ @Override public ExecutionPlanPartBean hib2Gwt(ExecutionPlanPart hibPlanPart) { ExecutionPlanPartBean executionPlanPartBean = new ExecutionPlanPartBean(); executionPlanPartBean.setId(hibPlanPart.getId()); if (hibPlanPart.getTask() != null) { ExecutionTaskBean taskBean = ExecutionTaskViewAdapter.getInstance().hib2Gwt(hibPlanPart.getTask(), false); executionPlanPartBean.setTaskBean(taskBean); } ExecutionPlan executionPlan = hibPlanPart.getExecutionPlan(); ExecutionPlanBean planBean = PlanViewAdapter.getInstance().hib2Gwt(executionPlan); executionPlanPartBean.setPlanBean(planBean); executionPlanPartBean.setType(ActionType.get(hibPlanPart.getType())); executionPlanPartBean.setStatus(hibPlanPart.getStatus()); executionPlanPartBean.setStartDate(hibPlanPart.getStartDate()); executionPlanPartBean.setEndDate(hibPlanPart.getEndDate()); executionPlanPartBean.setUseParallel(hibPlanPart.isUseParallel()); executionPlanPartBean.setMaxThreads(hibPlanPart.getMaxThreads()); if (hibPlanPart.isUseParallel()) { List<ExecutionPlanPart> childrenParallelPartsFromDb = new ArrayList<ExecutionPlanPart>( ExecutionPlanPartHelper.getInstance() .getChildrenParts(hibPlanPart, ActionType.PARALLEL)); final List<ExecutionPlanPartBean> parallelParts = new ArrayList<ExecutionPlanPartBean>(); for (ExecutionPlanPart executionPlanPartDb : childrenParallelPartsFromDb) { parallelParts.add(hib2Gwt(executionPlanPartDb)); } executionPlanPartBean.setParallelParts(parallelParts); } PlanPartWrapper partWrapper = new PlanPartWrapper(hibPlanPart); TaskExecutionBasicStatus taskExecutionBasicStatus = partWrapper.getExecutionBasicStatus(); if (taskExecutionBasicStatus != null) { executionPlanPartBean.setTaskExecutionHistoryBasicStatus(taskExecutionBasicStatus.toString()); } return executionPlanPartBean; }