Example #1
0
  @RequestMapping(value = "/UgeneMatrix", method = RequestMethod.POST)
  public String getUgeneMatrixObservations(
      @Valid @ModelAttribute("feMatrixForm") FEMatrixform feUgeneForm,
      BindingResult result,
      Model model) {

    if (result.hasErrors()) {
      return "UgeneMatrix";
    }

    assert (jobSearchService != null);
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    assert (user != null);

    List<JobSearchParameter> searchParameters = new ArrayList<JobSearchParameter>(9);
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.CLASSPROPERTY.getSearchKey(), feUgeneForm.getClassProperty(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.CLASSTIME.getSearchKey(), feUgeneForm.getClassTime(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.STARTDATE.getSearchKey(), feUgeneForm.getStartDate(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.ENDDATE.getSearchKey(), feUgeneForm.getEndDate(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.STARTTIME.getSearchKey(), feUgeneForm.getStartTime(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.ENDTIME.getSearchKey(), feUgeneForm.getEndTime(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.NOCLASSPROPERTYFEATURE.getSearchKey(),
            feUgeneForm.getNoCPFeatures(),
            1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.UGENETYPE.getSearchKey(), feUgeneForm.getUgeneAlgorithm(), 1));

    JobSearch jobSearch = new JobSearch();
    jobSearch.setSearchBy(user.getId());
    jobSearch.setSearchParameters(searchParameters);

    JobSearchDetails jobSearchDetails = new JobSearchDetails();
    jobSearchDetails.setSearchOn(SearchOn.UGENEMATRIX.getSearchOn());
    jobSearchDetails.setSearchType("UGENEMATRIX");
    jobSearchDetails.setSearchParameters(jobSearch.getSearchParameters().get(0).getValue());
    jobSearchDetails.setScriptType(SearchScript.UGENEMATRIX.getSearchScript());
    jobSearchDetails.setScriptParameters(jobSearchService.getScriptParameters(jobSearch));

    jobSearchService.searchJob(jobSearch, jobSearchDetails);
    return "redirect:/MySearch/";
  }
Example #2
0
  @RequestMapping(value = "/ML-FLEX", method = RequestMethod.POST)
  public String getMlFlexObservations(
      @Valid @ModelAttribute("mlflexForm") FEMlFlexForm mlflexform,
      BindingResult result,
      Model model) {

    if (result.hasErrors()) {
      return "FEMLFlex";
    }

    assert (jobSearchService != null);
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    assert (user != null);

    List<JobSearchParameter> searchParameters = new ArrayList<JobSearchParameter>(9);
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.CLASSPROPERTY.getSearchKey(), mlflexform.getClassProperty(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.CLASSIFIER.getSearchKey(),
            mlflexform.getClassificationAlgorithm(),
            1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.FOLDS.getSearchKey(), mlflexform.getFolds().toString(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.NoITERATIONS.getSearchKey(),
            mlflexform.getNumberOfIterations().toString(),
            1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.CLASSTIME.getSearchKey(), mlflexform.getClassTime(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.STARTDATE.getSearchKey(), mlflexform.getStartDate(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.ENDDATE.getSearchKey(), mlflexform.getEndDate(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.STARTTIME.getSearchKey(), mlflexform.getStartTime(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.ENDTIME.getSearchKey(), mlflexform.getEndTime(), 1));
    searchParameters.add(
        new JobSearchParameter(
            JobSearchConstants.NOCLASSPROPERTYFEATURE.getSearchKey(),
            mlflexform.getNoCPFeatures(),
            1));

    JobSearch jobSearch = new JobSearch();
    jobSearch.setSearchBy(user.getId());
    jobSearch.setSearchParameters(searchParameters);

    JobSearchDetails jobSearchDetails = new JobSearchDetails();
    jobSearchDetails.setSearchOn(SearchOn.FEMLFLEX.getSearchOn());
    jobSearchDetails.setSearchType("FEMlFlex");
    jobSearchDetails.setSearchParameters(jobSearch.getSearchParameters().get(0).getValue());
    jobSearchDetails.setScriptType(SearchScript.FEMLFLEX.getSearchScript());
    jobSearchDetails.setScriptParameters(jobSearchService.getScriptParameters(jobSearch));

    jobSearchService.searchJob(jobSearch, jobSearchDetails);

    return "redirect:/MySearch/";
  }