Search in sources :

Example 11 with EntityNotFoundException

use of ubic.gemma.web.util.EntityNotFoundException in project Gemma by PavlidisLab.

the class BibliographicReferenceControllerImpl method delete.

@Override
public ModelAndView delete(HttpServletRequest request, HttpServletResponse response) {
    String pubMedId = request.getParameter("acc");
    if (pubMedId == null) {
        // should be a validation error.
        throw new EntityNotFoundException("Must provide a PubMed Id");
    }
    BibliographicReference bibRef = bibliographicReferenceService.findByExternalId(pubMedId);
    if (bibRef == null) {
        String message = "There is no reference with accession=" + pubMedId + " in the system any more.";
        this.saveMessage(request, message);
        return new ModelAndView("bibRefView").addObject("errors", message);
    }
    return this.doDelete(request, bibRef);
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference)

Example 12 with EntityNotFoundException

use of ubic.gemma.web.util.EntityNotFoundException in project Gemma by PavlidisLab.

the class ExpressionExperimentController method showBioAssays.

@RequestMapping(value = { "/showBioAssaysFromExpressionExperiment.html", "/bioAssays" })
public ModelAndView showBioAssays(HttpServletRequest request, HttpServletResponse response) {
    String idStr = request.getParameter("id");
    if (idStr == null) {
        // should be a validation error, on 'submit'.
        throw new EntityNotFoundException(identifierNotFound);
    }
    Long id = Long.parseLong(idStr);
    ExpressionExperiment expressionExperiment = expressionExperimentService.load(id);
    expressionExperiment = expressionExperimentService.thawLite(expressionExperiment);
    if (expressionExperiment == null) {
        throw new EntityNotFoundException(id + " not found");
    }
    request.setAttribute("id", id);
    ModelAndView mv = new ModelAndView("bioAssays").addObject("bioAssays", bioAssayService.thaw(expressionExperiment.getBioAssays()));
    this.addQCInfo(expressionExperiment, mv);
    mv.addObject("expressionExperiment", expressionExperiment);
    return mv;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with EntityNotFoundException

use of ubic.gemma.web.util.EntityNotFoundException in project Gemma by PavlidisLab.

the class ExpressionExperimentController method showSubSet.

/**
 * shows a list of BioAssays for an expression experiment subset
 *
 * @param request  request
 * @param response response
 * @return model and view
 */
@RequestMapping(value = { "/showExpressionExperimentSubSet.html", "/showSubset" })
public ModelAndView showSubSet(HttpServletRequest request, HttpServletResponse response) {
    Long id = Long.parseLong(request.getParameter("id"));
    ExpressionExperimentSubSet subset = expressionExperimentSubSetService.load(id);
    if (subset == null) {
        throw new EntityNotFoundException(id + " not found");
    }
    // request.setAttribute( "id", id );
    return new ModelAndView("bioAssays").addObject("bioAssays", subset.getBioAssays());
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with EntityNotFoundException

use of ubic.gemma.web.util.EntityNotFoundException in project Gemma by PavlidisLab.

the class BioAssayController method show.

@RequestMapping(value = { "/showBioAssay.html", "/" })
public ModelAndView show(HttpServletRequest request, HttpServletResponse response) {
    BioAssayController.log.debug(request.getParameter("id"));
    Long id;
    try {
        id = Long.parseLong(request.getParameter("id"));
    } catch (NumberFormatException e) {
        return new ModelAndView(WebConstants.HOME_PAGE).addObject("message", BioAssayController.identifierNotFound);
    }
    BioAssay bioAssay = bioAssayService.load(id);
    if (bioAssay == null) {
        throw new EntityNotFoundException(id + " not found");
    }
    bioAssayService.thaw(bioAssay);
    request.setAttribute("id", id);
    return new ModelAndView("bioAssay.detail").addObject("bioAssay", new BioAssayValueObject(bioAssay, false));
}
Also used : BioAssayValueObject(ubic.gemma.model.expression.bioAssay.BioAssayValueObject) ModelAndView(org.springframework.web.servlet.ModelAndView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with EntityNotFoundException

use of ubic.gemma.web.util.EntityNotFoundException in project Gemma by PavlidisLab.

the class BioAssayController method showAllBioAssays.

@RequestMapping("/showAllBioAssays.html")
public ModelAndView showAllBioAssays(HttpServletRequest request, HttpServletResponse response) {
    String sId = request.getParameter("id");
    Collection<BioAssay> bioAssays = new ArrayList<>();
    if (StringUtils.isBlank(sId)) {
        /*
             * Probably not desirable ... there are >70,000 of them
             */
        bioAssays = bioAssayService.loadAll();
    } else {
        String[] idList = StringUtils.split(sId, ',');
        for (String anIdList : idList) {
            Long id = Long.parseLong(anIdList);
            BioAssay bioAssay = bioAssayService.load(id);
            if (bioAssay == null) {
                throw new EntityNotFoundException(id + " not found");
            }
            bioAssayService.thaw(bioAssay);
            bioAssays.add(bioAssay);
        }
    }
    return new ModelAndView("bioAssays").addObject("bioAssays", bioAssays);
}
Also used : ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EntityNotFoundException (ubic.gemma.web.util.EntityNotFoundException)18 ModelAndView (org.springframework.web.servlet.ModelAndView)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)10 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)6 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)4 BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)3 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)3 ArrayList (java.util.ArrayList)2 TaskCommand (ubic.gemma.core.job.TaskCommand)2 RedirectView (org.springframework.web.servlet.view.RedirectView)1 DiffExpressionSelectedFactorCommand (ubic.gemma.core.analysis.expression.diff.DiffExpressionSelectedFactorCommand)1 CompositeSequenceMapValueObject (ubic.gemma.core.analysis.sequence.CompositeSequenceMapValueObject)1 BibliographicReferenceValueObject (ubic.gemma.model.common.description.BibliographicReferenceValueObject)1 Characteristic (ubic.gemma.model.common.description.Characteristic)1 VocabCharacteristic (ubic.gemma.model.common.description.VocabCharacteristic)1 BioAssayValueObject (ubic.gemma.model.expression.bioAssay.BioAssayValueObject)1 Gene (ubic.gemma.model.genome.Gene)1 GemmaApiException (ubic.gemma.web.services.rest.util.GemmaApiException)1 WellComposedErrorBody (ubic.gemma.web.services.rest.util.WellComposedErrorBody)1