예제 #1
0
  /**
   * create a default group.
   *
   * @return {@link ConfigGroup} instance.
   */
  public static ConfigGroup newGroup() {
    ConfigGroup group = new ConfigGroup();
    group.setName(DEFAULT_GROUP);
    group.setMemo(DEFAULT_GROUP_MEMO);
    group.setDefaultType(true);
    group.setCreateTime(new Date());

    return group;
  }
  /**
   * 服务执行方法.
   *
   * @param reqParam request param
   * @return 返回结果对象
   */
  @Override
  protected DataResult doExecuteService(ReqParam reqParam) {
    DataResult result = new DataResult();

    Long versionId = reqParam.getVersionId();

    Long groupId = reqParam.getGroupId();
    if (groupId != null && groupId > 0L) {
      ConfigGroup configGroup = configGroupService.findById(groupId);
      result.setConfigGroup(configGroup);
      versionId = configGroup.getVersionId();
    }
    Version version = versionService.findById(versionId);
    Environment env = environmentService.findById(version.getEnvironmentId());
    Project project = projectService.findById(env.getProjectId());

    result.setProject(project);
    result.setEnv(env);
    result.setVersion(version);
    return result;
  }