Search in sources :

Example 1 with WorkflowIdGetForExternalIdJPAExecutor

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

the class ExternalIdXCommand method execute.

@Override
protected String execute() throws CommandException {
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        String wfId = null;
        if (jpaService != null) {
            wfId = jpaService.execute(new WorkflowIdGetForExternalIdJPAExecutor(externalId));
        } else {
            LOG.error(ErrorCode.E0610);
        }
        return wfId;
    } catch (XException ex) {
        throw new CommandException(ex);
    }
}
Also used : WorkflowIdGetForExternalIdJPAExecutor(org.apache.oozie.executor.jpa.WorkflowIdGetForExternalIdJPAExecutor) XException(org.apache.oozie.XException) CommandException(org.apache.oozie.command.CommandException) JPAService(org.apache.oozie.service.JPAService)

Example 2 with WorkflowIdGetForExternalIdJPAExecutor

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

the class TestWorkflowIdGetForExternalIdJPAExecutor method _testGetJobIdForExternalId.

private void _testGetJobIdForExternalId(String jobId) throws Exception {
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    WorkflowIdGetForExternalIdJPAExecutor wfIdGetCmd = new WorkflowIdGetForExternalIdJPAExecutor("external-id");
    String ret = jpaService.execute(wfIdGetCmd);
    assertNotNull(ret);
    assertEquals(jobId, ret);
}
Also used : WorkflowIdGetForExternalIdJPAExecutor(org.apache.oozie.executor.jpa.WorkflowIdGetForExternalIdJPAExecutor) JPAService(org.apache.oozie.service.JPAService)

Aggregations

WorkflowIdGetForExternalIdJPAExecutor (org.apache.oozie.executor.jpa.WorkflowIdGetForExternalIdJPAExecutor)2 JPAService (org.apache.oozie.service.JPAService)2 XException (org.apache.oozie.XException)1 CommandException (org.apache.oozie.command.CommandException)1