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);
    }
  }
 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;
       }
     }
   }
 }