-
Notifications
You must be signed in to change notification settings - Fork 16
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
Erweiterung Eigenschaftenfilter #388
base: master
Are you sure you want to change the base?
Erweiterung Eigenschaftenfilter #388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mir gefällt deine Umsetzung gut!
Da auch dippeal schon aprooved hat würde ich sagen, dass die Änderungen gerne angenommen würden. Ich fände es gut, wenn du in diesem PR die weiteren geplanten Änderungen vornimmst damit die neue Eigenschaftenauswahl überall verfügbar ist. So dass wir es im ganzen übernehmen können.
+ "WHERE (mitglied = ?) "; | ||
ArrayList<Long> mitgliedeigenschaftenIds = (ArrayList<Long>) service.execute(sql, | ||
new Object[] { mitglied }, new ResultSetExtractor() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hier wäre es gut, eine einzelne SQL Abfrage zu machen und die Eigenschaften in einer Map zu speichern. Ansonsten wird für Jedes Mitglied eine Abfrage ausgeführt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mache ich
} | ||
else // Oder | ||
{ | ||
if(suchauswahl.get(ei).equalsIgnoreCase("1")) // + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equalsIgnoreCase macht bei Zahlen keinen Sinn-> equals verwenden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mache ich
for (Long id : ids) | ||
{ | ||
mitglieder.add((Mitglied) Einstellungen.getDBService() | ||
.createObject(Mitglied.class, id.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besser mit nur einem Querry, ungefähr so
list = Einstellungen.getDBService().createList(Mitglied.class);
list.addFilter("id in (?)",String.join(",",ids);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das klappt noch nicht: list.addFilter("id in (?) ", StringUtils.join(ids, ","));
java.rmi.RemoteException: unable to init iterator. statement: prep54: select MITGLIED.* from MITGLIED where id in (?) {1: '1,45'}; nested exception is:
org.h2.jdbc.JdbcSQLDataException: Datenumwandlungsfehler beim Umwandeln von "1,45"
Data conversion error converting "1,45"; SQL statement:
select MITGLIED.* from MITGLIED where id in (?) [22018-199]
at de.willuhn.datasource.db.DBIteratorImpl.init(DBIteratorImpl.java:234)
Caused by: java.lang.NumberFormatException: For input string: "1,45"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Long.parseLong(Long.java:711)
at java.base/java.lang.Long.parseLong(Long.java:836)
at org.h2.value.Value.convertToLong(Value.java:965)
at org.h2.value.Value.convertTo(Value.java:766)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stimmt, aber mit
list.addFilter("id in (" + String.join(",",ids) + ")");
sollte es gehen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ja , den Einfall hatte ich auch gerade. So gehts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allerdings nur mit list.addFilter("id in (" + StringUtils.join(ids, ",") + ")");
Also mit den StringUtils, der String.join ging bei mir nicht
@@ -363,9 +365,13 @@ public DialogInput getEigenschaftenAuswahl() throws RemoteException | |||
} | |||
try | |||
{ | |||
String s = stt.nextToken(); | |||
String prefix = "+"; | |||
if (s.substring(s.length()-1).equalsIgnoreCase("2")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich würde die Zustände in ein enum packen damit der Code lesbarer ist, mit "2" kann man sonst wenig anfangen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mache ich
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wie ist das Verhalten, wenn die Oder-Verknüpfung ausgewählt wird?
Folgt das einfach den Regeln der Boolschen Algebra?
Nach den Diskussionen um die Funktionalität beim Handling von Eigenschaften z.B. in #370 habe ich einen ersten Schritt gemacht. Ich biete die Möglichkeit beim Eigenschaften Filter jetzt auch die nicht Eigenschaft auszuwählen.
Die Anzeige im Dialog erfolgt über Icons für nichts gewählt, Eigenschaft ausgewählt (+) oder Nicht Eigenschaft ausgewählt (-). Durch Klick auf die Eigenschaft kann man zwischen ihnen wechseln.
Wenn ihr meint der Vorschlag ist gut und er wird übernommen, dann werde ich auch die anderen Stellen schrittweise anpassen.
Ich habe einige Klassen dupliziert und angepasst. Wenn alles die neuen Klassen benutzt werde ich die alten löschen und die neuen entsprechend umbenennen.
PS:
Es gibt eine Unschönheit. Da ich das Format der Eigenschaften Settings geändert habe muss man im List View einmal die Filter rücksetzen oder den Eigenschaften Filter mit dem Dialog neu speichern.
Hier eine Versionserkennung einzubauen denke ich ist übertrieben. Vielleicht kann man das ja in der Release Note erwähnen.