Examples of DrugInfo


Examples of org.raxa.module.raxacore.DrugInfo

      // drug doesn't exist, so we won't create the drug info
      throw new ObjectNotFoundException();
    }
   
    // create drug info POJO and add required relationship with a Drug
    DrugInfo drugInfo = new DrugInfo();
    drugInfo.setDrug(drug);
   
    // add data that was sent in the POST payload
    updateDrugInfoFieldsFromPostData(drugInfo, post);
   
    // save new object and prepare response
    DrugInfo drugInfoJustCreated = service.saveDrugInfo(drugInfo);
   
    return RestUtil.created(response, getDrugInfoAsSimpleObject(drugInfoJustCreated));
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  @WSDoc("Updates an existing drug info")
  @ResponseBody
  public Object updateDrugInfo(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
          HttpServletRequest request, HttpServletResponse response) throws ResponseException {
    initDrugInfoController();
    DrugInfo drugInfo = service.getDrugInfoByUuid(uuid);
    updateDrugInfoFieldsFromPostData(drugInfo, post);
    service.updateDrugInfo(drugInfo);
    return RestUtil.created(response, getDrugInfoAsSimpleObject(drugInfo));
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  @WSDoc("Gets Drug Info for the uuid path")
  @ResponseBody()
  public String getAllDrugInfoByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request)
          throws ResponseException {
    initDrugInfoController();
    DrugInfo drugInfo = service.getDrugInfoByUuid(uuid);
    return gson.toJson(getDrugInfoAsSimpleObject(drugInfo));
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  @WSDoc("Gets Full representation of Drug Info for the uuid path")
  @ResponseBody()
  public String getAllDrugInfoByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
          HttpServletRequest request) throws ResponseException {
    initDrugInfoController();
    DrugInfo drugInfo = service.getDrugInfoByUuid(uuid);
    SimpleObject obj = getDrugInfoAsSimpleObject(drugInfo);
    if (rep.equals("full")) {
      obj.add("retired", drugInfo.getRetired());
      if (drugInfo.getRetired()) {
        obj.add("retiredBy", drugInfo.getRetiredBy().getUuid());
        obj.add("retireReason", drugInfo.getRetireReason());
      }
      SimpleObject auditInfo = new SimpleObject();
      auditInfo.add("creator", drugInfo.getCreator().getUuid());
      auditInfo.add("dateCreated", df.format(drugInfo.getDateCreated()));
      if (drugInfo.getChangedBy() != null) {
        auditInfo.add("changedBy", drugInfo.getChangedBy().getUuid());
        auditInfo.add("dateChanged", df.format(drugInfo.getDateChanged()));
      }
      obj.add("auditInfo", auditInfo);
    }
    obj.add("resourceVersion", getResourceVersion());
    return gson.toJson(obj);
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  @ResponseBody
  public Object retireDrugInfo(@PathVariable("uuid") String uuid,
          @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request,
          HttpServletResponse response) throws ResponseException {
    initDrugInfoController();
    DrugInfo drugInfo = service.getDrugInfoByUuid(uuid);
    if (drugInfo != null) {
      drugInfo.setRetired(true);
      drugInfo.setRetireReason(reason);
      drugInfo.setRetiredBy(Context.getAuthenticatedUser());
      service.updateDrugInfo(drugInfo);
    }
    return RestUtil.noContent(response);
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "purge")
  @ResponseBody
  public Object purgeDrugInfo(@PathVariable("uuid") String uuid, HttpServletRequest request, HttpServletResponse response)
          throws ResponseException {
    initDrugInfoController();
    DrugInfo drugInfo = service.getDrugInfoByUuid(uuid);
    if (drugInfo != null) {
      service.deleteDrugInfo(drugInfo);
    }
    return RestUtil.noContent(response);
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  /**
   * Test of voidDrugInfo method, of class DrugInfoController.
   */
  @Test
  public void testRetireDrugInfo() throws Exception {
    DrugInfo di1 = service.getDrugInfoByUuid(getUuid());
    Assert.assertFalse(di1.isRetired());
    controller.retireDrugInfo(getUuid(), "testing", request, response);
    DrugInfo di2 = service.getDrugInfoByUuid(getUuid());
    Assert.assertTrue(di2.isRetired());
    Assert.assertEquals("testing", di2.getRetireReason());
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  /**
   * Test of purgeDrugInfo method, of class DrugInfoController.
   */
  @Test
  public void testPurgeDrugInfo() throws Exception {
    DrugInfo di1 = service.getDrugInfoByUuid(getUuid());
    Assert.assertFalse(di1.getRetired());
    controller.purgeDrugInfo(getUuid(), request, response);
    DrugInfo di2 = service.getDrugInfoByUuid(getUuid());
    Assert.assertNull(di2);
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  /**
   * Test of saveDrugInfo method, of class HibernateDrugInfoDAO.
   */
  @Test
  public void testSaveDrugInfo() {
    DrugInfo drugInfo = new DrugInfo();
    Drug drug = new Drug();
    drug.setId(3);
    drugInfo.setDrug(drug);
    drugInfo.setDrugId(drug.getId());
    drugInfo.setName("TestDrugInfo3");
    drugInfo.setDescription("Third Test DrugInfo");
    drugInfo.setCreator(Context.getUserContext().getAuthenticatedUser());
    drugInfo.setDateCreated(new java.util.Date());
    drugInfo.setUuid("68547121-1b70-465c-99ef-c9dfd95e7d30");
    drugInfo.setRetired(Boolean.FALSE);
    dao.saveDrugInfo(drugInfo);
    DrugInfo result = dao.getDrugInfoByUuid("68547121-1b70-465c-99ef-c9dfd95e7d30");
    String name = result.getName();
    assertEquals(name, "TestDrugInfo3");
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugInfo

  /**
   * Test of deleteDrugInfo method, of class HibernateDrugInfoDAO.
   */
  @Test
  public void testDeleteDrugInfo() {
    DrugInfo drugInfo = new DrugInfo();
    drugInfo.setId(2);
    Drug drug = new Drug();
    drug.setId(5);
    drug.setDrugId(5);
    drugInfo.setDrugId(5);
    drugInfo.setDrug(drug);
    drugInfo.setName("TestDrugInfo2");
    drugInfo.setDescription("Second Test DrugInfo");
    drugInfo.setCreator(Context.getUserContext().getAuthenticatedUser());
    drugInfo.setDateCreated(new java.util.Date());
    drugInfo.setUuid("68547121-1b70-465e-99ee-c9dfd95e7d30");
    drugInfo.setRetired(Boolean.FALSE);
    dao.deleteDrugInfo(drugInfo);
    DrugInfo result = dao.getDrugInfo(2);
    assertEquals(null, result);
  }
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.