Skip to content

Commit

Permalink
RAD-375: Order report templates by title
Browse files Browse the repository at this point in the history
RAD-375: Source formatting on PR openmrs#496
  • Loading branch information
acha-bill committed Oct 14, 2016
1 parent 147f96a commit ba184f7
Show file tree
Hide file tree
Showing 21 changed files with 243 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ public class RadiologyConstants {
/**
* {@code GlobalProperty} property for the DICOM UID component used to describe the org root.
*
* <p>Refer to DICOM Standard DICOM PS3.5 Chapter 9 Unique Identifiers.</p>
* <p>
* Refer to DICOM Standard DICOM PS3.5 Chapter 9 Unique Identifiers.
* </p>
*/
public static final String GP_DICOM_UID_ORG_ROOT = "radiology.dicomUIDOrgRoot";

/**
* {@code GlobalProperty} property for the IP address or hostname of the DICOM web viewer which is referred to for external DICOM images.
* {@code GlobalProperty} property for the IP address or hostname of the DICOM web viewer which is referred to for
* external DICOM images.
*
* @see org.openmrs.module.radiology.dicom.DicomWebViewer
*/
Expand All @@ -39,52 +42,61 @@ public class RadiologyConstants {
public static final String GP_DICOM_WEB_VIEWER_PORT = "radiology.dicomWebViewerPort";

/**
* {@code GlobalProperty} property for the base URL of the DICOM web viewer which is referred to for external DICOM images.
* {@code GlobalProperty} property for the base URL of the DICOM web viewer which is referred to for external DICOM
* images.
*
* @see org.openmrs.module.radiology.dicom.DicomWebViewer
*/
public static final String GP_DICOM_WEB_VIEWER_BASE_URL = "radiology.dicomWebViewerBaseUrl";

/**
* {@code GlobalProperty} property for the serverName query parameter of the DICOM web viewer which is referred to for external DICOM images.
* {@code GlobalProperty} property for the serverName query parameter of the DICOM web viewer which is referred to for
* external DICOM images.
*
* @see org.openmrs.module.radiology.dicom.DicomWebViewer
*/
public static final String GP_DICOM_WEB_VIEWER_LOCAL_SERVER_NAME = "radiology.dicomWebViewerLocalServerName";

/**
* {@code GlobalProperty} property for the UUID of the {@code CareSetting} which is used when creating a {@code RadiologyOrder}.
* {@code GlobalProperty} property for the UUID of the {@code CareSetting} which is used when creating a
* {@code RadiologyOrder}.
*/
public static final String GP_RADIOLOGY_CARE_SETTING = "radiology.radiologyCareSetting";

/**
* {@code GlobalProperty} property for the comma separated list of concept class UUIDs which define the orderables for {@code RadiologyOrder's}.
* {@code GlobalProperty} property for the comma separated list of concept class UUIDs which define the orderables for
* {@code RadiologyOrder's}.
*/
public static final String GP_RADIOLOGY_CONCEPT_CLASSES = "radiology.radiologyConceptClasses";

/**
* {@code GlobalProperty} property for the comma separated list of concept class UUIDs which define the reasons for {@code RadiologyOrder's}.
* {@code GlobalProperty} property for the comma separated list of concept class UUIDs which define the reasons for
* {@code RadiologyOrder's}.
*/
public static final String GP_RADIOLOGY_ORDER_REASON_CONCEPT_CLASSES = "radiology.radiologyOrderReasonConceptClasses";

/**
* {@code GlobalProperty} property for the UUID of the {@code OrderType} which is used when creating a {@code RadiologyOrder}.
* {@code GlobalProperty} property for the UUID of the {@code OrderType} which is used when creating a
* {@code RadiologyOrder}.
*/
public static final String GP_RADIOLOGY_TEST_ORDER_TYPE = "radiology.radiologyTestOrderType";

/**
* {@code GlobalProperty} property for the UUID of the {@code EncounterType} which is used when creating a {@code RadiologyOrder}.
* {@code GlobalProperty} property for the UUID of the {@code EncounterType} which is used when creating a
* {@code RadiologyOrder}.
*/
public static final String GP_RADIOLOGY_ORDER_ENCOUNTER_TYPE = "radiology.radiologyOrderEncounterType";

/**
* {@code GlobalProperty} property for the UUID of the {@code EncounterRole} which is used when creating an {@code Encounter} for {@code RadiologyOrder's}.
* {@code GlobalProperty} property for the UUID of the {@code EncounterRole} which is used when creating an
* {@code Encounter} for {@code RadiologyOrder's}.
*/
public static final String GP_RADIOLOGY_ORDERING_PROVIDER_ENCOUNTER_ROLE =
"radiology.radiologyOrderingProviderEncounterRole";

/**
* {@code GlobalProperty} property for the UUID of the {@code VisitType} which can be used to create radiology {@code Visit's}.
* {@code GlobalProperty} property for the UUID of the {@code VisitType} which can be used to create radiology
* {@code Visit's}.
*/
public static final String GP_RADIOLOGY_VISIT_TYPE = "radiology.radiologyVisitType";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public interface RadiologyModalityService extends OpenmrsService {

/**
* Retires an existing {@code RadiologyModality}.
* <p>This effectively removes the modality from circulation or use.</p>
* <p>
* This effectively removes the modality from circulation or use.
* </p>
*
* @param radiologyModality the radiology modality to retire
* @param reason the reason why to retire the radiology modality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
/**
* Search parameter object for {@link RadiologyOrder}'s.
*
* <p>Typical usage involves:
* <p>
* Typical usage involves:
* <ol>
* <li>Set the various search criteria parameters through the respective methods of the static builder class
* ({@link Builder#withPatient(Patient)}, {@link Builder#includeVoided()}, {@link Builder#withUrgency(Urgency)},
* ({@link Builder#withPatient(Patient)}, {@link Builder#includeVoided()}, {@link Builder#withUrgency(Urgency)},
* {@link Builder#fromEffectiveStartDate(Date)}, {@link Builder#toEffectiveStartDate(Date)},
* {@link Builder#withAccessionNumber(String)} and {@link Builder#withOrderer(Provider)}).</li>
* <li>Build the {@link RadiolologyOrderSearchCriteria} instance with the {@link Builder#build()} method.</li>
Expand Down Expand Up @@ -194,10 +195,13 @@ public Builder withOrderer(Provider orderer) {
*
* @return a new search criteria instance
* @should create a new radiology order search criteria instance with patient if patient is set
* @should create a new radiology order search criteria instance with include voided set to true if voided orders should be included
* @should create a new radiology order search criteria instance with include voided set to true if voided orders
* should be included
* @should create a new radiology order search criteria instance with urgency if urgency is set
* @should create a new radiology order search criteria instance with from effective start date if from effective start date is set
* @should create a new radiology order search criteria instance with to effective start date if to effective start date is set
* @should create a new radiology order search criteria instance with from effective start date if from effective
* start date is set
* @should create a new radiology order search criteria instance with to effective start date if to effective start
* date is set
* @should create a new radiology order search criteria instance with accession number if accession number is set
* @should create a new radiology order search criteria instance with orderer if orderer is set
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
/**
* Search parameter object for {@link RadiologyReport}'s.
*
* <p>Typical usage involves:
* <p>
* Typical usage involves:
* <ol>
* <li>Set the various search criteria parameters through the respective methods of the static builder class
* ({@link Builder#fromDate(Date)}, {@link Builder#toDate(Date)}, {@link Builder#withPrincipalResultsInterpreter(Provider)},
* ({@link Builder#fromDate(Date)}, {@link Builder#toDate(Date)}, {@link Builder#withPrincipalResultsInterpreter(Provider)},
* {@link Builder#includeVoided()} and {@link Builder#withStatus(RadiologyReportStatus)}).</li>
* <li>Build the {@link RadiolologyReportSearchCriteria} instance with the {@link Builder#build()} method.</li>
* <li>Get the search parameters through the getter methods (such as {@link #getFromDate()} or {@link #getStatus()}).</li>
Expand Down Expand Up @@ -148,10 +149,14 @@ public Builder withStatus(RadiologyReportStatus status) {
* Create an {@link RadiologyReportSearchCriteria} with the properties of this builder instance.
*
* @return a new search criteria instance
* @should create a new radiology report search criteria instance with from and to date specified if date from and date to are set
* @should create a new radiology report search criteria instance with principal results interpreter specified if principal results interpreter is set
* @should create a new radiology report search criteria instance with include voided set to true if voided reports should be included
* @should create a new radiology report search criteria instance with report status specified if status is set to claimed or completed
* @should create a new radiology report search criteria instance with from and to date specified if date from and
* date to are set
* @should create a new radiology report search criteria instance with principal results interpreter specified if
* principal results interpreter is set
* @should create a new radiology report search criteria instance with include voided set to true if voided reports
* should be included
* @should create a new radiology report search criteria instance with report status specified if status is set to
* claimed or completed
*/
public RadiologyReportSearchCriteria build() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@
/**
* Service layer for {@code RadiologyReport}.
*
* <p>Typical usage involves:
* <p>
* Typical usage involves:
* <ol>
* <li>Create a new {@code RadiologyReport} for a completed {@code RadiologyOrder}.
* <pre>{@code
* RadiologyReport radiologyReport = RadiologyReportService.createRadiologyReport(RadiologyOrder);
* }</pre>
*
* <pre>
*
* {
* &#64;code
* RadiologyReport radiologyReport = RadiologyReportService.createRadiologyReport(RadiologyOrder);
* }
* </pre>
*
* </li>
* <li>Set fields like for example {@code radiologyReport.setBody("Fracture of around 5mm visible in right tibia.")} through the setters of {@link RadiologyReport}.</li>
* <li>Set fields like for example {@code radiologyReport.setBody("Fracture of around 5mm visible in right tibia.")} through
* the setters of {@link RadiologyReport}.</li>
* <li>Optionally, save the {@code RadiologyReport} as a draft via {@link #saveRadiologyReportDraft(RadiologyReport)}.</li>
* <li>Optionally, void the {@code RadiologyReport} via {@link #voidRadiologyReport(RadiologyReport, String)}.</li>
* <li>Finally, complete the {@code RadiologyReport} via {@link #saveRadiologyReport(RadiologyReport)}.</li>
Expand Down Expand Up @@ -61,6 +69,7 @@ public interface RadiologyReportService extends OpenmrsService {
* <p>
* A {@code RadiologyReport} is considered a draft as long as its status is {@code DRAFT}.
* </p>
*
* @param radiologyReport the existing radiology report to be saved
* @return the saved radiology report
* @throws IllegalArgumentException if given null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public enum RadiologyReportStatus {
*/
COMPLETED,
/**
* The report is in draft state right after creation by a physician and as long as it is being worked on and not yet released.
* The report is in draft state right after creation by a physician and as long as it is being worked on and not yet
* released.
*/
DRAFT,
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

/**
Expand Down Expand Up @@ -76,6 +77,7 @@ public List<MrrtReportTemplate> getMrrtReportTemplates(MrrtReportTemplateSearchC

final Criteria crit = sessionFactory.getCurrentSession()
.createCriteria(MrrtReportTemplate.class);
crit.addOrder(Order.asc("dcTermsTitle"));

if (searchCriteria.getTitle() != null) {
crit.add(Restrictions.ilike("dcTermsTitle", searchCriteria.getTitle() + "%", MatchMode.ANYWHERE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public MetaTagsValidationEngine() {
* @should return validation result with no errors if subject passes all checks
* @should return validation result with error for meta element charset attribute if not present in subject
* @should return validation result with error for meta element charset attribute if present more than once in subject
* @should return validation result with error for meta element dublin core if no meta element with name attribute is present in subject
* @should return validation result with error for meta element dublin core if no meta element with name attribute is
* present in subject
*/
@Override
public ValidationResult run(Elements subject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ public interface MrrtReportTemplateService extends OpenmrsService {


/**
* Saves a new {@code MrrtReportTemplate}.
*
* @param template the mrrt report template to be saved
* @return the saved template
* @throws IllegalArgumentException if given null
* @throws APIException if saving an already saved template
* @should throw illegal argument exception if given null
* @should save given template
* @should throw api exception if saving template that already exists
* @should save template object with terms if matching concept reference term was found
*/
* Saves a new {@code MrrtReportTemplate}.
*
* @param template the mrrt report template to be saved
* @return the saved template
* @throws IllegalArgumentException if given null
* @throws APIException if saving an already saved template
* @should throw illegal argument exception if given null
* @should save given template
* @should throw api exception if saving template that already exists
* @should save template object with terms if matching concept reference term was found
*/
@Authorized(RadiologyPrivileges.ADD_RADIOLOGY_REPORT_TEMPLATES)
public MrrtReportTemplate saveMrrtReportTemplate(MrrtReportTemplate template);

/**
* Import an {@code MrrtReportTemplate} into the system.
* <p>
* This means metadata like title, description, date, license, creator, ... is stored in an {@code MrrtReportTemplate} in the database with a link to the template file which is stored on the filesystem.
* This means metadata like title, description, date, license, creator, ... is stored in an {@code MrrtReportTemplate} in
* the database with a link to the template file which is stored on the filesystem.
* </p>
* Calls {@link #saveMrrtReportTemplate(MrrtReportTemplate)} to store an {@code MrrtReportTemplate} in the database.
*
Expand Down Expand Up @@ -110,6 +111,7 @@ public interface MrrtReportTemplateService extends OpenmrsService {

/**
* Get all {@code MrrtReportTemplate's} matching a variety of (nullable) criteria.
* Returns results ordered by dcTermsTitle.
*
* @param mrrtReportTemplateSearchCriteria the object containing search parameters
* @return the mrrt report templates matching the given criteria
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public interface MrrtReportTemplateValidator {
* @should throw api exception if template attributes element does not have a coded content element
* @should throw api exception if template attributes element has more than one coded content element
* @should throw api exception if html element does not have a body element
* @should throw api exception if html element has more than one body element
* @should throw api exception if html element has more than one body element
* @should catch all violation errors and throw an mrrt report template exception
*/
public void validate(String mrrtTemplate) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public List<ValidationError> getErrors() {

/**
* Creates a new instance of {@link ValidationResult}.
*
* @should create a new validation result initializing errors
*/
public ValidationResult() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public void setUp() throws Exception {
}

/**
* @see RadiologyModalityEditor#setAsText(String)
* @verifies set value to radiology modality whos id matches given text
*/
* @see RadiologyModalityEditor#setAsText(String)
* @verifies set value to radiology modality whos id matches given text
*/
@Test
public void setAsText_shouldSetValueToRadiologyModalityWhosIdMatchesGivenText() throws Exception {
RadiologyModalityEditor editor = new RadiologyModalityEditor();
Expand All @@ -58,9 +58,9 @@ public void setAsText_shouldSetValueToRadiologyModalityWhosIdMatchesGivenText()
}

/**
* @see RadiologyModalityEditor#setAsText(String)
* @verifies set value to radiology modality whos uuid matches given text
*/
* @see RadiologyModalityEditor#setAsText(String)
* @verifies set value to radiology modality whos uuid matches given text
*/
@Test
public void setAsText_shouldSetValueToRadiologyModalityWhosUuidMatchesGivenText() throws Exception {
RadiologyModalityEditor editor = new RadiologyModalityEditor();
Expand All @@ -71,9 +71,9 @@ public void setAsText_shouldSetValueToRadiologyModalityWhosUuidMatchesGivenText(
}

/**
* @see RadiologyModalityEditor#setAsText(String)
* @verifies throw illegal argument exception for radiology modality not found
*/
* @see RadiologyModalityEditor#setAsText(String)
* @verifies throw illegal argument exception for radiology modality not found
*/
@Test
public void setAsText_shouldThrowIllegalArgumentExceptionForRadiologyModalityNotFound() throws Exception {

Expand All @@ -84,9 +84,9 @@ public void setAsText_shouldThrowIllegalArgumentExceptionForRadiologyModalityNot
}

/**
* @see RadiologyModalityEditor#setAsText(String)
* @verifies return null for empty text
*/
* @see RadiologyModalityEditor#setAsText(String)
* @verifies return null for empty text
*/
@Test
public void setAsText_shouldReturnNullForEmptyText() throws Exception {

Expand All @@ -96,9 +96,9 @@ public void setAsText_shouldReturnNullForEmptyText() throws Exception {
}

/**
* @see RadiologyModalityEditor#getAsText()
* @verifies return empty string if value does not contain a radiology modality
*/
* @see RadiologyModalityEditor#getAsText()
* @verifies return empty string if value does not contain a radiology modality
*/
@Test
public void getAsText_shouldReturnEmptyStringIfValueDoesNotContainARadiologyModality() throws Exception {

Expand All @@ -108,9 +108,9 @@ public void getAsText_shouldReturnEmptyStringIfValueDoesNotContainARadiologyModa
}

/**
* @see RadiologyModalityEditor#getAsText()
* @verifies return radiology modality id if value does contain a radiology modality
*/
* @see RadiologyModalityEditor#getAsText()
* @verifies return radiology modality id if value does contain a radiology modality
*/
@Test
public void getAsText_shouldReturnRadiologyModalityIdIfValueDoesContainARadiologyModality() throws Exception {

Expand Down
Loading

0 comments on commit ba184f7

Please sign in to comment.