Esempio n. 1
0
 /**
  * getParentProcessing.
  *
  * @param processing a {@link net.sourceforge.seqware.common.model.Processing} object.
  * @param parentId a {@link java.lang.Integer} object.
  * @return a {@link net.sourceforge.seqware.common.model.Processing} object.
  */
 public static Processing getParentProcessing(Processing processing, Integer parentId) {
   Processing parentProcessing = null;
   Set<Processing> processings = processing.getParents();
   for (Processing p : processings) {
     if (parentId.equals(p.getProcessingId())) {
       parentProcessing = p;
     }
   }
   return parentProcessing;
 }
 /** {@inheritDoc} */
 @Override
 @SuppressWarnings("rawtypes")
 public ProcessingRelationship findByProcessings(
     Processing processingParent, Processing processingChild) {
   String query =
       "from ProcessingRelationship as pl where pl.processingByParentId.processingId = ? and pl.processingByChildId.processingId = ?";
   ProcessingRelationship obj = null;
   Object[] parameters = {processingParent.getProcessingId(), processingChild.getProcessingId()};
   List list = this.getHibernateTemplate().find(query, parameters);
   if (list.size() > 0) {
     obj = (ProcessingRelationship) list.get(0);
   }
   return obj;
 }
Esempio n. 3
0
 private static IUS getParentIUS(Processing processing, Integer parentId) {
   IUS parentIUS = null;
   Set<IUS> ius = processing.getIUS();
   for (IUS i : ius) {
     if (parentId.equals(i.getIusId())) {
       parentIUS = i;
     }
   }
   return parentIUS;
 }
Esempio n. 4
0
 private static SequencerRun getParentSequencerRun(Processing processing, Integer parentId) {
   SequencerRun parentSequencerRun = null;
   Set<SequencerRun> sequencerRuns = processing.getSequencerRuns();
   for (SequencerRun sr : sequencerRuns) {
     if (parentId.equals(sr.getSequencerRunId())) {
       parentSequencerRun = sr;
     }
   }
   return parentSequencerRun;
 }
Esempio n. 5
0
 /**
  * getParentLane.
  *
  * @param processing a {@link net.sourceforge.seqware.common.model.Processing} object.
  * @param parentId a {@link java.lang.Integer} object.
  * @return a {@link net.sourceforge.seqware.common.model.Lane} object.
  */
 public static Lane getParentLane(Processing processing, Integer parentId) {
   Lane parentLane = null;
   //	Log.info("	LANE PARENT ID = " + parentId);
   Set<Lane> lanes = processing.getLanes();
   for (Lane l : lanes) {
     if (parentId.equals(l.getLaneId())) {
       parentLane = l;
     }
   }
   return parentLane;
 }
Esempio n. 6
0
  /**
   * getAllHtml.
   *
   * @param processing a {@link net.sourceforge.seqware.common.model.Processing} object.
   * @param registration a {@link net.sourceforge.seqware.common.model.Registration} object.
   * @param openingNodeId a {@link java.lang.String} object.
   * @param currPosId a {@link java.lang.Integer} object.
   * @param listNodeId a {@link java.util.List} object.
   * @param isFirstCall a boolean.
   * @param isViewCurrentNode a boolean.
   * @param treeType a {@link java.lang.String} object.
   * @return a {@link java.lang.String} object.
   */
  public static String getAllHtml(
      Processing processing,
      Registration registration,
      String openingNodeId,
      Integer currPosId,
      List<String> listNodeId,
      boolean isFirstCall,
      boolean isViewCurrentNode,
      String treeType) {
    currPosId++;
    String id = getParentId(currPosId, listNodeId);

    if (id.indexOf("wfr_") != -1) {
      currPosId++;
      id = getParentId(currPosId, listNodeId);
    }

    if (id.indexOf("sr_") != -1 && !isViewCurrentNode) {
      SequencerRun sequencerRun = getParentSequencerRun(processing, Constant.getId(id));
      if (sequencerRun == null) {
        return "";
      }
      Log.info("openingNodeId = " + openingNodeId);
      return getAllHtml(
          sequencerRun, registration, openingNodeId /*processing.getProcessingId()*/, treeType);
    } else if (id.indexOf("seq_") != -1 && !isViewCurrentNode) {
      Lane lane = getParentLane(processing, Constant.getId(id));
      if (lane == null) {
        return "";
      }
      return getAllHtml(lane, registration, openingNodeId, treeType);
      // 1	return getAllHtml(lane, registration, processing.getProcessingId());
      // 2	return getAllHtml(lane, registration, processing.getProcessingId(), isOpenProc, true);
    } else if (id.indexOf("ius_") != -1 && !isViewCurrentNode) {
      Log.info("Proc IUS HTML");
      IUS ius = getParentIUS(processing, Constant.getId(id));
      if (ius == null) {
        return "";
      }
      return getAllHtml(ius, registration, openingNodeId, !isFirstCall, true, treeType);
    } else {
      Processing currProc;
      if (isFirstCall) {
        currProc = processing;
      } else {
        currProc = getParentProcessing(processing, Constant.getId(id));
        if (currProc == null) {
          return "";
        }
        openingNodeId = getParentId(currPosId - 1, listNodeId);
        if (openingNodeId.indexOf("wfr_") != -1) {
          openingNodeId = getParentId(currPosId - 2, listNodeId);
        }
      }

      Log.info("  -> openingNodeId Proc = " + openingNodeId);

      String childHtml =
          NodeHtmlUtil.getProcessingHtml(
              currProc, registration, TYPE_TREE, openingNodeId, treeType);

      String parentHtml =
          getAllHtml(currProc, registration, id, currPosId, listNodeId, false, false, treeType);
      String parentId = Constant.PROCESSING_PREFIX + currProc.getProcessingId();
      return NodeHtmlUtil.pasteHtmlIntoParentNode(childHtml, parentHtml, parentId, true);

      //			Log.info("currProcId = " + currProc.getProcessingId());

      //			String childHtml = NodeHtmlUtil.getProcessingHtml(currProc, registration, TYPE_TREE,
      // openingNodeId);

      //			String parentHtml = getAllHtml(currProc, registration, currProc.getProcessingId(),
      // currPosId, listNodeId, false, false);
      //			String parentId = Constant.PROCESSING_PREFIX + currProc.getProcessingId();
      //			return NodeHtmlUtil.pasteHtmlIntoParentNode(childHtml, parentHtml, parentId, true);
    }
  }