Advertisement
atiqbiz22

Untitled

Jan 19th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. /**
  2. * This Source Code Form is subject to the terms of the Mozilla Public License,
  3. * v. 2.0. If a copy of the MPL was not distributed with this file, You can
  4. * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
  5. * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
  6. *
  7. * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
  8. * graphic logo is a trademark of OpenMRS Inc.
  9. */
  10. package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_0;
  11.  
  12. import org.openmrs.Location;
  13. import org.openmrs.module.webservices.rest.web.RestConstants;
  14. import org.openmrs.module.webservices.rest.web.annotation.Resource;
  15. import org.openmrs.module.webservices.rest.web.representation.DefaultRepresentation;
  16. import org.openmrs.module.webservices.rest.web.representation.FullRepresentation;
  17. import org.openmrs.module.webservices.rest.web.representation.Representation;
  18. import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
  19. import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.LocationResource1_9;
  20.  
  21. /**
  22. * {@link Resource} for {@link Location}, supporting standard CRUD operations
  23. */
  24. @Resource(name = RestConstants.VERSION_1 + "/location", supportedClass = Location.class, supportedOpenmrsVersions = {
  25. "2.0.*", "2.1.*", "2.2.*", "2.3.*", "2.4.*" })
  26. public class LocationResource2_0 extends LocationResource1_9 {
  27.  
  28. /**
  29. * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation)
  30. */
  31. @Override
  32. public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
  33. DelegatingResourceDescription description = super.getRepresentationDescription(rep);
  34. if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) {
  35. description.addProperty("address7");
  36. description.addProperty("address8");
  37. description.addProperty("address9");
  38. description.addProperty("address10");
  39. description.addProperty("address11");
  40. description.addProperty("address12");
  41. description.addProperty("address13");
  42. description.addProperty("address14");
  43. description.addProperty("address15");
  44. description.addProperty("logo");
  45. }
  46. return description;
  47. }
  48.  
  49. /**
  50. * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties()
  51. */
  52. @Override
  53. public DelegatingResourceDescription getCreatableProperties() {
  54. DelegatingResourceDescription description = super.getCreatableProperties();
  55. description.addProperty("address7");
  56. description.addProperty("address8");
  57. description.addProperty("address9");
  58. description.addProperty("address10");
  59. description.addProperty("address11");
  60. description.addProperty("address12");
  61. description.addProperty("address13");
  62. description.addProperty("address14");
  63. description.addProperty("address15");
  64. description.addProperty("logo");
  65. return description;
  66. }
  67.  
  68. /**
  69. * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties()
  70. */
  71. @Override
  72. public DelegatingResourceDescription getUpdatableProperties() {
  73. return getCreatableProperties();
  74. }
  75.  
  76. /**
  77. * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getResourceVersion()
  78. */
  79. @Override
  80. public String getResourceVersion() {
  81. return RestConstants2_0.RESOURCE_VERSION;
  82. }
  83. }
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement