Advertisement
Guest User

Untitled

a guest
Jan 13th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. package org.openmrs.module.receivedrugs.web.controller;
  2.  
  3. import org.openmrs.api.context.Context;
  4. import org.openmrs.module.receivedrugs.api.ReceivedrugsService;
  5. import org.openmrs.module.receivedrugs.api.pojo.ReceiveDrugs;
  6. import org.openmrs.module.webservices.rest.web.RequestContext;
  7. import org.openmrs.module.webservices.rest.web.RestConstants;
  8. import org.openmrs.module.webservices.rest.web.annotation.Resource;
  9. import org.openmrs.module.webservices.rest.web.representation.Representation;
  10. import org.openmrs.module.webservices.rest.web.resource.impl.DataDelegatingCrudResource;
  11. import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
  12. import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
  13. import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
  14. import org.openmrs.module.webservices.rest.web.response.ResponseException;
  15.  
  16. @Resource(name = RestConstants.VERSION_1 + "/receivedrugs", supportedClass = ReceiveDrugs.class, supportedOpenmrsVersions = {
  17. "1.8.*", "2.0.*", "2.1.*", "2.2.*", "2.3.*", "2.4.* " })
  18. public class ReceivedDrugsSaveResources extends DataDelegatingCrudResource<ReceiveDrugs> {
  19.  
  20. @Override
  21. public DelegatingResourceDescription getRepresentationDescription(Representation r) {
  22. DelegatingResourceDescription description = new DelegatingResourceDescription();
  23. description.addProperty("id");
  24. description.addProperty("locationuuid");
  25. description.addProperty("grnno");
  26. description.addProperty("received_from");
  27. description.addProperty("received_to");
  28. description.addProperty("order_no");
  29. description.addProperty("remarks");
  30. description.addProperty("supplier");
  31. description.addProperty("receive_date");
  32. description.addProperty("uuid");
  33. return description;
  34. }
  35.  
  36. @Override
  37. public DelegatingResourceDescription getCreatableProperties() {
  38. DelegatingResourceDescription description = new DelegatingResourceDescription();
  39. description.addRequiredProperty("locationuuid");
  40. description.addRequiredProperty("received_from");
  41. description.addRequiredProperty("received_to");
  42. description.addRequiredProperty("order_no");
  43. description.addRequiredProperty("remarks");
  44. description.addRequiredProperty("supplier");
  45. description.addRequiredProperty("receive_date");
  46. description.addRequiredProperty("instituteId");
  47. return description;
  48. }
  49.  
  50. @Override
  51. public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException {
  52. return getCreatableProperties();
  53. }
  54.  
  55. @Override
  56. public ReceiveDrugs newDelegate() {
  57. return new ReceiveDrugs();
  58. }
  59.  
  60. @Override
  61. public ReceiveDrugs save(ReceiveDrugs t) {
  62. ReceiveDrugs item = Context.getService(ReceivedrugsService.class).SaveReceiveDrugs(t);
  63. return item;
  64. }
  65.  
  66. @Override
  67. protected void delete(ReceiveDrugs t, String arg1, RequestContext arg2) throws ResponseException {
  68. }
  69.  
  70. @Override
  71. public ReceiveDrugs getByUniqueId(String uuid) {
  72. return null;
  73. }
  74.  
  75. @Override
  76. public void purge(ReceiveDrugs t, RequestContext context) throws ResponseException {
  77. }
  78.  
  79. @Override
  80. public NeedsPaging<ReceiveDrugs> doGetAll(RequestContext context) {
  81. return null;
  82. }
  83.  
  84. }
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement