public void update(Action action) { setDescription(action.getDescription()); setName(action.getName()); setRequestType(action.getRequestType()); setRequestUrl(action.getRequestUrl()); setResponseTemplate(action.getResponseTemplate()); }
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; }
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); } }
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; }
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; }
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); } } }
private void updateActionCache(Action action) { action.setDisableCache(0); for (Parameter param : action.getResponseParameterList()) { clearParameterCache(param, action); } }
@Override public void loadParamIdListForAction(Action action) { List<String> paramIdList = new ArrayList<String>(); recursivelyLoadParamIdList(paramIdList, action.getResponseParameterList()); action.setRemarks(ArrayUtils.join(paramIdList, ",")); }