예제 #1
0
  public Map<String, Ida> genderHeadIdaAuto(String headId) {
    Map<String, Ida> result = new HashMap<String, Ida>();
    Ida rootIda = new Ida();
    rootIda.setHeadId(headId);
    rootIda.setParentId(null);
    rootIda.setStructName(Constants.ElementAttributes.ROOT_NAME);
    rootIda.setStructAlias(Constants.ElementAttributes.ROOT_ALIAS);
    rootIda.setXpath(Constants.ElementAttributes.ROOT_XPATH);
    rootIda.setState(Constants.IDA_STATE_COMMON);
    idaDAOImpl.save(rootIda);
    result.put(Constants.ElementAttributes.ROOT_NAME, rootIda);

    Ida reqIda = new Ida();
    reqIda.setHeadId(headId);
    reqIda.setParentId(rootIda.getId());
    reqIda.setStructName(Constants.ElementAttributes.REQUEST_NAME);
    reqIda.setStructAlias(Constants.ElementAttributes.REQUEST_ALIAS);
    reqIda.setXpath(Constants.ElementAttributes.REQUEST_XPATH);
    reqIda.setSeq(0);
    reqIda.setState(Constants.IDA_STATE_COMMON);
    idaDAOImpl.save(reqIda);
    result.put(Constants.ElementAttributes.REQUEST_NAME, reqIda);

    Ida resIda = new Ida();
    resIda.setHeadId(headId);
    resIda.setParentId(rootIda.getId());
    resIda.setSeq(1);
    resIda.setStructName(Constants.ElementAttributes.RESPONSE_NAME);
    resIda.setStructAlias(Constants.ElementAttributes.RESPONSE_ALIAS);
    resIda.setXpath(Constants.ElementAttributes.RESPONSE_XPATH);
    resIda.setState(Constants.IDA_STATE_COMMON);
    idaDAOImpl.save(resIda);
    result.put(Constants.ElementAttributes.RESPONSE_NAME, resIda);
    return result;
  }
예제 #2
0
  @Override
  public void saveOrUpdate(Ida[] idas) {
    boolean editFlag = true;
    for (Ida ida : idas) {
      if (StringUtils.isEmpty(ida.getHeadId())) {
        ida.setHeadId(null);
      }
      idaDAOImpl.save(ida);
      if (editFlag) {

        String interfaceId = ida.getInterfaceId();
        if (org.apache.commons.lang.StringUtils.isNotEmpty(interfaceId)) {
          Interface inter = interfaceDAO.findUniqueBy("interfaceId", interfaceId);
          // 更新版本,只更新一次
          versionServiceImpl.editVersion(inter.getVersionId());
          editFlag = false;
        }
      }
    }
  }