Skip to content

Commit

Permalink
response to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
slubwama committed Jun 13, 2024
1 parent 67b90a2 commit c0e5447
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 299 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.openmrs.module.webservices.rest.web.annotation.SubResource;
import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
import org.openmrs.module.webservices.rest.web.response.ResponseException;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.BaseAttributeCrudResource1_9;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2.OrderResource2_2;

import java.util.List;
Expand All @@ -29,7 +30,7 @@
*/
@SubResource(parent = OrderResource2_5.class, path = "attribute", supportedClass = OrderAttribute.class, supportedOpenmrsVersions = {
"2.5.* - 9.*"})
public class OrderAttributeResource2_5 extends BaseAttributeCrudResource2_5<OrderAttribute, Order, OrderResource2_5> {
public class OrderAttributeResource2_5 extends BaseAttributeCrudResource1_9<OrderAttribute, Order, OrderResource2_5> {

/**
* Sets attributeType on the given OrderAttribute.
Expand Down Expand Up @@ -91,18 +92,16 @@ public NeedsPaging<OrderAttribute> doGetAll(Order parent, RequestContext context
public OrderAttribute save(OrderAttribute delegate) {
// make sure it has not already been added to the order
boolean needToAdd = true;
for (OrderAttribute orderAttribute : delegate.getOrder().getActiveAttributes()) {
if (orderAttribute.equals(delegate)) {
needToAdd = false;
break;
}
if (delegate.getOrder().getActiveAttributes().contains(delegate)) {
delegate.getOrder().addAttribute(delegate);
}
if (needToAdd) {
delegate.getOrder().addAttribute(delegate);
}
OrderContext orderContext = new OrderContext();
orderContext.setCareSetting(delegate.getOrder().getCareSetting());
orderContext.setOrderType(delegate.getOrder().getOrderType());
delegate.getOrder().setAction(Order.Action.REVISE);

Context.getOrderService().saveOrder(delegate.getOrder(), orderContext);
return delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
import org.openmrs.module.webservices.rest.web.response.ResponseException;
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.BaseAttributeTypeCrudResource1_9;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -27,7 +28,7 @@
*/
@Resource(name = RestConstants.VERSION_1 + "/orderattributetype", supportedClass = OrderAttributeType.class, supportedOpenmrsVersions = {
"2.5.* - 9.*" })
public class OrderAttributeTypeResource2_5 extends BaseAttributeTypeCrudResource2_5<OrderAttributeType> {
public class OrderAttributeTypeResource2_5 extends BaseAttributeTypeCrudResource1_9<OrderAttributeType> {

public OrderAttributeTypeResource2_5() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@


/**
* Tests functionality of {@link OrderAttributeController}.
* Tests functionality of {@link OrderController}.
*/
public class OrderAttributeController2_5Test extends MainResourceControllerTest {
public class OrderController2_5Test extends MainResourceControllerTest {

private OrderService service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_5;

import org.junit.Before;
import org.openmrs.Order;
import org.openmrs.api.context.Context;

import org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest;
import org.openmrs.module.webservices.rest.web.v1_0.resource.RestTestConstants2_5;

public class OrderResource2_5Test extends BaseDelegatingResourceTest<OrderResource2_5, Order> {

@Before
public void before() throws Exception {
executeDataSet(RestTestConstants2_5.TEST_DATASET);
}

@Override
public Order newObject() {
Expand All @@ -30,7 +36,7 @@ public void validateFullRepresentation() throws Exception {

@Override
public String getDisplayProperty() {
return "CD4 COUNT";
return "ASPIRIN";
}

@Override
Expand Down

0 comments on commit c0e5447

Please sign in to comment.