Skip to content

Commit 3eb8123

Browse files
committedJun 26, 2013
Applying auto format changes
1 parent 77b80d9 commit 3eb8123

File tree

9 files changed

+87
-86
lines changed

9 files changed

+87
-86
lines changed
 

‎api/src/main/java/org/openmrs/api/OrderService.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,26 @@ public static enum ORDER_STATUS {
152152
*/
153153
@Authorized(PrivilegeConstants.PURGE_ORDERS)
154154
public void purgeOrder(Order order) throws APIException;
155-
156-
/**
157-
* Completely delete an order from the database. This should not typically be used unless
158-
* desperately needed. Most orders should just be voided. See {@link #voidOrder(Order, String)}
159-
* This method is different from purgeOrder(Order order) above:
160-
* If param cascade is false will completely delete an order from the database period
161-
* If param cascade is true will completely delete an order from the database and delete any
162-
* Obs that references the Order.
163-
*
164-
* @param order The Order to remove from the system
165-
* @param cascade
166-
* @throws APIException
167-
* @since 1.9.4
168-
* @should delete order
169-
* @should delete order when cascade is false
170-
* @should delete order when cascade is true and also delete any Obs that references it
171-
*
172-
*/
173-
@Authorized(PrivilegeConstants.PURGE_ORDERS)
174-
public void purgeOrder(Order order, boolean cascade) throws APIException;
155+
156+
/**
157+
* Completely delete an order from the database. This should not typically be used unless
158+
* desperately needed. Most orders should just be voided. See {@link #voidOrder(Order, String)}
159+
* This method is different from purgeOrder(Order order) above:
160+
* If param cascade is false will completely delete an order from the database period
161+
* If param cascade is true will completely delete an order from the database and delete any
162+
* Obs that references the Order.
163+
*
164+
* @param order The Order to remove from the system
165+
* @param cascade
166+
* @throws APIException
167+
* @since 1.9.4
168+
* @should delete order
169+
* @should delete order when cascade is false
170+
* @should delete order when cascade is true and also delete any Obs that references it
171+
*
172+
*/
173+
@Authorized(PrivilegeConstants.PURGE_ORDERS)
174+
public void purgeOrder(Order order, boolean cascade) throws APIException;
175175

176176
/**
177177
* Mark an order as voided. This functionally removes the Order from the system while keeping a

‎api/src/main/java/org/openmrs/api/context/ServiceContext.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ public void setModuleService(List<Object> params) {
818818
+ cls.getClass().getClassLoader().hashCode());
819819
//pay attention that here, cls = Class.forName(classString), the system class loader and
820820
//cls2 is the openmrs class loader, like above.
821-
log.debug("cls==cls2: " + String.valueOf(cls ==
822-
OpenmrsClassLoader.getInstance().loadClass(classString)));
821+
log.debug("cls==cls2: "
822+
+ String.valueOf(cls == OpenmrsClassLoader.getInstance().loadClass(classString)));
823823
}
824824
}
825825
catch (Exception e) { /*pass*/}

‎api/src/main/java/org/openmrs/api/db/OrderDAO.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public <Ord extends Order> List<Ord> getOrders(Class<Ord> orderClassType, List<P
9898
* @return
9999
*/
100100
public OrderType getOrderTypeByUuid(String uuid);
101-
102-
/**
103-
* Delete Obs that references an order
104-
*/
105-
public void deleteObsThatReference(Order order);
101+
102+
/**
103+
* Delete Obs that references an order
104+
*/
105+
public void deleteObsThatReference(Order order);
106106

107107
}

‎api/src/main/java/org/openmrs/api/db/hibernate/HibernateOrderDAO.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ public OrderType getOrderTypeByUuid(String uuid) {
192192
return (OrderType) sessionFactory.getCurrentSession().createQuery("from OrderType ot where ot.uuid = :uuid")
193193
.setString("uuid", uuid).uniqueResult();
194194
}
195-
196-
/**
197-
* Delete Obs that references (deleted) Order
198-
*/
199-
public void deleteObsThatReference(Order order) {
200-
if (order != null) {
201-
sessionFactory.getCurrentSession().createQuery("delete Obs where order = :order").setParameter("order", order)
202-
.executeUpdate();
203-
}
204-
}
195+
196+
/**
197+
* Delete Obs that references (deleted) Order
198+
*/
199+
public void deleteObsThatReference(Order order) {
200+
if (order != null) {
201+
sessionFactory.getCurrentSession().createQuery("delete Obs where order = :order").setParameter("order", order)
202+
.executeUpdate();
203+
}
204+
}
205205

206206
}

‎api/src/main/java/org/openmrs/api/impl/OrderServiceImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public void purgeOrder(Order order) throws APIException {
113113
*/
114114
public void purgeOrder(Order order, boolean cascade) throws APIException {
115115
if (cascade) {
116-
dao.deleteObsThatReference(order);
117-
}
116+
dao.deleteObsThatReference(order);
117+
}
118118

119119
dao.deleteOrder(order);
120120
}

‎api/src/main/java/org/openmrs/reporting/export/DataExportReportObject.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ public Cohort generatePatientSet(EvaluationContext context) {
191191
if (getPatientIds() != null && getPatientIds().size() > 0) {
192192
cohort = new Cohort(getPatientIds());
193193
}
194-
195-
if (location != null) {
194+
195+
if (location != null) {
196196
cohort = intersectFast(cohort, pss.getPatientsHavingLocation(getLocation()));
197197
}
198198

‎api/src/test/java/org/openmrs/api/OrderServiceTest.java

+42-42
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
public class OrderServiceTest extends BaseContextSensitiveTest {
3434

3535
protected static final String DRUG_ORDERS_DATASET_XML = "org/openmrs/api/include/OrderServiceTest-drugOrdersList.xml";
36-
36+
3737
/**
3838
* @see {@link OrderService#saveOrder(Order)}
3939
*/
@@ -45,7 +45,7 @@ public void saveOrder_shouldNotSaveOrderIfOrderDoesntValidate() throws Exception
4545
order.setPatient(null);
4646
orderService.saveOrder(order);
4747
}
48-
48+
4949
/**
5050
* @see {@link OrderService#getOrderByUuid(String)}
5151
*
@@ -57,7 +57,7 @@ public void getOrderByUuid_shouldFindObjectGivenValidUuid() throws Exception {
5757
Order order = Context.getOrderService().getOrderByUuid(uuid);
5858
Assert.assertEquals(1, (int) order.getOrderId());
5959
}
60-
60+
6161
/**
6262
* @see {@link OrderService#getOrderByUuid(String)}
6363
*
@@ -67,7 +67,7 @@ public void getOrderByUuid_shouldFindObjectGivenValidUuid() throws Exception {
6767
public void getOrderByUuid_shouldReturnNullIfNoObjectFoundWithGivenUuid() throws Exception {
6868
Assert.assertNull(Context.getOrderService().getOrderByUuid("some invalid uuid"));
6969
}
70-
70+
7171
/**
7272
* @see {@link OrderService#getOrderTypeByUuid(String)}
7373
*
@@ -79,7 +79,7 @@ public void getOrderTypeByUuid_shouldFindObjectGivenValidUuid() throws Exception
7979
OrderType orderType = Context.getOrderService().getOrderTypeByUuid(uuid);
8080
Assert.assertEquals(1, (int) orderType.getOrderTypeId());
8181
}
82-
82+
8383
/**
8484
* @see {@link OrderService#getOrderTypeByUuid(String)}
8585
*
@@ -89,7 +89,7 @@ public void getOrderTypeByUuid_shouldFindObjectGivenValidUuid() throws Exception
8989
public void getOrderTypeByUuid_shouldReturnNullIfNoObjectFoundWithGivenUuid() throws Exception {
9090
Assert.assertNull(Context.getOrderService().getOrderTypeByUuid("some invalid uuid"));
9191
}
92-
92+
9393
/**
9494
* @see {@link OrderService#saveOrder(Order)}
9595
*/
@@ -99,16 +99,16 @@ public void saveOrder_shouldSaveDiscontinuedReasonNonCoded() throws Exception {
9999
String uuid = "921de0a3-05c4-444a-be03-e01b4c4b9142";
100100
Order order = Context.getOrderService().getOrderByUuid(uuid);
101101
String discontinuedReasonNonCoded = "Non coded discontinued reason";
102-
102+
103103
order.setDiscontinuedReasonNonCoded(discontinuedReasonNonCoded);
104104
OrderService orderService = Context.getOrderService();
105105
orderService.saveOrder(order);
106-
106+
107107
order = Context.getOrderService().getOrderByUuid(uuid);
108-
108+
109109
Assert.assertEquals(discontinuedReasonNonCoded, order.getDiscontinuedReasonNonCoded());
110110
}
111-
111+
112112
/**
113113
* @see {@link OrderService#getDrugOrdersByPatient(Patient, ORDER_STATUS, boolean)}
114114
*/
@@ -121,43 +121,43 @@ public void getDrugOrdersByPatient_shouldReturnListOfDrugOrdersWithGivenStatus()
121121
Boolean.FALSE);
122122
Assert.assertEquals(4, drugOrders.size());
123123
}
124-
124+
125125
@Test
126126
public void voidDrugSet_shouldNotVoidThePatient() throws Exception {
127127
Patient p = Context.getPatientService().getPatient(2);
128128
Assert.assertFalse(p.isVoided());
129129
Context.getOrderService().voidDrugSet(p, "1", "Reason", OrderService.SHOW_ALL);
130130
Assert.assertFalse(p.isVoided());
131131
}
132-
133-
@Test
134-
public void purgeOrder_shouldDeleteObsThatReference() throws Exception {
135-
executeDataSet("org/openmrs/api/include/OrderServiceTest-deleteObsThatReference.xml");
136-
final String ordUuid = "0c96f25c-4949-4f72-9931-d808fbcdb612";
137-
final String obsUuid = "be3a4d7a-f9ab-47bb-aaad-bc0b452fcda4";
138-
ObsService os = Context.getObsService();
139-
OrderService service = Context.getOrderService();
140-
141-
Obs obs = os.getObsByUuid(obsUuid);
142-
Assert.assertNotNull(obs);
143-
144-
Order order = service.getOrderByUuid(ordUuid);
145-
Assert.assertNotNull(order);
146-
147-
//sanity check to ensure that the obs and order are actually related
148-
Assert.assertEquals(order, obs.getOrder());
149-
150-
//Ensure that passing false does not delete the related obs
151-
service.purgeOrder(order, false);
152-
Assert.assertNotNull(os.getObsByUuid(obsUuid));
153-
154-
service.purgeOrder(order, true);
155-
156-
//Ensure that actually the order got purged
157-
Assert.assertNull(service.getOrderByUuid(ordUuid));
158-
159-
//Ensure that the related obs got deleted
160-
Assert.assertNull(os.getObsByUuid(obsUuid));
161-
162-
}
132+
133+
@Test
134+
public void purgeOrder_shouldDeleteObsThatReference() throws Exception {
135+
executeDataSet("org/openmrs/api/include/OrderServiceTest-deleteObsThatReference.xml");
136+
final String ordUuid = "0c96f25c-4949-4f72-9931-d808fbcdb612";
137+
final String obsUuid = "be3a4d7a-f9ab-47bb-aaad-bc0b452fcda4";
138+
ObsService os = Context.getObsService();
139+
OrderService service = Context.getOrderService();
140+
141+
Obs obs = os.getObsByUuid(obsUuid);
142+
Assert.assertNotNull(obs);
143+
144+
Order order = service.getOrderByUuid(ordUuid);
145+
Assert.assertNotNull(order);
146+
147+
//sanity check to ensure that the obs and order are actually related
148+
Assert.assertEquals(order, obs.getOrder());
149+
150+
//Ensure that passing false does not delete the related obs
151+
service.purgeOrder(order, false);
152+
Assert.assertNotNull(os.getObsByUuid(obsUuid));
153+
154+
service.purgeOrder(order, true);
155+
156+
//Ensure that actually the order got purged
157+
Assert.assertNull(service.getOrderByUuid(ordUuid));
158+
159+
//Ensure that the related obs got deleted
160+
Assert.assertNull(os.getObsByUuid(obsUuid));
161+
162+
}
163163
}

‎web/src/main/java/org/openmrs/web/WebDaemon.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public class WebDaemon extends Daemon {
3333
*
3434
* @param servletContext the servlet context.
3535
*/
36-
public static void startOpenmrs(final ServletContext servletContext) throws DatabaseUpdateException, InputRequiredException {
36+
public static void startOpenmrs(final ServletContext servletContext) throws DatabaseUpdateException,
37+
InputRequiredException {
3738

3839
// create a new thread and execute that task in it
3940
DaemonThread startOpenmrsThread = new DaemonThread() {

‎web/src/main/java/org/openmrs/web/filter/initialization/InitializationFilter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ public void executing(ChangeSet changeSet, int numChangeSetsToRun) {
15721572

15731573
// start openmrs
15741574
try {
1575-
WebDaemon.startOpenmrs(filterConfig.getServletContext());
1575+
WebDaemon.startOpenmrs(filterConfig.getServletContext());
15761576
}
15771577
catch (DatabaseUpdateException updateEx) {
15781578
log.warn("Error while running the database update file", updateEx);
@@ -1607,7 +1607,7 @@ public void executing(ChangeSet changeSet, int numChangeSetsToRun) {
16071607

16081608
// TODO catch openmrs errors here and drop the user back out to the setup screen
16091609

1610-
Context.openSession();
1610+
Context.openSession();
16111611

16121612
if (!wizardModel.implementationId.equals("")) {
16131613
try {

0 commit comments

Comments
 (0)
Please sign in to comment.