Examples of AnalysisStepCommand


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

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

    AnalysisStepCommand analysisStepCommand = (AnalysisStepCommand) command;
    String redirectView = request.getParameter("redirect");
    if (request.getParameter(ACTION_SUBMIT) != null) {

      // TODO: persist the analysisStep first since we need the analysis step id later.
      // It is better to move the analysis step creation code to analysisStepService.create()
      // method and return the analysis step id.
      AnalysisStep analysisStep = new AnalysisStep();
      ModelAndView resultView = updateAnalysisStep(analysisStepCommand,analysisStep,request,response,myerrors);
      if ( resultView != null ) {
        return resultView;
      }

      // determine which analysis we are dealing with
      String analysis_id = ServletRequestUtils.getStringParameter(request,"analysis_id",null);
      Analysis analysis = mAnalysisService.findByID(Long.parseLong(analysis_id));
      analysis.addAnalysisStep(analysisStep);

      mAnalysisService.update(analysis);
      if ( redirectView == null ) {
        return new ModelAndView("redirect:/user/analyzedDataForm.html" + "?analysis_step_id="
          + analysisStep.getId().toString());
      }
      else {
        return new ModelAndView(redirectView);
      }
    } else if (request.getParameter(ACTION_UPDATE) != null) {
      AnalysisStep analysisStep = mAnalysisStepService.findByID(analysisStepCommand.getId());
      ModelAndView resultView = updateAnalysisStep(analysisStepCommand,analysisStep,request,response,myerrors);
      if ( resultView != null ) {
        return resultView;
      }
     
      mAnalysisStepService.update(analysisStep);

    } else if (request.getParameter(ACTION_DELETE) != null) {

      AnalysisStep analysisStep = mAnalysisStepService.findByID(analysisStepCommand.getId());
      mAnalysisStepService.deleteAnalysisStep(analysisStep);
      if ( redirectView == null ) {
        return new ModelAndView(getSuccessView());
      }
      else {
View Full Code Here

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

    }

    List<String> uniqueAlgorithmDescriptions = getAnalysisStepService()
      .findUniqueAlgorithmDescriptions();

    AnalysisStepCommand analysisStepCommand = new AnalysisStepCommand();
    analysisStepCommand.setUniqueAlgorithmDescriptions(uniqueAlgorithmDescriptions);

    if (TreebaseUtil.isEmpty(analysisStep_id)) {
      if (perm == TBPermission.WRITE) {
        LOGGER.info("setAuthorizationChecked(true)");
        setAuthorizationChecked(true);
        return analysisStepCommand;
      } else {
        LOGGER.info("setAuthorizationChecked(false)");
        setAuthorizationChecked(false);
        return null;
      }
    } else {
      AnalysisStep analysisStep = mAnalysisStepService.findByID(Long
        .parseLong(analysisStep_id));
      Long analysis_id = analysisStep.getAnalysis().getId();

      TBPermission perm2 = getAnalysisService().getPermission(username, analysis_id);
      if (perm2 == TBPermission.WRITE || perm2 == TBPermission.READ_ONLY
        || perm2 == TBPermission.SUBMITTED_WRITE) {

        BeanUtils.copyProperties(analysisStep, analysisStepCommand);
        Software software = analysisStep.getSoftwareInfo();
        analysisStepCommand.setSoftwareInfo(software);
        Algorithm algorithm = analysisStep.getAlgorithmInfo();
        if ( algorithm != null ) {
          analysisStepCommand.setAlgorithmType(algorithm.getAlgorithmType());
          analysisStepCommand.setAlgorithmMap(algorithm.getAlgorithmType(), algorithm);
        }
        List<AnalyzedDataCommand> analyzedDataCommandList = createAnalyzedDataCommandList(analysisStep);
       
        analysisStepCommand.setAnalyzedDataCommandList(analyzedDataCommandList);
       
        // save analysis step object
        ControllerUtil.saveAnalysisStep(request, analysisStep);

        if (perm2 == TBPermission.READ_ONLY) {
View Full Code Here

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

     * map AnalysisStep to AnalysisStepCommand so we can print the algorithm type and the order
     */
    List<AnalysisStepCommand> list = new ArrayList<AnalysisStepCommand>();
    int order = 0;
    for (AnalysisStep step : steps) {
      AnalysisStepCommand command = new AnalysisStepCommand();
      BeanUtils.copyProperties(step, command);
      command.setAlgorithmType(ControllerUtil.getAlgorithmType(step.getAlgorithmInfo()));
      command.setOrder(order);
      list.add(order, command);
      order++;
    }
    return new ModelAndView("analysisStepList", Constants.ANALYSIS_STEP_LIST, list);
  }
View Full Code Here

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

      // Analysis Steps for Analysis and add algorithm type
      List<AnalysisStep> analysisStepList = analysis.getAnalysisStepsReadOnly();
      List<AnalysisStepCommand> analysisStepCommandList = new ArrayList<AnalysisStepCommand>();

      for (AnalysisStep analysisStep : analysisStepList) {
        AnalysisStepCommand analysisStepCommand = new AnalysisStepCommand();
        BeanUtils.copyProperties(analysisStepCommand, analysisStep);
        // analysisStepCommand.setId(analysisStep.getId());
        // analysisStepCommand.setSoftwareInfo(analysisStep.getSoftwareInfo());
        Algorithm algorithm = analysisStep.getAlgorithmInfo();
        String algorithmType = new String();
        if (algorithm instanceof LikelihoodAlgorithm) {
          algorithmType = Constants.ALGORITHM_LIKELIHOOD;
        } else if (algorithm instanceof ParsimonyAlgorithm) {
          algorithmType = Constants.ALGORITHM_PARSIMONY;
        else if (algorithm instanceof OtherAlgorithm) {
          algorithmType = Constants.ALGORITHM_OTHER;
        }else if (algorithm instanceof BayesianAlgorithm) {
          algorithmType = Constants.ALGORITHM_Bayesian;
        } else if (algorithm instanceof EvolutionAlgorithm) {
          algorithmType = Constants.ALGORITHM_Evolution;
        } else if (algorithm instanceof JoiningAlgorithm) {
          algorithmType = Constants.ALGORITHM_Joining;
      } else if (algorithm instanceof UPGMAAlgorithm) {
        algorithmType = Constants.ALGORITHM_UPGMA; 
      }
        // add algorithm type for analysisStepCommand
        analysisStepCommand.setAlgorithmType(algorithmType);

        // analyzed data for each analysis step
        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

        Collections.sort(analyzedDataCommandList, new AnalyzedDataComparator());

        analysisStepCommand.setAnalyzedDataCommandList(analyzedDataCommandList);
        analysisStepCommandList.add(analysisStepCommand);
      }
      analysisCommand.setAnalysisStepCommandList(analysisStepCommandList);
      analysisCommandList.add(analysisCommand);
    }
View Full Code Here

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

      // Analysis Steps for Analysis and add algorithm type
      List<AnalysisStep> analysisStepList = analysis.getAnalysisStepsReadOnly();
      List<AnalysisStepCommand> analysisStepCommandList = new ArrayList<AnalysisStepCommand>();

      for (AnalysisStep analysisStep : analysisStepList) {
        AnalysisStepCommand analysisStepCommand = new AnalysisStepCommand();
        BeanUtils.copyProperties(analysisStepCommand, analysisStep);
        // analysisStepCommand.setId(analysisStep.getId());
        // analysisStepCommand.setSoftwareInfo(analysisStep.getSoftwareInfo());
        Algorithm algorithm = analysisStep.getAlgorithmInfo();
        String algorithmType = new String();
        if (algorithm instanceof LikelihoodAlgorithm) {
          algorithmType = Constants.ALGORITHM_LIKELIHOOD;
        } else if (algorithm instanceof ParsimonyAlgorithm) {
          algorithmType = Constants.ALGORITHM_PARSIMONY;
        } else if (algorithm instanceof OtherAlgorithm) {
          algorithmType = Constants.ALGORITHM_OTHER;
        }else if (algorithm instanceof BayesianAlgorithm) {
          algorithmType = Constants.ALGORITHM_Bayesian;
        } else if (algorithm instanceof EvolutionAlgorithm) {
          algorithmType = Constants.ALGORITHM_Evolution;
        } else if (algorithm instanceof JoiningAlgorithm) {
          algorithmType = Constants.ALGORITHM_Joining;
        } else if (algorithm instanceof UPGMAAlgorithm) {
          algorithmType = Constants.ALGORITHM_UPGMA; 
        }
       
        // add algorithm type for analysisStepCommand
        analysisStepCommand.setAlgorithmType(algorithmType);

        // analyzed data for each analysis step
        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

        Collections.sort(analyzedDataCommandList, new AnalyzedDataComparator());

        analysisStepCommand.setAnalyzedDataCommandList(analyzedDataCommandList);
        analysisStepCommandList.add(analysisStepCommand);
      }
      analysisCommand.setAnalysisStepCommandList(analysisStepCommandList);
      analysisCommandList.add(analysisCommand);
    }
View Full Code Here

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

      // Analysis Steps for Analysis and add algorithm type
      List<AnalysisStep> analysisStepList = analysis.getAnalysisStepsReadOnly();
      List<AnalysisStepCommand> analysisStepCommandList = new ArrayList<AnalysisStepCommand>();

      for (AnalysisStep analysisStep : analysisStepList) {
        AnalysisStepCommand analysisStepCommand = new AnalysisStepCommand();
        BeanUtils.copyProperties(analysisStepCommand, analysisStep);
        // analysisStepCommand.setId(analysisStep.getId());
        // analysisStepCommand.setSoftwareInfo(analysisStep.getSoftwareInfo());
        Algorithm algorithm = analysisStep.getAlgorithmInfo();
        String algorithmType = new String();
        if (algorithm instanceof LikelihoodAlgorithm) {
          algorithmType = Constants.ALGORITHM_LIKELIHOOD;
        } else if (algorithm instanceof ParsimonyAlgorithm) {
          algorithmType = Constants.ALGORITHM_PARSIMONY;
        }else if (algorithm instanceof OtherAlgorithm) {
          algorithmType = Constants.ALGORITHM_OTHER;
        }else if (algorithm instanceof BayesianAlgorithm) {
          algorithmType = Constants.ALGORITHM_Bayesian;
        } else if (algorithm instanceof EvolutionAlgorithm) {
          algorithmType = Constants.ALGORITHM_Evolution;
        } else if (algorithm instanceof JoiningAlgorithm) {
          algorithmType = Constants.ALGORITHM_Joining;
        } else if (algorithm instanceof UPGMAAlgorithm) {
          algorithmType = Constants.ALGORITHM_UPGMA; 
        }
       
       
        // add algorithm type for analysisStepCommand
        analysisStepCommand.setAlgorithmType(algorithmType);

        // analyzed data for each analysis step
        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

        Collections.sort(analyzedDataCommandList, new AnalyzedDataComparator());

        analysisStepCommand.setAnalyzedDataCommandList(analyzedDataCommandList);
        analysisStepCommandList.add(analysisStepCommand);
      }
      analysisCommand.setAnalysisStepCommandList(analysisStepCommandList);
      analysisCommandList.add(analysisCommand);
    }
View Full Code Here

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

      // Analysis Steps for Analysis and add algorithm type
      List<AnalysisStep> analysisStepList = analysis.getAnalysisStepsReadOnly();
      List<AnalysisStepCommand> analysisStepCommandList = new ArrayList<AnalysisStepCommand>();

      for (AnalysisStep analysisStep : analysisStepList) {
        AnalysisStepCommand analysisStepCommand = new AnalysisStepCommand();
        BeanUtils.copyProperties(analysisStepCommand, analysisStep);
        // analysisStepCommand.setId(analysisStep.getId());
        // analysisStepCommand.setSoftwareInfo(analysisStep.getSoftwareInfo());
        Algorithm algorithm = analysisStep.getAlgorithmInfo();
        String algorithmType = new String();
        if (algorithm instanceof LikelihoodAlgorithm) {
          algorithmType = Constants.ALGORITHM_LIKELIHOOD;
        } else if (algorithm instanceof ParsimonyAlgorithm) {
          algorithmType = Constants.ALGORITHM_PARSIMONY;
        }else if (algorithm instanceof OtherAlgorithm) {
          algorithmType = Constants.ALGORITHM_OTHER;
        }else if (algorithm instanceof BayesianAlgorithm) {
          algorithmType = Constants.ALGORITHM_Bayesian;
        }else if (algorithm instanceof EvolutionAlgorithm) {
          algorithmType = Constants.ALGORITHM_Evolution;
        }else if (algorithm instanceof JoiningAlgorithm) {
          algorithmType = Constants.ALGORITHM_Joining;
        }else if (algorithm instanceof UPGMAAlgorithm) {
          algorithmType = Constants.ALGORITHM_UPGMA; 
        }
       
        // add algorithm type for analysisStepCommand
        analysisStepCommand.setAlgorithmType(algorithmType);

        // analyzed data for each analysis step
        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

        Collections.sort(analyzedDataCommandList, new AnalyzedDataComparator());

        analysisStepCommand.setAnalyzedDataCommandList(analyzedDataCommandList);
        analysisStepCommandList.add(analysisStepCommand);
      }
      analysisCommand.setAnalysisStepCommandList(analysisStepCommandList);
      analysisCommandList.add(analysisCommand);
    }
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.