Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-5796: CareSetting Domain - Switching from Hibernate Mappings to Annotations #4825

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 25 additions & 2 deletions api/src/main/java/org/openmrs/CareSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@
*/
package org.openmrs;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.envers.Audited;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
* Care Setting defines the scope of care for any piece of data within the medical record. Clinical
* data (treatments, notes, etc.) apply within their associated care setting. Implementations
Expand All @@ -26,16 +37,28 @@
*
* @since 1.10
*/
@Entity
@Table(name = "care_setting")
@Audited
public class CareSetting extends BaseChangeableOpenmrsMetadata {

public enum CareSettingType {
OUTPATIENT,
INPATIENT
}


@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "care_setting_id_seq")
@GenericGenerator(
name = "care_setting_id_seq",
strategy = "native",
parameters = @Parameter(name = "sequence", value = "care_setting_care_setting_id_seq")
)
@Column(name = "care_setting_id")
private Integer careSettingId;


@Enumerated(EnumType.STRING)
@Column(name = "care_setting_type", nullable = false, length = 50)
private CareSettingType careSettingType;

public CareSetting() {
Expand Down
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 @@ -73,7 +73,6 @@
<mapping resource="org/openmrs/api/db/hibernate/OrderGroup.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/OrderGroupAttribute.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/OrderGroupAttributeType.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/CareSetting.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/LocationTag.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/LocationAttribute.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/EncounterType.hbm.xml" />
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions api/src/test/java/org/openmrs/api/OrderServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2740,6 +2740,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(ProgramAttributeType.class)
.addAnnotatedClass(HL7InError.class)
.addAnnotatedClass(OrderType.class)
.addAnnotatedClass(CareSetting.class)
.getMetadataBuilder().build();


Expand Down
Loading