Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Detect temporal fields of forms uploaded before upgrading to v2.0
Browse files Browse the repository at this point in the history
- They can lack their FormElementModel
- They can be metadata fields
- They can have a FormElementModel without child elements
  • Loading branch information
ggalmazor committed Jan 11, 2019
1 parent adb8168 commit de1c604
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,13 @@ public QueryByUIFilterGroup(IForm form, FilterGroup filterGroup, CompletionFlag
super.addFilter(fem, op, compareValue);
break;
case JRDATETIME:
if (fem.getFormDataModel() == null && fem.getElementName().contains("meta-"))
case JRDATE:
case JRTIME:
if (isLegacyTemporalField(fem))
super.addFilter(fem, op, compareValue);
else if (fem.getFormDataModel() != null)
super.addFilterChildren(fem, column.getChildColumnCode(), op, compareValue);
else
throw new IllegalArgumentException("Unrecognized dateTime field");
super.addFilterChildren(fem, column.getChildColumnCode(), op, compareValue);
break;
case JRDATE:
case JRTIME:
case GEOPOINT:
super.addFilterChildren(fem, column.getChildColumnCode(), op, compareValue);
break;
Expand All @@ -166,6 +164,11 @@ else if (fem.getFormDataModel() != null)

}

private boolean isLegacyTemporalField(FormElementModel fem) {
return fem.getFormDataModel() == null && fem.getElementName().contains("meta-")
|| fem.getFormDataModel().getChildren().isEmpty();
}

public Object getCompareValue(FormElementModel fem, String value) {
switch (fem.getElementType()) {
case BOOLEAN:
Expand Down

0 comments on commit de1c604

Please sign in to comment.