Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions api/src/main/java/org/openmrs/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,52 @@
import java.util.List;
import java.util.Set;

import jakarta.persistence.AttributeOverride;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;

/**
* Form
*
* @version 1.0
*/
@Audited
@Entity
@Table(name = "form")
@AttributeOverride(name="description", column = @Column(name = "description", length = 1024))
public class Form extends BaseChangeableOpenmrsMetadata {

public static final long serialVersionUID = 845634L;

// Fields

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "form_id")
private Integer formId;


@Column(name = "version", nullable = false, length = 50)
private String version;

@Column(name = "build", nullable = true)
private Integer build;

@Column(name = "published", length = 1)
private Boolean published = false;


@ManyToOne
@JoinColumn(name = "encounter_type")
private EncounterType encounterType;


@OneToMany(mappedBy = "form", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
private Set<FormField> formFields;

// Constructors
Expand Down Expand Up @@ -231,4 +255,4 @@ public void setId(Integer id) {
setFormId(id);

}
}
}
1 change: 0 additions & 1 deletion api/src/main/resources/hibernate.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<mapping resource="org/openmrs/api/db/hibernate/DiagnosisAttributeType.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/Field.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/FieldType.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/Form.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/FormField.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/GlobalProperty.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/Obs.hbm.xml" />
Expand Down
83 changes: 0 additions & 83 deletions api/src/main/resources/org/openmrs/api/db/hibernate/Form.hbm.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
</column>
<column name="retired_by" type="int"/>
<column name="date_retired" type="DATETIME"/>
<column name="retired_reason" type="varchar(255)"/>
<column name="retire_reason" type="varchar(255)"/>
<column name="uuid" type="char(38)" />
</createTable>
<modifySql dbms="mssql">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@
</column>
<column name="retired_by" type="INT"/>
<column name="date_retired" type="datetime"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false" unique="true"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@
</column>
<column name="retired_by" type="INT"/>
<column name="date_retired" type="datetime"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false" unique="true"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@
</column>
<column name="retired_by" type="INT"/>
<column name="date_retired" type="datetime"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false" unique="true"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@
</column>
<column defaultValueComputed="NULL" name="retired_by" type="INT"/>
<column defaultValueComputed="NULL" name="date_retired" type="datetime"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@
</column>
<column name="retired_by" type="INT"/>
<column name="date_retired" type="datetime"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@
</column>
<column name="retired_by" type="INT"/>
<column name="date_retired" type="datetime"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false" unique="true"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@
</column>
<column defaultValueComputed="NULL" name="retired_by" type="INT"/>
<column defaultValueComputed="NULL" name="date_retired" type="datetime(0)"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false" unique="true"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@
</column>
<column defaultValueComputed="NULL" name="retired_by" type="INT"/>
<column defaultValueComputed="NULL" name="date_retired" type="datetime(0)"/>
<column name="retired_reason" type="VARCHAR(255)"/>
<column name="retire_reason" type="VARCHAR(255)"/>
<column name="uuid" type="CHAR(38)">
<constraints nullable="false" unique="true"/>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
</column>
<column name="retired_by" type="int(11)" />
<column name="date_retired" type="datetime" />
<column name="retired_reason" type="varchar(255)" defaultValue="null"/>
<column name="retire_reason" type="varchar(255)" defaultValue="null"/>
</createTable>
<addForeignKeyConstraint constraintName="location_tag_creator"
baseTableName="location_tag" baseColumnNames="creator"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,17 @@
<column name="retired_by" type="INT" />
</addColumn>
</changeSet>
<changeSet id="TRUNK-5804-2025-09-12" author="elijah">
<preConditions onFail="MARK_RAN">
<columnExists tableName="form" columnName="retired_reason"/>
</preConditions>
<comment>Rename retired_reason to retire_reason for consistency</comment>
<renameColumn
tableName="form"
oldColumnName="retired_reason"
newColumnName="retire_reason"
columnDataType="varchar(255)"/>
</changeSet>


</databaseChangeLog>
2 changes: 2 additions & 0 deletions api/src/test/java/org/openmrs/api/OrderServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.openmrs.DrugOrder;
import org.openmrs.Encounter;
import org.openmrs.EncounterRole;
import org.openmrs.Form;
import org.openmrs.FreeTextDosingInstructions;
import org.openmrs.GlobalProperty;
import org.openmrs.Location;
Expand Down Expand Up @@ -2787,6 +2788,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ConceptNameTag.class)
.addAnnotatedClass(CareSetting.class)
.addAnnotatedClass(LocationTag.class)
.addAnnotatedClass(Form.class)
.getMetadataBuilder().build();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class DatabaseUpdaterDatabaseIT extends DatabaseIT {
* This constant needs to be updated when adding new Liquibase update files to openmrs-core.
*/

private static final int CHANGE_SET_COUNT_FOR_GREATER_THAN_2_1_X = 905;
private static final int CHANGE_SET_COUNT_FOR_GREATER_THAN_2_1_X = 906;

private static final int CHANGE_SET_COUNT_FOR_2_1_X = 870;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<field field_id="2" name="Some same concept" description="This is a duplicate field" field_type="1" concept_id="3" table_name="" default_value="" select_multiple="false" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" uuid="a2843248-ca4c-4349-a3b7-1162b98d91df"/>
<field field_id="3" name="Some same concept" description="This is a duplicate field" field_type="1" concept_id="3" table_name="" default_value="" select_multiple="false" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" uuid="b1843148-da2f-4349-c9c7-1164b98d91dd"/>

<form form_id="1" name="Basic Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retired_reason="" uuid="c156e1a8-6731-4ebdf-d0d1c45eb577"/>
<form form_id="2" name="Basic Other Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retired_reason="" uuid="c156e1a-jhbUN0-788nhiuhi-DGof-90oGH"/>
<form form_id="3" name="Some Retired Basic Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" encounter_type="1" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retired_reason="" uuid="c158-6731-4ebd-89ff-hiui8hjJKK"/>
<form form_id="4" name="Another Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" encounter_type="1" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="true" retired_reason="" uuid="c156e1a8-6731-4ebd-89ff-c45kjni2891"/>
<form form_id="1" name="Basic Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retire_reason="" uuid="c156e1a8-6731-4ebdf-d0d1c45eb577"/>
<form form_id="2" name="Basic Other Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retire_reason="" uuid="c156e1a-jhbUN0-788nhiuhi-DGof-90oGH"/>
<form form_id="3" name="Some Retired Basic Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" encounter_type="1" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retire_reason="" uuid="c158-6731-4ebd-89ff-hiui8hjJKK"/>
<form form_id="4" name="Another Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" encounter_type="1" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="true" retire_reason="" uuid="c156e1a8-6731-4ebd-89ff-c45kjni2891"/>

<form_field form_field_id="2" form_id="1" field_id="1" field_number="1" field_part="" required="false" changed_by="1" date_changed="2006-07-18 11:11:53.0" creator="1" date_created="2006-07-18 11:04:36.0" sort_weight="10.0" uuid="6cbc3f1a-0b69-4f93-8865-f7ee4dd6a879"/>
<form_field form_field_id="3" form_id="1" field_id="1" field_number="2" field_part="" required="false" changed_by="1" date_changed="2006-07-18 11:12:05.0" creator="1" date_created="2006-07-18 11:06:52.0" sort_weight="20.0" uuid="22a5ea24-f755-42c2-ae56-b0d23aaa46f7"/>
<form_field form_field_id="5" form_id="2" field_id="1" field_number="3" field_part="" required="false" changed_by="1" date_changed="2006-07-18 11:13:59.0" creator="1" date_created="2006-07-18 11:13:57.0" sort_weight="30.0" uuid="0d38e38e-19da-41d6-9d24-af7e08e5e0f0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<field field_id="1" name="Some concept" description="This is a test field" field_type="1" concept_id="1" table_name="" default_value="" select_multiple="false" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" uuid="e1843048-ca2f-4349-a9b7-1165b98d91de"/>
<field field_id="2" name="Some same concept" description="This is a duplicate field" field_type="1" concept_id="1" table_name="" default_value="" select_multiple="false" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" uuid="a2843248-ca4c-4349-a3b7-1162b98d91df"/>
<field field_id="3" name="Some same concept" description="This is a duplicate field" field_type="1" concept_id="1" table_name="" default_value="" select_multiple="false" creator="1" date_created="2006-07-18 11:03:31.0" retired="false" uuid="b1843148-da2f-4349-c9c7-1164b98d91dd"/>
<form form_id="1" name="Basic Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retired_reason="" uuid="c156e1a8-6731-4ebd-89ff-d0d1c45eb577"/>
<form form_id="1" name="Basic Form" version="0.1" build="0" published="0" description="Test form" creator="1" date_created="2005-08-07 00:00:00.0" changed_by="1" date_changed="2007-10-24 14:51:53.0" retired="false" retire_reason="" uuid="c156e1a8-6731-4ebd-89ff-d0d1c45eb577"/>
<form_field form_field_id="2" form_id="1" field_id="1" field_number="1" field_part="" required="false" changed_by="1" date_changed="2006-07-18 11:11:53.0" creator="1" date_created="2006-07-18 11:04:36.0" sort_weight="10.0" uuid="6cbc3f1a-0b69-4f93-8865-f7ee4dd6a879"/>
<form_field form_field_id="3" form_id="1" field_id="1" field_number="2" field_part="" required="false" changed_by="1" date_changed="2006-07-18 11:12:05.0" creator="1" date_created="2006-07-18 11:06:52.0" sort_weight="20.0" uuid="22a5ea24-f755-42c2-ae56-b0d23aaa46f7"/>
<form_field form_field_id="5" form_id="1" field_id="1" field_number="3" field_part="" required="false" changed_by="1" date_changed="2006-07-18 11:13:59.0" creator="1" date_created="2006-07-18 11:13:57.0" sort_weight="30.0" uuid="0d38e38e-19da-41d6-9d24-af7e08e5e0f0"/>
Expand Down
Loading
Loading