Examples of DrugPurchaseOrder


Examples of org.raxa.module.raxacore.DrugPurchaseOrder

      Location l = Context.getLocationService().getLocationByUuid(post.get("location").toString());
      drugInventory.setLocationId(l.getId());
      drugInventory.setLocation(l);
    }
    if (post.get("drugPurchaseOrder") != null) {
      DrugPurchaseOrder dPO = Context.getService(DrugPurchaseOrderService.class).getDrugPurchaseOrderByUuid(
          post.get("drugPurchaseOrder").toString());
      drugInventory.setDrugPurchaseOrderId(dPO.getId());
      drugInventory.setDrugPurchaseOrder(dPO);
    }
    return drugInventory;
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

      lObj.add("uuid", l.getUuid());
      lObj.add("display", l.getName());
    }
    obj.add("location", lObj);
    SimpleObject dPOObj = new SimpleObject();
    DrugPurchaseOrder dPO = di.getDrugPurchaseOrder();
    if (dPO != null) {
      dPOObj.add("uuid", dPO.getUuid());
      dPOObj.add("display", dPO.getName());
    }
    obj.add("drugPurchaseOrder", dPOObj);
    return obj;
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

    return description;
  }
 
  @Override
  public DrugPurchaseOrder newDelegate() {
    return new DrugPurchaseOrder();
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

            .getBean("org.raxa.module.raxacore.db.hibernate.HibernateDrugPurchaseOrderDAO");
  }
 
  @Test
  public void testsaveDrugPurchaseOrder() {
    DrugPurchaseOrder dpOrder = new DrugPurchaseOrder();
   
    Provider provider = new Provider(1);
    provider.setDateCreated(new Date());
    Location location = new Location(1);
    location.setDateCreated(new Date());
   
    //NOTE: never set Id, will be generated automatically (when saving)
   
    dpOrder.setName("TestList4");
    dpOrder.setDescription("Third Test List");
    dpOrder.setCreator(Context.getUserContext().getAuthenticatedUser());
    dpOrder.setDateCreated(new java.util.Date());
    dpOrder.setDrugPurchaseOrderDate(new Date());
   
    dpOrder.setUuid("68547121-1b70-465c-99ee-c9dfd95e7d30");
    dpOrder.setRetired(Boolean.FALSE);
    dpOrder.setProviderId(new Integer(3));
    dpOrder.setDispenseLocationId(1);
    dpOrder.setStockLocationId(2);
    dpOrder.setProvider(provider);
    dpOrder.setDispenseLocation(Context.getLocationService().getLocation(1));
    dpOrder.setStockLocation(Context.getLocationService().getLocation(2));
   
    dao.saveDrugPurchaseOrder(dpOrder);
    DrugPurchaseOrder result = dao.getDrugPurchaseOrderByUuid("68547121-1b70-465c-99ee-c9dfd95e7d30");
   
    String uuid = result.getUuid();
    assertEquals(uuid, "68547121-1b70-465c-99ee-c9dfd95e7d30");
    //assertEquals()
   
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

  }
 
  @Test
  public void testGetDrugPurchaseOrderByUuid() {
   
    DrugPurchaseOrder result = dao.getDrugPurchaseOrderByUuid("68547121-1b70-465c-99ee-c9dfd95e7d31");
    String name = result.getName();
    assertEquals(name, "Test drug PO");
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

    assertEquals(size, 1);
  }
 
  @Test
  public void testDeleteDrugPurchaseOrder() {
    DrugPurchaseOrder dpOrder = new DrugPurchaseOrder();
   
    Provider provider = new Provider(1);
    provider.setDateCreated(new Date());
    Location location = new Location(1);
    location.setDateCreated(new Date());
   
    //NOTE: never set Id, will be generated automatically (when saving)
   
    dpOrder.setName("TestList4");
    dpOrder.setDescription("Third Test List");
    dpOrder.setCreator(Context.getUserContext().getAuthenticatedUser());
    dpOrder.setDateCreated(new java.util.Date());
    dpOrder.setDrugPurchaseOrderDate(new Date());
   
    dpOrder.setUuid("68547121-1b70-465c-99ee-c9dfd95e7d30");
    dpOrder.setRetired(Boolean.FALSE);
    dpOrder.setProviderId(new Integer(3));
    dpOrder.setDispenseLocationId(new Integer(1));
    dpOrder.setStockLocationId(new Integer(2));
    dpOrder.setProvider(provider);
    dpOrder.setDispenseLocation(Context.getLocationService().getLocation(1));
    dpOrder.setStockLocation(Context.getLocationService().getLocation(2));
   
    dao.deleteDrugPurchaseOrder(dpOrder);
    DrugPurchaseOrder result = dao.getDrugPurchaseOrderByUuid("68547121-1b70-465c-99ee-c9dfd95e7d30");
    assertEquals(result, null);
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

  @ResponseBody
  public Object createNewDrugPurchaseOrder(@RequestBody SimpleObject post, HttpServletRequest request,
          HttpServletResponse response) throws ResponseException {
    initDrugPurchaseOrderController();
   
    DrugPurchaseOrder purchaseOrder = setPostFields(post, new DrugPurchaseOrder());
    DrugPurchaseOrder created;
    SimpleObject obj = obj = new SimpleObject();
    //if it is not a prescription, save it
    //(we don't want prescriptions to show up in purchase order histories -- they will come as orders)
    if (!purchaseOrder.getName().equals(DrugPurchaseOrder.PRESCRIPTIONNAME)) {
      created = service.saveDrugPurchaseOrder(purchaseOrder);
      saveOrUpdateDrugInventories(post, purchaseOrder);
      obj.add("uuid", created.getUuid());
      obj.add("name", created.getName());
      return RestUtil.created(response, obj);
    } else {
      saveOrUpdateDrugInventories(post, purchaseOrder);
      return RestUtil.noContent(response);
    }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

  @WSDoc("Updates an existing purchase order")
  @ResponseBody
  public Object updateDrugPurchaseOrder(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
          HttpServletRequest request, HttpServletResponse response) throws ResponseException {
    initDrugPurchaseOrderController();
    DrugPurchaseOrder dPO = service.getDrugPurchaseOrderByUuid(uuid);
    dPO = setPostFields(post, dPO);
    saveOrUpdateDrugInventories(post, dPO);
    DrugPurchaseOrder created = service.updateDrugPurchaseOrder(dPO);
    SimpleObject obj = new SimpleObject();
    obj.add("uuid", created.getUuid());
    obj.add("name", created.getName());
    obj.add("description", created.getDescription());
    return RestUtil.noContent(response);
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

  @WSDoc("Gets DrugPurchaseOrder for the uuid path")
  @ResponseBody()
  public String getDrugPuchaseOrderByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request)
          throws ResponseException {
    initDrugPurchaseOrderController();
    DrugPurchaseOrder drugOrder = service.getDrugPurchaseOrderByUuid(uuid);
    SimpleObject obj = this.getFieldsFromDrugPurchaseOrder(drugOrder);
    return gson.toJson(obj);
  }
View Full Code Here

Examples of org.raxa.module.raxacore.DrugPurchaseOrder

      }
      drugInventory.setLocationId(l.getId());
      drugInventory.setLocation(l);
    }
    if (postFields.get("drugPurchaseOrder") != null) {
      DrugPurchaseOrder dPOrder = Context.getService(DrugPurchaseOrderService.class).getDrugPurchaseOrderByUuid(
          postFields.get("drugPurchaseOrder").toString());
      if (dPOrder == null) {
        throw new ResponseException(
                                    "DrugPurchaseOrder uuid not found") {};
      }
      drugInventory.setDrugPurchaseOrderId(dPOrder.getId());
      drugInventory.setDrugPurchaseOrder(dPOrder);
    }
  }
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.