Exemplo n.º 1
0
 public void update(Action action) {
   setDescription(action.getDescription());
   setName(action.getName());
   setRequestType(action.getRequestType());
   setRequestUrl(action.getRequestUrl());
   setResponseTemplate(action.getResponseTemplate());
 }
Exemplo n.º 2
0
 public Action findAction(long actionId) {
   for (Module module : getModuleList()) {
     for (Page page : module.getPageList()) {
       for (Action action : page.getActionList()) {
         if (action.getId() == actionId) return action;
       }
     }
   }
   return null;
 }
Exemplo n.º 3
0
 public void removeAction(int id, Session session) {
   Action action = findAction(id);
   if (action == null) return;
   Set<Page> pageList = action.getPageList();
   if (pageList == null) return;
   Iterator<Page> iterator = pageList.iterator();
   while (iterator.hasNext()) {
     iterator.next().getActionList().remove(action);
     session.delete(action);
   }
 }
Exemplo n.º 4
0
 public Parameter findParameter(int parameterId, boolean isRequestType) {
   for (Module module : getModuleList()) {
     for (Page page : module.getPageList()) {
       for (Action action : page.getActionList()) {
         for (Parameter parameter :
             (isRequestType
                 ? action.getRequestParameterList()
                 : action.getResponseParameterList())) {
           if (parameter.getId() == parameterId) {
             return parameter;
           }
         }
       }
     }
   }
   return null;
 }
Exemplo n.º 5
0
  public Parameter findChildParameter(int parameterId) {
    for (Module module : getModuleList()) {
      for (Page page : module.getPageList()) {
        for (Action action : page.getActionList()) {
          for (Parameter parameter : action.getRequestParameterList()) {
            Parameter pRecur = findParameterRecursively(parameter, parameterId);
            if (pRecur != null) {
              return pRecur;
            }
          }

          for (Parameter parameter : action.getResponseParameterList()) {
            Parameter pRecur = findParameterRecursively(parameter, parameterId);
            if (pRecur != null) {
              return pRecur;
            }
          }
        }
      }
    }
    return null;
  }
Exemplo n.º 6
0
 private void clearParameterCache(Parameter param, Action action) {
   String rules = param.getMockJsRules();
   if (rules != null && rules.contains("${") && rules.contains("}")) {
     action.setDisableCache(1);
     return; // over
   }
   Set<Parameter> children = param.getParameterList();
   if (children != null && children.size() != 0) {
     for (Parameter child : children) {
       clearParameterCache(child, action);
     }
   }
 }
Exemplo n.º 7
0
 private void updateActionCache(Action action) {
   action.setDisableCache(0);
   for (Parameter param : action.getResponseParameterList()) {
     clearParameterCache(param, action);
   }
 }
Exemplo n.º 8
0
 @Override
 public void loadParamIdListForAction(Action action) {
   List<String> paramIdList = new ArrayList<String>();
   recursivelyLoadParamIdList(paramIdList, action.getResponseParameterList());
   action.setRemarks(ArrayUtils.join(paramIdList, ","));
 }