-
Notifications
You must be signed in to change notification settings - Fork 4.1k
TRUNK-5900: Migrate ConceptProposal to JPA annotations #5013
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
base: master
Are you sure you want to change the base?
Changes from all commits
62512cb
9e61ce7
ab20874
4faf1df
dc10424
d1fdc8b
d496923
065ab8a
2ae55c6
32e3221
70a383d
68b4d76
3a976e1
74dba06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,15 @@ | |
| */ | ||
| package org.openmrs; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.JoinColumn; | ||
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.Table; | ||
| import java.util.Date; | ||
|
|
||
| import org.hibernate.envers.Audited; | ||
| import org.openmrs.util.OpenmrsConstants; | ||
|
|
||
|
|
@@ -19,39 +26,70 @@ | |
| * an observation, a user can "propose" a new concept if one isn't found already. The proposal is a | ||
| * simple text entry that will be reviewed later. When a proposal is (edited and) accepted, the | ||
| * encounter that prompted this proposal is updated with a new observation pointing at the new (or | ||
| * edited) concept. | ||
| */ | ||
|
|
||
| @Entity | ||
| @Table(name = "concept_proposal") | ||
| @Audited | ||
snowvirus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public class ConceptProposal extends BaseOpenmrsObject { | ||
|
|
||
| public static final long serialVersionUID = 57344L; | ||
|
|
||
| // Fields | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "concept_proposal_id") | ||
| private Integer conceptProposalId; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "encounter_id") | ||
| private Encounter encounter; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "obs_concept_id") | ||
| private Concept obsConcept; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "obs_id") | ||
| private Obs obs; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "mapped_concept_id") | ||
| private Concept mappedConcept; | ||
|
|
||
|
|
||
| /** | ||
| * @deprecated Only kept for legacy dataset and Hibernate mapping compatibility. Avoid using this field directly. | ||
| */ | ||
| @Deprecated | ||
| @ManyToOne | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this required for migrating to JPA annotations? |
||
| @JoinColumn(name = "concept_id") | ||
| private Concept concept; | ||
|
|
||
| @Column(name = "original_text") | ||
| private String originalText; | ||
|
|
||
| @Column(name = "final_text") | ||
| private String finalText; | ||
|
|
||
| @Column(name = "state") | ||
| private String state; | ||
|
|
||
| @Column(name = "comments") | ||
| private String comments; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "creator") | ||
| private User creator; | ||
|
|
||
| @Column(name = "date_created") | ||
| private Date dateCreated; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(name = "changed_by") | ||
| private User changedBy; | ||
|
|
||
| @Column(name = "date_changed") | ||
| private Date dateChanged; | ||
|
|
||
| // Constructors | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,5 +23,23 @@ | |
| <comment>Empty change set for integration tests.</comment> | ||
|
|
||
| </changeSet> | ||
|
|
||
|
|
||
| <!-- Add mapped_concept_id column and foreign key to concept_proposal --> | ||
| <changeSet id="add-mapped-concept-id-to-concept-proposal" author="snowvirus"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you get any errors if you do not include this changeset?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @snowvirus did you see the above comment? |
||
| <addColumn tableName="concept_proposal"> | ||
| <column name="mapped_concept_id" type="int"/> | ||
| </addColumn> | ||
|
|
||
| <addForeignKeyConstraint | ||
| baseTableName="concept_proposal" | ||
| baseColumnNames="mapped_concept_id" | ||
| constraintName="concept_proposal_mapped_concept_fk" | ||
| referencedTableName="concept" | ||
| referencedColumnNames="concept_id" | ||
| deferrable="false" | ||
| initiallyDeferred="false" | ||
| onDelete="SET NULL"/> | ||
| </changeSet> | ||
|
|
||
|
|
||
| </databaseChangeLog> | ||
Uh oh!
There was an error while loading. Please reload this page.