18 package org.turro.financials.view;
20 import java.util.HashSet;
22 import org.turro.financials.entity.RegisterView;
23 import org.turro.financials.model.register.ViewWrapper;
24 import org.turro.util.PhraseBuilder;
32 private Set<RegisterView> groupA, groupB;
35 groupA =
new HashSet<RegisterView>();
36 groupB =
new HashSet<RegisterView>();
46 this.groupA.addAll(groupA);
55 this.groupB.addAll(groupB);
59 PhraseBuilder pb =
new PhraseBuilder();
61 pb.addWord(v.getName());
62 pb.addPendingSeparator(
",");
64 if(!groupB.isEmpty()) {
68 pb.addWord(v.getName());
69 pb.addPendingSeparator(
",");
76 PhraseBuilder pb =
new PhraseBuilder();
77 if(!groupA.isEmpty()) {
78 pb.addWord(
"and (" + field +
" in (");
80 pb.addPendingSeparator(
",");
81 pb.addWord(rv.getId() +
"");
85 if(!groupB.isEmpty()) {
86 pb.addWord(
"or " + field +
" in (");
88 pb.addPendingSeparator(
",");
89 pb.addWord(rv.getId() +
"");
100 PhraseBuilder pb =
new PhraseBuilder();
101 if(!groupA.isEmpty()) {
102 pb.addWord(
"and " + field +
" in (");
104 pb.addPendingSeparator(
",");
105 pb.addWord(rv.getId() +
"");
107 pb.cancelSeparator();
110 pb.addWord(
"and 1=2");
112 return pb.toString();
116 PhraseBuilder pb =
new PhraseBuilder();
117 if(!groupB.isEmpty()) {
118 pb.addWord(
"and " + field +
" in (");
120 pb.addPendingSeparator(
",");
121 pb.addWord(rv.getId() +
"");
123 pb.cancelSeparator();
126 pb.addWord(
"and 1=2");
128 return pb.toString();
static RegisterView getFormalView()
void setGroupB(Set< RegisterView > groupB)
Set< RegisterView > getGroupA()
String getSqlWhereA(String field)
String getSqlWhereAB(String field)
Set< RegisterView > getGroupB()
String getSqlWhereB(String field)
void setGroupA(Set< RegisterView > groupA)