use of co.cask.cdap.proto.id.WorkflowId in project cdap by caskdata.
the class WorkflowHttpHandler method getScheduledRuntime.
private void getScheduledRuntime(HttpResponder responder, String namespaceId, String appName, String workflowName, boolean previousRuntimeRequested) throws SchedulerException, NotFoundException {
try {
ApplicationId appId = new ApplicationId(namespaceId, appName);
WorkflowId workflowId = new WorkflowId(appId, workflowName);
ApplicationSpecification appSpec = store.getApplication(appId);
if (appSpec == null) {
throw new ApplicationNotFoundException(appId);
}
if (appSpec.getWorkflows().get(workflowName) == null) {
throw new ProgramNotFoundException(workflowId);
}
List<ScheduledRuntime> runtimes;
if (previousRuntimeRequested) {
runtimes = scheduler.previousScheduledRuntime(workflowId, SchedulableProgramType.WORKFLOW);
} else {
runtimes = scheduler.nextScheduledRuntime(workflowId, SchedulableProgramType.WORKFLOW);
}
responder.sendJson(HttpResponseStatus.OK, runtimes);
} catch (SecurityException e) {
responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
}
}
Aggregations