Skip to content
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
17 changes: 17 additions & 0 deletions api/src/main/java/org/openmrs/LocationAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
package org.openmrs;

import org.hibernate.envers.Audited;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.persistence.AssociationOverride;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.Id;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Column;
import org.openmrs.attribute.Attribute;
import org.openmrs.attribute.BaseAttribute;

Expand All @@ -19,8 +27,17 @@
* @since 1.9
*/
@Audited
@Entity
@Table(name = "location_attribute")
@AssociationOverride(
name="owner",
joinColumns = @JoinColumn(name="location_id", nullable = false)
)
public class LocationAttribute extends BaseAttribute<LocationAttributeType, Location> implements Attribute<LocationAttributeType, Location> {

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

// BaseAttribute<Location> has an "owner" property of type Location, which we re-expose as "location"
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 @@ -49,7 +49,6 @@
<mapping resource="org/openmrs/api/db/hibernate/OrderSetAttribute.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/LocationAttribute.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/EncounterType.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/EncounterProvider.hbm.xml" />
<mapping resource="org/openmrs/api/db/hibernate/ProgramWorkflow.hbm.xml" />
Expand Down

This file was deleted.

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 @@ -83,6 +83,7 @@
import org.openmrs.VisitType;
import org.openmrs.VisitAttributeType;
import org.openmrs.FormResource;
import org.openmrs.LocationAttribute;
import org.openmrs.api.builder.DrugOrderBuilder;
import org.openmrs.api.builder.OrderBuilder;
import org.openmrs.api.context.Context;
Expand Down Expand Up @@ -2939,6 +2940,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th
.addAnnotatedClass(LoginCredential.class)
.addAnnotatedClass(ConceptDatatype.class)
.addAnnotatedClass(ProviderAttribute.class)
.addAnnotatedClass(LocationAttribute.class)
.getMetadataBuilder().build();


Expand Down
Loading