Skip to content

Commit

Permalink
Trunk-5653:Add order group reason to order group (openmrs#2984)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcliff authored and dkayiwa committed Dec 9, 2019
1 parent 5047aec commit c24475b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
24 changes: 24 additions & 0 deletions api/src/main/java/org/openmrs/OrderGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class OrderGroup extends BaseChangeableOpenmrsData {
private OrderSet orderSet;

private OrderGroup parentOrderGroup;

private Concept orderGroupReason;
/**
* Gets the orderGroupId
*
Expand Down Expand Up @@ -228,4 +230,26 @@ public OrderGroup getParentOrderGroup() {
public void setParentOrderGroup(OrderGroup parentOrderGroup) {
this.parentOrderGroup = parentOrderGroup;
}

/**
* Gets the order group reason which denotes the reason why the group was
* ordered
*
* @param Returns the order group reason
* @since 2.4.0
*/
public Concept getOrderGroupReason() {
return orderGroupReason;
}

/**
* Sets the order group reason which denotes the reason why the group was
* ordered
*
* @param orderGroupReason, the order group reason to set
* @since 2.4.0
*/
public void setOrderGroupReason(Concept orderGroupReason) {
this.orderGroupReason = orderGroupReason;
}
}
47 changes: 47 additions & 0 deletions api/src/main/resources/liquibase-update-to-2.4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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:https://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http:https://openmrs.org/license.
Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
-->
<!--
This file contains all changesets that have been introduced on top of liquibase-update-to-2.0.xml exclusively.
If you intend for a changeset to be backported to older releases, you must put such a changeset in the
liquibase-update-to-2.0.xml, which have been used for older releases.
-->
<databaseChangeLog logicalFilePath="liquibase-update-to-latest.xml" xmlns="http:https://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" xmlns:ext="http:https://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http:https://www.liquibase.org/xml/ns/dbchangelog http:https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd
http:https://www.liquibase.org/xml/ns/dbchangelog-ext http:https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

<!--
See http:https://www.liquibase.org/manual/home#available_database_refactorings
for a list of supported elements and attributes
-->

<changeSet id="20190815-Trunk-5412" author="gitacliff">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="order_group" columnName="order_group_reason"/>
</not>
</preConditions>
<comment>Adding "order_group_reason" column to order_group table</comment>
<addColumn tableName="order_group">
<column name="order_group_reason" type="int">
<constraints nullable="true"/>
</column>
</addColumn>
<addForeignKeyConstraint baseTableName="order_group"
baseColumnNames="order_group_reason"
constraintName="order_group_order_group_reason_fk"
referencedTableName="concept"
referencedColumnNames="concept_id" />
</changeSet>
</databaseChangeLog>

3 changes: 2 additions & 1 deletion api/src/main/resources/liquibase-update-to-latest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
<include file="liquibase-update-to-2.1.xml"/>
<include file="liquibase-update-to-2.2.xml"/>
<include file="liquibase-update-to-2.3.xml"/>
<include file="liquibase-update-to-2.4.xml"/>

</databaseChangeLog>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
column="uuid" length="38" unique="true" not-null="true"/>
<many-to-one name="parentOrderGroup" class="org.openmrs.OrderGroup"
not-null="false" column="parent_order_group" />
<many-to-one name="orderGroupReason" class="org.openmrs.Concept"
not-null="false" column="order_group_reason" />
</class>

</hibernate-mapping>

0 comments on commit c24475b

Please sign in to comment.