Пример #1
0
  @SuppressWarnings("unchecked")
  private void handleAjaxUpdateRequest(HttpServletRequest req, Map<String, Object> respMap)
      throws ServletException, IOException {
    ArrayList<Object> updateTimesList =
        (ArrayList<Object>) JSONUtils.parseJSONFromString(getParam(req, UPDATE_TIME_LIST_PARAM));
    ArrayList<Object> execIDList =
        (ArrayList<Object>) JSONUtils.parseJSONFromString(getParam(req, EXEC_ID_LIST_PARAM));

    ArrayList<Object> updateList = new ArrayList<Object>();
    for (int i = 0; i < execIDList.size(); ++i) {
      long updateTime = JSONUtils.getLongFromObject(updateTimesList.get(i));
      int execId = (Integer) execIDList.get(i);

      ExecutableFlow flow = flowRunnerManager.getExecutableFlow(execId);
      if (flow == null) {
        Map<String, Object> errorResponse = new HashMap<String, Object>();
        errorResponse.put(RESPONSE_ERROR, "Flow does not exist");
        errorResponse.put(UPDATE_MAP_EXEC_ID, execId);
        updateList.add(errorResponse);
        continue;
      }

      if (flow.getUpdateTime() > updateTime) {
        updateList.add(flow.toUpdateObject(updateTime));
      }
    }

    respMap.put(RESPONSE_UPDATED_FLOWS, updateList);
  }
Пример #2
0
 private void handleAjaxFlowStatus(Map<String, Object> respMap, int execid) {
   ExecutableFlow flow = flowRunnerManager.getExecutableFlow(execid);
   if (flow == null) {
     respMap.put(STATUS_PARAM, RESPONSE_NOTFOUND);
   } else {
     respMap.put(STATUS_PARAM, flow.getStatus().toString());
     respMap.put(RESPONSE_UPDATETIME, flow.getUpdateTime());
   }
 }