use of org.apache.oozie.executor.jpa.SLAEventsGetForSeqIdJPAExecutor in project oozie by apache.
the class SLAStore method getSLAEventListNewerSeqLimited.
/**
* Get a list of SLA Events newer than a specific sequence with limit
* clause.
*
* @param seqId sequence id
* @return List of SLA Events
* @throws StoreException
*/
public List<SLAEventBean> getSLAEventListNewerSeqLimited(final long seqId, final int limitLen, long[] lastSeqId) throws StoreException {
ParamChecker.notNull(seqId, "SLAEventListNewerSeqLimited");
ParamChecker.checkGTZero(limitLen, "SLAEventListNewerSeqLimited");
lastSeqId[0] = seqId;
List<SLAEventBean> seBeans = (List<SLAEventBean>) doOperation("getSLAEventListNewerSeqLimited", new Callable<List<SLAEventBean>>() {
public List<SLAEventBean> call() throws StoreException, JPAExecutorException {
List<SLAEventBean> seBeans;
try {
JPAService jpaService = Services.get().get(JPAService.class);
List<SLAEventBean> slaEventList = null;
long[] lastSeqId = new long[1];
if (jpaService != null) {
seBeans = jpaService.execute(new SLAEventsGetForSeqIdJPAExecutor(seqId, limitLen, lastSeqId));
} else {
throw new StoreException(ErrorCode.E0610);
}
} catch (IllegalStateException e) {
throw new StoreException(ErrorCode.E0601, e.getMessage(), e);
} catch (JPAExecutorException e) {
throw new JPAExecutorException(ErrorCode.E0610, e.getMessage(), e);
}
return seBeans;
}
});
List<SLAEventBean> eventList = new ArrayList<SLAEventBean>();
for (SLAEventBean j : seBeans) {
lastSeqId[0] = Math.max(lastSeqId[0], j.getEvent_id());
eventList.add(j);
}
return eventList;
}
use of org.apache.oozie.executor.jpa.SLAEventsGetForSeqIdJPAExecutor in project oozie by apache.
the class TestCoordMaterializeTransitionXCommand method checkCoordAction.
private CoordinatorActionBean checkCoordAction(String actionId) throws JPAExecutorException {
long[] lastSeqId = new long[1];
JPAService jpaService = Services.get().get(JPAService.class);
List<SLAEventBean> slaEventList = jpaService.execute(new SLAEventsGetForSeqIdJPAExecutor(-1, 10, lastSeqId));
if (slaEventList.size() == 0) {
fail("Unable to GET any record of sequence id greater than 0");
}
CoordinatorActionBean actionBean;
actionBean = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
return actionBean;
}
Aggregations