Search in sources :

Example 1 with CoordActionsCountForJobIdJPAExecutor

use of org.apache.oozie.executor.jpa.CoordActionsCountForJobIdJPAExecutor in project oozie by apache.

the class CoordJobXCommand method execute.

/* (non-Javadoc)
     * @see org.apache.oozie.command.XCommand#execute()
     */
@Override
protected CoordinatorJobBean execute() throws CommandException {
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        CoordinatorJobBean coordJob = null;
        if (jpaService != null) {
            coordJob = jpaService.execute(new CoordJobGetJPAExecutor(id));
            if (getActionInfo) {
                int numAction = jpaService.execute(new CoordActionsCountForJobIdJPAExecutor(id, filterMap));
                List<CoordinatorActionBean> coordActions = null;
                if (len == 0) {
                    coordActions = new ArrayList<CoordinatorActionBean>();
                } else {
                    coordActions = jpaService.execute(new CoordJobGetActionsSubsetJPAExecutor(id, filterMap, offset, len, desc));
                }
                coordJob.setActions(coordActions);
                coordJob.setNumActions(numAction);
            }
        } else {
            LOG.error(ErrorCode.E0610);
        }
        return coordJob;
    } catch (XException ex) {
        throw new CommandException(ex);
    }
}
Also used : CoordinatorJobBean(org.apache.oozie.CoordinatorJobBean) CoordActionsCountForJobIdJPAExecutor(org.apache.oozie.executor.jpa.CoordActionsCountForJobIdJPAExecutor) CoordJobGetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) XException(org.apache.oozie.XException) CoordJobGetActionsSubsetJPAExecutor(org.apache.oozie.executor.jpa.CoordJobGetActionsSubsetJPAExecutor) CommandException(org.apache.oozie.command.CommandException) JPAService(org.apache.oozie.service.JPAService)

Aggregations

CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)1 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)1 XException (org.apache.oozie.XException)1 CommandException (org.apache.oozie.command.CommandException)1 CoordActionsCountForJobIdJPAExecutor (org.apache.oozie.executor.jpa.CoordActionsCountForJobIdJPAExecutor)1 CoordJobGetActionsSubsetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetActionsSubsetJPAExecutor)1 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)1 JPAService (org.apache.oozie.service.JPAService)1