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-6262 Make form resource auditable #4714

Open
wants to merge 3 commits 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
37 changes: 1 addition & 36 deletions api/src/main/java/org/openmrs/FormResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
*/
package org.openmrs;

import java.util.Date;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.envers.Audited;
import org.openmrs.customdatatype.CustomDatatypeUtil;
import org.openmrs.customdatatype.CustomValueDescriptor;
import org.openmrs.customdatatype.NotYetPersistedException;
Expand All @@ -30,8 +27,7 @@
*
* @since 1.9
*/
@Audited
public class FormResource extends BaseOpenmrsObject implements CustomValueDescriptor, SingleCustomValue<FormResource> {
public class FormResource extends BaseChangeableOpenmrsMetadata implements CustomValueDescriptor, SingleCustomValue<FormResource> {

private static final long serialVersionUID = 1L;

Expand All @@ -55,10 +51,6 @@ public class FormResource extends BaseOpenmrsObject implements CustomValueDescri

private transient Object typedValue;

private User changedBy;

private Date dateChanged;

public FormResource() {
// generic constructor
}
Expand Down Expand Up @@ -272,31 +264,4 @@ public boolean getDirty() {
return dirty;
}

/**
* @return Returns the changedBy.
*/
public User getChangedBy() {
return changedBy;
}

/**
* @param changedBy The user that changed this object
*/
public void setChangedBy(User changedBy) {
this.changedBy = changedBy;
}

/**
* @return Returns the date this object was changed
*/
public Date getDateChanged() {
return dateChanged;
}

/**
* @param dateChanged The date this object was changed
*/
public void setDateChanged(Date dateChanged) {
this.dateChanged = dateChanged;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,102 @@
tableName="encounter_diagnosis" />
</changeSet>

<changeSet id="20240813-form-resource-description" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="description"/>
</not>
</preConditions>
<comment>Adding "description" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="description" type="varchar(255)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240813-form-resource-creator" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="creator"/>
</not>
</preConditions>
<comment>Adding "creator" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="creator" type="int">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240813-form-resource-date-created" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="date_created"/>
</not>
</preConditions>
<comment>Adding "date created" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="date_created" type="datetime">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240813-form-resource-retired" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="retired"/>
</not>
</preConditions>
<comment>Adding "retired" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="retired" type="tinyint(1)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240813-form-resource-date-retired" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="date_retired"/>
</not>
</preConditions>
<comment>Adding "date created" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="date_retired" type="datetime">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240813-form-resource-retired-by" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="retired_by"/>
</not>
</preConditions>
<comment>Adding "retired by" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="retired_by" type="int">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240813-form-resource-retired-reason" author="loliveira">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="form_resource" columnName="retired_reason"/>
</not>
</preConditions>
<comment>Adding "retired reason" column to form_resource table</comment>
<addColumn tableName="form_resource">
<column name="retired_reason" type="varchar(255)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class DatabaseUpdaterDatabaseIT extends H2DatabaseIT {
* 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 = 897;
private static final int CHANGE_SET_COUNT_FOR_GREATER_THAN_2_1_X = 904;

private static final int CHANGE_SET_COUNT_FOR_2_1_X = 870;

Expand Down
Loading