Examples of AnalyzedDataCommand


Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

  private List<AnalyzedDataCommand> createAnalyzedDataCommandList(AnalysisStep analysisStep) {
    Iterator<AnalyzedData> dataListIterator = analysisStep.getDataSetReadOnly().iterator();
    List<AnalyzedDataCommand> analyzedDataCommandList = new ArrayList<AnalyzedDataCommand>();
    while ( dataListIterator.hasNext() ) {
      AnalyzedData data = dataListIterator.next();
      AnalyzedDataCommand command = new AnalyzedDataCommand();
      command.setDataType(data.getDataType());
      command.setDisplayName(data.getDisplayName());
      command.setInput(data.isInputData());
      command.setInputOutputType(data.getInputOutput());
      command.setNotes(data.getNotes());
      command.setId(data.getId());
      List<EditFieldCommand> efcList = new ArrayList<EditFieldCommand>();
      EditFieldCommand efc = null;
      if ( data.getDataType().equals("tree") ) {
        command.setDataId(data.getTreeData().getId());
        efc = new EditFieldCommand(data.getTreeData(),data.getInputOutput());
      }
      else if ( data.getDataType().equals("matrix") ) {
        command.setDataId(data.getMatrixData().getId());
        efc = new EditFieldCommand(data.getMatrixData(),data.getInputOutput());
      }
      efcList.add(efc);
      analyzedDataCommandList.add(command);
    }
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

    HttpServletRequest request,
    HttpServletResponse response,
    Object command,
    BindException errors) throws Exception {

    AnalyzedDataCommand data = (AnalyzedDataCommand) command;

    // get the analysis step we are dealing with
    String analysis_step_id = ServletRequestUtils.getStringParameter(
      request,
      "analysis_step_id",
      null);

    request.getSession().setAttribute("ANALYSIS_STEP_ID_FROM_ANALYZED_DATA", analysis_step_id);

    AnalysisStep analysisStep = mAnalysisStepService.findByID(Long.parseLong(analysis_step_id));

    // process each check box user has selected -- add to AnalyzedData table
    String dataType = data.getDataType();
    Boolean input = (data.getInputOutputType().equals(Constants.INPUT_KEY)) ? (true) : (false);

    if (dataType.equals(Constants.MATRIX_KEY)) {
      List<EditFieldCommand> matrixList = data.getMatrixList();
      for (int i = 0; i < matrixList.size(); i++) {
        EditFieldCommand editFieldCommand = matrixList.get(i);
        // check if user update title
        Matrix matrix = mMatrixService.findByID(editFieldCommand.getMatrix().getId());
        matrix.setTitle(editFieldCommand.getMatrix().getTitle());
        mMatrixService.update(matrix);
        if (!editFieldCommand.getChecked()) continue; // skip current iteration if not
        // checked
        AnalyzedMatrix analyzedMatrix = new AnalyzedMatrix();
        analyzedMatrix.setInput(input);
        analyzedMatrix.setMatrix(matrix);
        analysisStep.addAnalyzedData(analyzedMatrix);
        mAnalysisStepService.update(analysisStep);
      }// end for
    } else if (dataType.equals(Constants.TREE_KEY)) {
      List<EditFieldCommand> treeList = data.getTreeList();
      for (int i = 0; i < treeList.size(); i++) {
        EditFieldCommand editFieldCommand = treeList.get(i);
        // check if user update title
        PhyloTree phyloTree = mPhyloTreeService.findByID(editFieldCommand
          .getPhyloTree().getId());
        phyloTree.setLabel(editFieldCommand.getPhyloTree().getLabel());
        mPhyloTreeService.update(phyloTree);
        if (!editFieldCommand.getChecked()) {
          continue; // skip current iteration if not
        }
        // checked
        AnalyzedTree analyzedTree = new AnalyzedTree();
        analyzedTree.setInput(input);
        analyzedTree.setTree(phyloTree);
        analysisStep.addAnalyzedData(analyzedTree);
        mAnalysisStepService.update(analysisStep);
      }
    } else if ( dataType.equals(Constants.TREE_LIST)) {
      List<EditFieldCommand> treeBlockList = data.getTreeBlockList();
      LOGGER.warn("Going to set tree block as analyzed data");
      for ( int i = 0; i < treeBlockList.size(); i++ ) {
        EditFieldCommand editFieldCommand = treeBlockList.get(i);
        if ( ! editFieldCommand.getChecked() ) {
          continue// skip current iteration if not checked
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

    HttpServletRequest request,
    Object command,
    Errors errors,
    int currentPage) {

    AnalyzedDataCommand analyzedDataCommand = (AnalyzedDataCommand) command;
    String dataType = analyzedDataCommand.getDataType();
    int nextPage = 0;

    if (currentPage == 0) {
      if (dataType.equals(Constants.TREE_KEY)) {
        nextPage = 2;
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

    }

    Study study = ControllerUtil.findStudy(request, mStudyService);
    Submission submission = (Submission) study.getSubmission();

    AnalyzedDataCommand command = new AnalyzedDataCommand();
    String analysis_step_id = ServletRequestUtils.getStringParameter(
      request,
      "analysis_step_id",
      null);
    if (TreebaseUtil.isEmpty(analysis_step_id)) {
      return command;
    }
    command.setStep(analysis_step_id);

    // retrieve list of matrix IDs user has previously selected and store in them for lookup
    AnalysisStep analysisStep = mAnalysisStepService.findByID(Long.parseLong(analysis_step_id));
    List<AnalyzedData> selectedData = analysisStep.getDataSetReadOnly();
    Map<Long, Boolean> selectedMatrices = new HashMap<Long, Boolean>();
    Map<Long, Boolean> selectedTrees = new HashMap<Long, Boolean>();
    Map<Long, Boolean> selectedTreeBlocks = new HashMap<Long,Boolean>();
    Map<Long, Boolean> incompleteTreeBlocks = new HashMap<Long,Boolean>();

    for (AnalyzedData data : selectedData) {
      if (data instanceof AnalyzedMatrix) {
        AnalyzedMatrix analyzedMatrix = (AnalyzedMatrix) data;
        selectedMatrices.put(analyzedMatrix.getMatrix().getId(), analyzedMatrix
          .isInputData());
      } else if (data instanceof AnalyzedTree) {
        AnalyzedTree analyzedTree = (AnalyzedTree) data;
        selectedTrees.put(analyzedTree.getTree().getId(), analyzedTree.isInputData());
        TreeBlock treeBlock = analyzedTree.getTree().getTreeBlock();
        Long tbID = treeBlock.getId();
        if ( ! selectedTreeBlocks.containsKey(tbID) && ! incompleteTreeBlocks.containsKey(tbID) ) {
          int seen = 0;
          for ( AnalyzedData innerData : selectedData ) {
            if ( innerData instanceof AnalyzedTree ) {             
              Iterator<PhyloTree> treeIterator = treeBlock.getTreeListIterator();
              FIND: while (treeIterator.hasNext()) {
                PhyloTree treeInBlock = treeIterator.next();
                if ( treeInBlock.getId() == ((AnalyzedTree)innerData).getTree().getId() ) {
                  seen++;
                  break FIND;
                }
              }
            }
          }
          if ( seen == treeBlock.getTreeCount() ) {
            selectedTreeBlocks.put(tbID, true);
          }
          else {
            incompleteTreeBlocks.put(tbID, true);
          }
        }
      }
    }
    // get list of all the matrices and set check = true if it's already been selected
    List<EditFieldCommand> matrixList = new ArrayList<EditFieldCommand>();
    Collection<Matrix> matrices = submission.getSubmittedMatricesReadOnly();
    for (Matrix matrix : matrices) {
      Long id = matrix.getId();
      String selected = new String();
      if (selectedMatrices.containsKey(id)) {
        selected = selectedMatrices.get(id)
          ? (Constants.INPUT_KEY)
          : (Constants.OUTPUT_KEY);
      }
      EditFieldCommand editFieldCommand = new EditFieldCommand(matrix, selected);
      matrixList.add(editFieldCommand);
    }
    command.setMatrixList(matrixList);

    // do the same for trees
    // Iterator<PhyloTree> trees = submission.getTreeIterator();
    List<EditFieldCommand> treeList = new ArrayList<EditFieldCommand>();
    Collection<PhyloTree> trees = submission.getAllSubmittedTrees();
    for (PhyloTree tree : trees) {
      Long id = tree.getId();
      String selected = new String();
      if (selectedTrees.containsKey(id)) {
        selected = selectedTrees.get(id) ? (Constants.INPUT_KEY) : (Constants.OUTPUT_KEY);
      }
      EditFieldCommand editFieldCommand = new EditFieldCommand(tree, selected);
      treeList.add(editFieldCommand);
    }
    command.setTreeList(treeList);
   
    List<EditFieldCommand> treeBlockList = new ArrayList<EditFieldCommand>();
    Collection<TreeBlock> treeBlocks = submission.getSubmittedTreeBlocksReadOnly();
    for (TreeBlock treeBlock : treeBlocks) {
      Long id = treeBlock.getId();
      String selected = new String();
      if ( selectedTreeBlocks.containsKey(id)) {
        selected = selectedTreeBlocks.get(id) ? (Constants.INPUT_KEY) : (Constants.OUTPUT_KEY);
      }
      EditFieldCommand editFieldCommand = new EditFieldCommand(treeBlock,selected);
      treeBlockList.add(editFieldCommand);
    }
    command.setTreeBlockList(treeBlockList);

    return command;
  }
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

        List<AnalyzedDataCommand> analyzedDataCommandList = new ArrayList<AnalyzedDataCommand>();

        // Matrix or Tree?
        for (AnalyzedData analyzedData : analyzedDataSet) {

          AnalyzedDataCommand analyzedDataCommand = new AnalyzedDataCommand();
          BeanUtils.copyProperties(analyzedDataCommand, analyzedData);
          String inputOutput = (analyzedData.isInputData()) ? ("Input") : ("Output");
          analyzedDataCommand.setInputOutputType(inputOutput);

          if (analyzedData instanceof AnalyzedMatrix) {
            AnalyzedMatrix analyzedMatrix = (AnalyzedMatrix) analyzedData;
            analyzedDataCommand.setDataType(Constants.MATRIX_KEY);
            analyzedDataCommand.setDisplayName(analyzedMatrix.getMatrix().getTitle());
            analyzedDataCommand.setId(analyzedMatrix.getId());
            analyzedDataCommand.setDataId(analyzedMatrix.getMatrix().getId());
          } else if (analyzedData instanceof AnalyzedTree) {
            AnalyzedTree analyzedTree = (AnalyzedTree) analyzedData;
            analyzedDataCommand.setDataType(Constants.TREE_KEY);
            analyzedDataCommand.setDisplayName(analyzedTree.getTree().getLabel());
            analyzedDataCommand.setId(analyzedTree.getId());
            analyzedDataCommand.setDataId(analyzedTree.getTree().getId());
          }

          analyzedDataCommandList.add(analyzedDataCommand);
        } // end for
        // add analyzedData for analysisStepCommand
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

    String analysis_step_id = ServletRequestUtils.getStringParameter(request, "id", null);
    AnalysisStep analysisStep = mAnalysisStepService.findByID(Long.parseLong(analysis_step_id));
    List<AnalyzedData> dataset = analysisStep.getDataSetReadOnly();
    // map AnalyzedData -> AnalyzedDataCommand
    AnalyzedDataCommand analyzedDataCommand;

    List<AnalyzedDataCommand> list = new ArrayList<AnalyzedDataCommand>();
    for (AnalyzedData data : dataset) {
      analyzedDataCommand = new AnalyzedDataCommand();
      String inputOutput = (data.isInputData()) ? ("Input") : ("Output");
      analyzedDataCommand.setInputOutputType(inputOutput);

      if (data instanceof AnalyzedMatrix) {
        AnalyzedMatrix analyzedMatrix = (AnalyzedMatrix) data;
        analyzedDataCommand.setDataType(Constants.MATRIX_KEY);
        analyzedDataCommand.setDisplayName(analyzedMatrix.getMatrix().getTitle());
        analyzedDataCommand.setId(analyzedMatrix.getId());
        analyzedDataCommand.setDataId(analyzedMatrix.getMatrix().getId());
      } else if (data instanceof AnalyzedTree) {
        AnalyzedTree analyzedTree = (AnalyzedTree) data;
        analyzedDataCommand.setDataType(Constants.TREE_KEY);
        analyzedDataCommand.setDisplayName(analyzedTree.getTree().getLabel());
        analyzedDataCommand.setId(analyzedTree.getId());
        analyzedDataCommand.setDataId(analyzedTree.getTree().getId());
      }
      list.add(analyzedDataCommand);
    }

    // save the analysis step object user has selected
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

        List<AnalyzedData> analyzedDataSet = analysisStep.getDataSetReadOnly();
        List<AnalyzedDataCommand> analyzedDataCommandList = new ArrayList<AnalyzedDataCommand>();

        // Matrix or Tree?
        for (AnalyzedData analyzedData : analyzedDataSet) {
          AnalyzedDataCommand analyzedDataCommand = new AnalyzedDataCommand();
          BeanUtils.copyProperties(analyzedDataCommand, analyzedData);
          String inputOutput = (analyzedData.isInputData()) ? ("Input") : ("Output");
          analyzedDataCommand.setInputOutputType(inputOutput);
          if (analyzedData instanceof AnalyzedMatrix) {
            AnalyzedMatrix analyzedMatrix = (AnalyzedMatrix) analyzedData;
            analyzedDataCommand.setDataType(Constants.MATRIX_KEY);
            analyzedDataCommand.setDisplayName(analyzedMatrix.getMatrix().getTitle());
            analyzedDataCommand.setId(analyzedMatrix.getId());
            analyzedDataCommand.setDataId(analyzedMatrix.getMatrix().getId());
          } else if (analyzedData instanceof AnalyzedTree) {
            AnalyzedTree analyzedTree = (AnalyzedTree) analyzedData;
            analyzedDataCommand.setDataType(Constants.TREE_KEY);
            analyzedDataCommand.setDisplayName(analyzedTree.getTree().getLabel());
            analyzedDataCommand.setId(analyzedTree.getId());
            analyzedDataCommand.setDataId(analyzedTree.getTree().getId());
          }
          analyzedDataCommandList.add(analyzedDataCommand);
        } // end for
        // add analyzedData for analysisStepCommand
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

        List<AnalyzedData> analyzedDataSet = analysisStep.getDataSetReadOnly();
        List<AnalyzedDataCommand> analyzedDataCommandList = new ArrayList<AnalyzedDataCommand>();

        // Matrix or Tree?
        for (AnalyzedData analyzedData : analyzedDataSet) {
          AnalyzedDataCommand analyzedDataCommand = new AnalyzedDataCommand();
          BeanUtils.copyProperties(analyzedDataCommand, analyzedData);
          String inputOutput = (analyzedData.isInputData()) ? ("Input") : ("Output");
          analyzedDataCommand.setInputOutputType(inputOutput);
          if (analyzedData instanceof AnalyzedMatrix) {
            AnalyzedMatrix analyzedMatrix = (AnalyzedMatrix) analyzedData;
            analyzedDataCommand.setDataType(Constants.MATRIX_KEY);
            analyzedDataCommand.setDisplayName(analyzedMatrix.getMatrix().getTitle());
            analyzedDataCommand.setId(analyzedMatrix.getId());
            analyzedDataCommand.setDataId(analyzedMatrix.getMatrix().getId());
          } else if (analyzedData instanceof AnalyzedTree) {
            AnalyzedTree analyzedTree = (AnalyzedTree) analyzedData;
            analyzedDataCommand.setDataType(Constants.TREE_KEY);
            analyzedDataCommand.setDisplayName(analyzedTree.getTree().getLabel());
            analyzedDataCommand.setId(analyzedTree.getId());
            analyzedDataCommand.setDataId(analyzedTree.getTree().getId());
          }
          analyzedDataCommandList.add(analyzedDataCommand);
        } // end for
        // add analyzedData for analysisStepCommand
View Full Code Here

Examples of org.cipres.treebase.web.model.AnalyzedDataCommand

        List<AnalyzedData> analyzedDataSet = analysisStep.getDataSetReadOnly();
        List<AnalyzedDataCommand> analyzedDataCommandList = new ArrayList<AnalyzedDataCommand>();

        // Matrix or Tree?
        for (AnalyzedData analyzedData : analyzedDataSet) {
          AnalyzedDataCommand analyzedDataCommand = new AnalyzedDataCommand();
          BeanUtils.copyProperties(analyzedDataCommand, analyzedData);
          String inputOutput = (analyzedData.isInputData()) ? ("Input") : ("Output");
          analyzedDataCommand.setInputOutputType(inputOutput);
          if (analyzedData instanceof AnalyzedMatrix) {
            AnalyzedMatrix analyzedMatrix = (AnalyzedMatrix) analyzedData;
            analyzedDataCommand.setDataType(Constants.MATRIX_KEY);
            analyzedDataCommand.setDisplayName(analyzedMatrix.getMatrix().getTitle());
            analyzedDataCommand.setId(analyzedMatrix.getId());
            analyzedDataCommand.setDataId(analyzedMatrix.getMatrix().getId());
          } else if (analyzedData instanceof AnalyzedTree) {
            AnalyzedTree analyzedTree = (AnalyzedTree) analyzedData;
            analyzedDataCommand.setDataType(Constants.TREE_KEY);
            analyzedDataCommand.setDisplayName(analyzedTree.getTree().getLabel());
            analyzedDataCommand.setId(analyzedTree.getId());
            analyzedDataCommand.setDataId(analyzedTree.getTree().getId());
          }
          analyzedDataCommandList.add(analyzedDataCommand);
        } // end for
        // add analyzedData for analysisStepCommand
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.