Exemple #1
0
  /**
   * Cria build de modulos.
   *
   * @param data dados.
   * @param projectBuild projeto pai.
   */
  @SuppressWarnings("unchecked")
  private void createModulesBuild(final DynaBean data, final ProjectBuild projectBuild) {
    try {
      final List<DynaBean> modules = (List<DynaBean>) data.get(PARAM_MODULES);
      for (final DynaBean module : modules) {
        final String groupId = (String) module.get(PARAM_GROUP_ID);
        final String artifactId = (String) module.get(PARAM_ARTIFACT_ID);
        final String version = (String) module.get(PARAM_VERSION);
        final String projectName = (String) module.get(PARAM_PROJECT_NAME);

        final Project project = getProject(projectName, version, groupId, artifactId);

        final ModuleBuild moduleBuild = new ModuleBuild();
        moduleBuild.setProjectBuild(projectBuild);
        moduleBuild.setProject(project);

        // Parametros comuns
        setCommonParams(module, moduleBuild);

        // Adiciona modulo
        projectBuild.addModule(moduleBuild);
      }
      projectBuild.save();
    } catch (final MorphException e) {
      // Nao tem filhos, tudo bem
    }
  }
Exemple #2
0
  /**
   * Cria build de projeto pai com dados da requisicao.
   *
   * @param data dados.
   * @return build de projeto pai criado.
   */
  private ProjectBuild createProjectBuild(final DynaBean data) {
    // TODO (mmr) : trocar esse monte de binding com nome feio para um esquema de binding
    // automatico (colocar dominio em ponto comum entre Informer e Receiver)
    final DynaBean masterProject = (DynaBean) data.get(PARAM_MASTER_PROJECT);

    // Host
    final String hostName = (String) masterProject.get(PARAM_HOSTNAME);
    final String hostIp = (String) masterProject.get(PARAM_HOSTIP);
    final String operatingSystem = (String) masterProject.get(PARAM_OPERATING_SYSTEM);
    final String jvm = (String) masterProject.get(PARAM_JVM);
    final String encoding = (String) masterProject.get(PARAM_ENCODING);

    // User
    final String userName = (String) masterProject.get(PARAM_USERNAME);

    // Project
    final String projectName = (String) masterProject.get(PARAM_PROJECT_NAME);
    final String artifactId = (String) masterProject.get(PARAM_ARTIFACT_ID);
    final String groupId = (String) masterProject.get(PARAM_GROUP_ID);
    final String version = (String) masterProject.get(PARAM_VERSION);

    final ProjectBuild projectBuild = new ProjectBuild();

    final User user = getUser(userName);
    projectBuild.setUser(user);

    final Host host = getHost(hostName, hostIp, jvm, encoding, operatingSystem);
    projectBuild.setHost(host);

    final Project project = getProject(projectName, version, groupId, artifactId);
    projectBuild.setProject(project);

    // Parametros comuns
    setCommonParams(masterProject, projectBuild);

    // Save
    projectBuild.save();
    return projectBuild;
  }