Skip to content

Commit af01d40

Browse files
author
Open Lowcode SAS
committed
Close #115
1 parent 4ca1f45 commit af01d40

11 files changed

+68
-6
lines changed

src/org/openlowcode/design/advanced/ChoiceFilterElement.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,9 @@ public boolean hasSuggestionValues() {
212212
public ArgumentContent getSuggestionArgumentContent(String suffix) {
213213
return null;
214214
}
215+
216+
@Override
217+
public boolean needArrayOfObjectId() {
218+
return false;
219+
}
215220
}

src/org/openlowcode/design/advanced/FilterElement.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public boolean isHardCoded() {
8484
*/
8585
public abstract boolean hasSuggestionValues();
8686

87+
/**
88+
* tells if the filter data gathering need an array of object ids
89+
*
90+
* @return true if the filter needs an array of object ids
91+
* @since 1.7
92+
*/
93+
public abstract boolean needArrayOfObjectId();
94+
8795
/**
8896
* provides the argument for the suggestion, typically a list of strings for a
8997
* string field

src/org/openlowcode/design/advanced/FilterElementLink.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,7 @@ public void writeFilterInDataGathering(
205205
String rightobjectattribute = StringFormatter.formatForAttribute(linkobject.getRightobjectforlink().getName());
206206
String leftobjectclass = StringFormatter.formatForJavaClass(linkobject.getLeftobjectforlink().getName());
207207
String leftobjectattribute = StringFormatter.formatForAttribute(linkobject.getLeftobjectforlink().getName());
208-
logger.severe("Writing filter in data gathering for node " + prefixforobject + " for FilterElementLink");
209-
sg.wl(" DataObjectId<" + leftobjectclass + ">[] " + leftobjectattribute + "_step" + prefixforobject
210-
+ "_id = new DataObjectId[" + leftobjectattribute + "_step" + prefixforobject + ".length];");
211-
sg.wl(" for (int i=0;i<" + leftobjectattribute + "_step" + prefixforobject + ".length;i++) "
212-
+ leftobjectattribute + "_step" + prefixforobject + "_id[i] = " + leftobjectattribute + "_step"
213-
+ prefixforobject + "[i].getId();");
208+
214209
sg.wl(" TwoDataObjects<" + linkobjectclass + "," + rightobjectclass + ">[] " + leftobjectattribute + "_step"
215210
+ prefixforobject + "_filteron" + rightobjectattribute + " = " + linkobjectclass
216211
+ ".getlinksandrightobject(" + leftobjectattribute + "_step" + prefixforobject + "_id, null);");
@@ -246,4 +241,9 @@ public ArgumentContent getSuggestionArgumentContent(String suffix) {
246241
return null;
247242
}
248243

244+
@Override
245+
public boolean needArrayOfObjectId() {
246+
return true;
247+
}
248+
249249
}

src/org/openlowcode/design/advanced/LineGroupingCriteria.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,10 @@ protected abstract void writeClassification(
101101
* @throws IOException if anything bad
102102
*/
103103
protected abstract void writeFields(SourceGenerator sg, String prefix) throws IOException;
104+
105+
/**
106+
* @return true if the grouping element needs to have an array of object ids
107+
* queried before
108+
*/
109+
public abstract boolean needArrayOfObjectId();
104110
}

src/org/openlowcode/design/advanced/LineGroupingCriteriaChoice.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,9 @@ protected void feedfields(ArrayList<Field> fieldlist, boolean before) {
106106
protected void writeFields(SourceGenerator sg, String prefix) {
107107

108108
}
109+
110+
@Override
111+
public boolean needArrayOfObjectId() {
112+
return false;
113+
}
109114
}

src/org/openlowcode/design/advanced/LineGroupingCriteriaObject.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,9 @@ protected void writeFields(SourceGenerator sg, String prefix) throws IOException
239239
}
240240

241241
}
242+
243+
@Override
244+
public boolean needArrayOfObjectId() {
245+
return false;
246+
}
242247
}

src/org/openlowcode/design/advanced/LineGroupingCriteriaText.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,9 @@ protected void feedfields(ArrayList<Field> fieldlist, boolean before) {
105105
protected void writeFields(SourceGenerator sg, String prefix) {
106106
// donothing
107107
}
108+
109+
@Override
110+
public boolean needArrayOfObjectId() {
111+
return false;
112+
}
108113
}

src/org/openlowcode/design/advanced/LineGroupingCriteriaUniqueLink.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public String[] getImportStatements() {
9595
+ StringFormatter.formatForJavaClass(linkobject.getParent().getName()) + ";");
9696
importstatements.add("import " + linkobject.getRightobjectforlink().getOwnermodule().getPath() + ".data."
9797
+ StringFormatter.formatForJavaClass(linkobject.getRightobjectforlink().getName()) + ";");
98+
importstatements.add("import org.openlowcode.server.data.TwoDataObjects;");
9899
return importstatements.toArray(new String[0]);
99100
}
100101

@@ -128,4 +129,9 @@ protected void feedfields(ArrayList<Field> fieldlist, boolean before) {
128129
protected void writeFields(SourceGenerator sg, String prefix) {
129130
// donothing
130131
}
132+
133+
@Override
134+
public boolean needArrayOfObjectId() {
135+
return true;
136+
}
131137
}

src/org/openlowcode/design/advanced/LinkedToChildrenNodeLink.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ protected void gatherData(
133133
+ "_step" + prefixparent + ",QueryFilter.get(" + queryattribute + "));");
134134

135135
}
136+
boolean hasidtable = false;
137+
if (filterelements!=null) for (int i=0;i<filterelements.size();i++) if (filterelements.get(i).needArrayOfObjectId()) hasidtable=true;
138+
if (groupingelements!=null) for (int i=0;i<groupingelements.size();i++) if (groupingelements.get(i).needArrayOfObjectId()) hasidtable=true;
139+
140+
if (hasidtable) {
141+
sg.wl(" DataObjectId<" + childclass + ">[] " + childattribute + "_step" + prefixforlinkandchild
142+
+ "_id = new DataObjectId[" + childattribute + "_step" + prefixforlinkandchild + ".length];");
143+
sg.wl(" for (int i=0;i<" + childattribute + "_step" + prefixforlinkandchild + ".length;i++) "
144+
+ childattribute + "_step" + prefixforlinkandchild + "_id[i] = " + childattribute + "_step"
145+
+ prefixforlinkandchild + "[i].getId();");
146+
}
147+
136148
if (filterelements != null)
137149
for (int i = 0; i < filterelements.size(); i++) {
138150
FilterElement<?> thiselement = filterelements.get(i);

src/org/openlowcode/design/advanced/TextFilterElement.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,9 @@ public Field getFieldForSuggestion() {
217217
return this.stringfield;
218218
}
219219

220+
@Override
221+
public boolean needArrayOfObjectId() {
222+
return false;
223+
}
224+
220225
}

0 commit comments

Comments
 (0)