Skip to content

Commit

Permalink
avniproject/avni-webapp#1254 | Remove FEG.display column and setters,…
Browse files Browse the repository at this point in the history
… use FEG.name instead
  • Loading branch information
himeshr committed Aug 28, 2024
1 parent 6c5a334 commit 73d8c2d
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public class FormElementGroup extends OrganisationAwareEntity {
@NotNull
private String name;

@Column
private String display;

@NotNull
private Double displayOrder;

Expand Down Expand Up @@ -99,12 +96,9 @@ public static FormElementGroup create() {
}

public String getDisplay() {
return display;
return getName();
}

public void setDisplay(String display) {
this.display = display;
}

FormElement findFormElementByConcept(String conceptName) {
return formElements.stream().filter(x -> x.getConcept().getName().equals(conceptName)).findAny().orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public FormBuilder withFormElementGroups(List<FormElementGroupContract> formElem
.withBackgroundColour(formElementGroupContract.getBackgroundColour())
.withStartTime(formElementGroupContract.getStartTime())
.withStayTime(formElementGroupContract.getStayTime())
.withDisplay(formElementGroupContract.getDisplay())
.withDisplayOrder(formElementGroupContract.getDisplayOrder())
.withRule(formElementGroupContract.getRule())
.withDeclarativeRule(formElementGroupContract.getDeclarativeRule())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public FormElementGroupBuilder withIsVoided(boolean isVoided) {
return this;
}

public FormElementGroupBuilder withDisplay(String display) {
this.set("Display", display, String.class);
return this;
}

public FormElementGroupBuilder withRule(String rule) {
this.get().setRule(rule);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ public FormContract export(@RequestParam String formUUID) {

form.getFormElementGroups().stream().sorted(Comparator.comparingDouble(FormElementGroup::getDisplayOrder)).forEach(formElementGroup -> {
FormElementGroupContract formElementGroupContract = new FormElementGroupContract(formElementGroup.getUuid(), formElementGroup.getName(), formElementGroup.getDisplayOrder());
formElementGroupContract.setDisplay(formElementGroup.getDisplay());
formElementGroupContract.setVoided(formElementGroup.isVoided());
formElementGroupContract.setOrganisationId(formElementGroup.getOrganisationId());
formElementGroupContract.setRule(formElementGroup.getRule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ public void addFormElement(FormElementContract formElementContract) {
}

public String getDisplay() {
return display;
return getName();
}

public void setDisplay(String display) {
this.display = display;
}

public DeclarativeRule getDeclarativeRule() {
return declarativeRule;
Expand Down Expand Up @@ -122,7 +119,6 @@ public String toString() {
return "{" +
"name=" + this.getName() + '\'' +
"displayOrder=" + displayOrder +
", display='" + display + '\'' +
'}';
}

Expand All @@ -138,7 +134,6 @@ public static FormElementGroupContract fromFormElementGroup(FormElementGroup feg
FormElementGroupContract fegContract = new FormElementGroupContract();
fegContract.setName(feg.getName());
fegContract.setUuid(feg.getUuid());
fegContract.setDisplay(feg.getDisplay());
fegContract.setDisplayOrder(feg.getDisplayOrder());
fegContract.setVoided(feg.isVoided());
fegContract.setRule(feg.getRule());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
update form_element_group set name = display, last_modified_date_time = current_timestamp + random() * 5000 * (interval '1 millisecond') where display is not null and display <> '' and name <> display;
ALTER TABLE form_element_group DROP COLUMN display;
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public TestFormElementGroupBuilder withIsVoided(boolean isVoided) {
return this;
}

public TestFormElementGroupBuilder withDisplay(String display) {
formElementGroup.setDisplay(display);
return this;
}

public TestFormElementGroupBuilder withRule(String rule) {
formElementGroup.setRule(rule);
return this;
Expand Down

0 comments on commit 73d8c2d

Please sign in to comment.