private void ajaxSetFlowLock(final Project project,
      final HashMap<String, Object> ret, final HttpServletRequest req)
      throws ServletException {
    final String flowName = getParam(req, FLOW_NAME_PARAM);
    final Flow flow = project.getFlow(flowName);
    if (flow == null) {
      ret.put(ERROR_PARAM,
          "Flow " + flowName + " not found in project " + project.getName());
      return;
    }

    boolean isLocked = Boolean.parseBoolean(getParam(req, FLOW_IS_LOCKED_PARAM));

    // if there is a change in the locked value, then check to see if the project has a flow trigger
    // that needs to be paused/resumed.
    if (isLocked != flow.isLocked()) {
      try {
        if (projectManager.hasFlowTrigger(project, flow)) {
          if (isLocked) {
            if (this.scheduler.pauseFlowTriggerIfPresent(project.getId(), flow.getId())) {
              logger.info("Flow trigger for flow " + project.getName() + "." + flow.getId() +
                      " is paused");
            } else {
              logger.warn("Flow trigger for flow " + project.getName() + "." + flow.getId() +
              " doesn't exist");
            }
          } else {
            if (this.scheduler.resumeFlowTriggerIfPresent(project.getId(), flow.getId())) {
              logger.info("Flow trigger for flow " + project.getName() + "." + flow.getId() +
                  " is resumed");
            } else {
              logger.warn("Flow trigger for flow " + project.getName() + "." + flow.getId() +
                  " doesn't exist");
            }
          }
        }
      } catch (Exception e) {
        ret.put(ERROR_PARAM, e);
      }
    }

    flow.setLocked(isLocked);
    ret.put(FLOW_IS_LOCKED_PARAM, flow.isLocked());
    ret.put(FLOW_ID_PARAM, flow.getId());
    this.projectManager.updateFlow(project, flow);
  }
private void ajaxSetFlowLock ( final Project project , final HashMap < String , Object > ret , final HttpServletRequest req ) throws ServletException { final String flowName = getParam ( req , FLOW_NAME_PARAM ) ; final Flow flow = project . getFlow ( flowName ) ; if ( flow == null ) { ret . put ( ERROR_PARAM , "Flow " + flowName + " not found in project " + project . getName ( ) ) ; return ; } boolean isLocked = Boolean . parseBoolean ( getParam ( req , FLOW_IS_LOCKED_PARAM ) ) ; if ( isLocked != flow . isLocked ( ) ) { try { if ( projectManager . hasFlowTrigger ( project , flow ) ) { if ( isLocked ) { if ( this . scheduler . pauseFlowTriggerIfPresent ( project . getId ( ) , flow . getId ( ) ) ) { logger . info ( "Flow trigger for flow " + project . getName ( ) + "." + flow . getId ( ) + " is paused" ) ; } else { logger . warn ( "Flow trigger for flow " + project . getName ( ) + "." + flow . getId ( ) + " doesn't exist" ) ; } } else { if ( this . scheduler . resumeFlowTriggerIfPresent ( project . getId ( ) , flow . getId ( ) ) ) { logger . info ( "Flow trigger for flow " + project . getName ( ) + "." + flow . getId ( ) + " is resumed" ) ; } else { logger . warn ( "Flow trigger for flow " + project . getName ( ) + "." + flow . getId ( ) + " doesn't exist" ) ; } } } } catch ( Exception e ) { ret . put ( ERROR_PARAM , e ) ; } } flow . setLocked ( isLocked ) ; ret . put ( FLOW_IS_LOCKED_PARAM , flow . isLocked ( ) ) ; ret . put ( FLOW_ID_PARAM , flow . getId ( ) ) ; this . projectManager . updateFlow ( project , flow ) ; }
Set if a flow is locked.

@param project the project for the flow.
@param ret the return value.
@param req the http request.
@throws ServletException