-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1860 from samshuster/TRUNK-4696
TRUNK-4696: added specific exception classes for the Order Service
- Loading branch information
Showing
13 changed files
with
362 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...c/main/java/org/openmrs/api/order/exceptions/CannotDeleteOrderPropertyInUseException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when trying to delete an order property that is still in use. | ||
*/ | ||
public class CannotDeleteOrderPropertyInUseException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121221L; | ||
|
||
private CannotDeleteOrderPropertyInUseException(String message) { | ||
super(message); | ||
} | ||
|
||
public static CannotDeleteOrderPropertyInUseException withProperty(String property) { | ||
return new CannotDeleteOrderPropertyInUseException(String.format("Order.%s.cannot.delete", property)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../org/openmrs/api/order/exceptions/CannotDiscontinueAlreadyDiscontinuedOrderException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when the Order has already been discontinued. | ||
*/ | ||
public class CannotDiscontinueAlreadyDiscontinuedOrderException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121214L; | ||
|
||
public CannotDiscontinueAlreadyDiscontinuedOrderException() { | ||
super("Order.stopped.cannot.discontinued"); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...main/java/org/openmrs/api/order/exceptions/CannotDiscontinueOrderWithActionException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import static org.openmrs.Order.Action.DISCONTINUE; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown with trying to discontinue an order with a specific action that cannot be discontinued. | ||
*/ | ||
public class CannotDiscontinueOrderWithActionException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121215L; | ||
|
||
public CannotDiscontinueOrderWithActionException() { | ||
super("Order.action.cannot.discontinued", new Object[] { DISCONTINUE }); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...c/main/java/org/openmrs/api/order/exceptions/CannotEditAlreadyExistingOrderException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when the OrderAlreadyExists. | ||
*/ | ||
public class CannotEditAlreadyExistingOrderException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121213L; | ||
|
||
public CannotEditAlreadyExistingOrderException() { | ||
super("Order.cannot.edit.existing"); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
teleivo
Member
|
||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...src/main/java/org/openmrs/api/order/exceptions/CannotEditOrderPropertyInUseException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when trying to edit an order property which is still in use. | ||
*/ | ||
public class CannotEditOrderPropertyInUseException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121220L; | ||
|
||
private CannotEditOrderPropertyInUseException(String message) { | ||
super(message); | ||
} | ||
|
||
public static CannotEditOrderPropertyInUseException withProperty(String property) { | ||
return new CannotEditOrderPropertyInUseException(String.format("Order.%s.cannot.edit", property)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...a/org/openmrs/api/order/exceptions/CannotStopRetrospectiveDiscontinuedOrderException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when trying to stop a retrospective discontinued order. | ||
*/ | ||
public class CannotStopRetrospectiveDiscontinuedOrderException extends APIException { | ||
|
||
public static final long serialVersionUID = 22221215L; | ||
|
||
public CannotStopRetrospectiveDiscontinuedOrderException() { | ||
super("Order.retrospective.stopped.cannot.discontinued"); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
api/src/main/java/org/openmrs/api/order/exceptions/CannotUnvoidOrderException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when an attempt to unvoid an order fails. | ||
*/ | ||
public class CannotUnvoidOrderException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121315L; | ||
|
||
public CannotUnvoidOrderException(String action) { | ||
super("Order.action.cannot.unvoid", new Object[] { action }); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../main/java/org/openmrs/api/order/exceptions/EditedOrderDoesNotMatchPreviousException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.api.order.exceptions; | ||
|
||
import org.openmrs.api.APIException; | ||
|
||
/** | ||
* Thrown when the new edited order contains modified properties that must be the same as previous order. | ||
*/ | ||
public class EditedOrderDoesNotMatchPreviousException extends APIException { | ||
|
||
public static final long serialVersionUID = 22121218L; | ||
|
||
public EditedOrderDoesNotMatchPreviousException(String message) { | ||
super(message); | ||
} | ||
|
||
public EditedOrderDoesNotMatchPreviousException(String message, Object[] params) { | ||
super(message, params); | ||
} | ||
} |
Oops, something went wrong.
@wluyima so I assume you are going to change this on all these occurences to the localized calls? :)