Esempio n. 1
0
  private void matchComponentsToBaselines(ClearTool ct, Stream stream, List<Baseline> latestBls)
      throws IOException, InterruptedException, ClearToolError {
    /* retrieval of the components attached to the stream */
    stream.setComponents(ct.getComponents(stream));

    for (Baseline bl : latestBls) {
      Component comp;

      /* get baselines dependencies to detect composite components */
      List<Baseline> dependentBls = ct.getDependingBaselines(bl);

      if (!dependentBls.isEmpty()) {
        comp = new CompositeComponent(ct.getComponentFromBL(bl));
      } else {
        comp = ct.getComponentFromBL(bl);
      }

      /* mark read only components */
      for (Component streamComp : stream.getComponents()) {
        if (streamComp.equals(comp)) {
          comp.setReadOnly(streamComp.isReadOnly());
          break;
        }
      }

      bl.setComponent(comp);
    }
  }
Esempio n. 2
0
  private void printUsedBaselines(ClearCaseLogger logger, List<Baseline> latestBls) {
    for (Baseline bl : latestBls) {
      String blString;

      if (bl.isCreated()) {
        blString = "* baseline: %s (created on component %s)";
      } else {
        blString = "  baseline: %s (component %s unmodified)";
      }

      logger.log(String.format(blString, bl.toString(), bl.getComponent().toString()));
    }
  }
Esempio n. 3
0
 private void markCreatedBaselines(List<Baseline> createdBls, List<Baseline> latestBls) {
   for (Baseline latestBl : latestBls) {
     for (Baseline createdBl : createdBls) {
       if (latestBl.getName().equals(createdBl.getName())) {
         latestBl.setCreated(true);
         /* we transfer the component & pvob information here so they can be used for
          * the promotion and recomendation of the created baselines later. */
         createdBl.setComponent(latestBl.getComponent());
         createdBl.setPvob(latestBl.getPvob());
         break;
       }
     }
   }
 }
Esempio n. 4
0
  /**
   * Publish the names of all the baselines created so that other plugins can use them.
   *
   * @param build the build where to publish the parameters
   */
  private void publishBaselinesAsParams(AbstractBuild<?, ?> build, List<Baseline> baselines) {
    if (baselines != null && !baselines.isEmpty()) {
      int i = 1;
      for (Baseline bl : baselines) {
        String paramKey = ENV_CC_BASELINE + i++;

        String description = "";
        if (bl.isCreated()) {
          description += "<b>CREATED</b> ";
        }
        description += "on component: " + bl.getComponent().toString();
        if (bl.getComponent().isComposite()) {
          description += " <i><b>(COMPOSITE)</b></i>";
        } else {
          if (bl.getComponent().isReadOnly()) {
            description += " <i><b>(READ ONLY)</b></i>";
          }
        }
        CCParametersAction.addBuildParameter(
            build, new StringParameterValue(paramKey, bl.toString(), description));
      }
    }
  }