Project

General

Profile

« Previous | Next » 

Revision 70ea5d03

Added by Patrick Plitzner over 7 years ago

Trim Code + add serial version uid

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/statement/CdmStatementDelegate.java
29 29
 */
30 30
public class CdmStatementDelegate implements FreeformStatementDelegate {
31 31

  
32
    private List<Filter> filters;
32
	private static final long serialVersionUID = 8417860805854924886L;
33
	private List<Filter> filters;
33 34
    private List<OrderBy> orderBys;
34 35

  
35 36
    private final String select_query;
......
42 43
        this.contains_query = contains_query;
43 44
    }
44 45

  
45
    /* (non-Javadoc)
46
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#getQueryString(int, int)
47
     */
48 46
    @Override
49 47
    public String getQueryString(int offset, int limit) throws UnsupportedOperationException {
50 48
        throw new UnsupportedOperationException("Use getQueryStatement method.");
51 49
    }
52 50

  
53
    /* (non-Javadoc)
54
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#getCountQuery()
55
     */
56 51
    @Override
57 52
    public String getCountQuery() throws UnsupportedOperationException {
58 53
        throw new UnsupportedOperationException("Use getCountStatement method.");
59 54
    }
60 55

  
61
    /* (non-Javadoc)
62
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#setFilters(java.util.List)
63
     */
64 56
    @Override
65 57
    public void setFilters(List<Filter> filters) throws UnsupportedOperationException {
66 58
        this.filters = filters;
67 59
    }
68 60

  
69

  
70
    /* (non-Javadoc)
71
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#setOrderBy(java.util.List)
72
     */
73 61
    @Override
74 62
    public void setOrderBy(List<OrderBy> orderBys) throws UnsupportedOperationException {
75 63
        this.orderBys = orderBys;
76 64
    }
77 65

  
78
    /* (non-Javadoc)
79
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#storeRow(java.sql.Connection, com.vaadin.data.util.sqlcontainer.RowItem)
80
     */
81 66
    @Override
82 67
    public int storeRow(Connection conn, RowItem row) throws UnsupportedOperationException, SQLException {
83 68
        // TODO Auto-generated method stub
84 69
        return 0;
85 70
    }
86 71

  
87
    /* (non-Javadoc)
88
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#removeRow(java.sql.Connection, com.vaadin.data.util.sqlcontainer.RowItem)
89
     */
90 72
    @Override
91 73
    public boolean removeRow(Connection conn, RowItem row) throws UnsupportedOperationException, SQLException {
92 74
        // TODO Auto-generated method stub
93 75
        return false;
94 76
    }
95 77

  
96
    /* (non-Javadoc)
97
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate#getContainsRowQueryString(java.lang.Object[])
98
     */
99 78
    @Override
100 79
    public String getContainsRowQueryString(Object... keys) throws UnsupportedOperationException {
101 80
        throw new UnsupportedOperationException("Use getContainsRowQueryStatement method.");
102 81
    }
103 82

  
104
    /* (non-Javadoc)
105
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate#getQueryStatement(int, int)
106
     */
107 83
    @Override
108 84
    public StatementHelper getQueryStatement(int offset, int limit) throws UnsupportedOperationException {
109 85
        StatementHelper sh = new StatementHelper();
......
141 117
        return orderBuffer.toString();
142 118
    }
143 119

  
144
    /* (non-Javadoc)
145
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate#getCountStatement()
146
     */
147 120
    @Override
148 121
    public StatementHelper getCountStatement() throws UnsupportedOperationException {
149 122
        StatementHelper sh = new StatementHelper();
......
156 129
        return sh;
157 130
    }
158 131

  
159
    /* (non-Javadoc)
160
     * @see com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate#getContainsRowQueryStatement(java.lang.Object[])
161
     */
162 132
    @Override
163 133
    public StatementHelper getContainsRowQueryStatement(Object... keys) throws UnsupportedOperationException {
164 134
        StatementHelper sh = new StatementHelper();
......
168 138
        return sh;
169 139
    }
170 140

  
171
//    public static String getWhereStringForFilters(List<Filter> filters,
172
//            StatementHelper sh) {
173
//        if (filters == null || filters.isEmpty()) {
174
//            return "";
175
//        }
176
//        StringBuilder where = new StringBuilder(" WHERE ");
177
//        where.append(getJoinedFilterString(filters, "AND", sh));
178
//        return where.toString();
179
//    }
180
//
181
//    public static String getJoinedFilterString(Collection<Filter> filters,
182
//            String joinString, StatementHelper sh) {
183
//        StringBuilder result = new StringBuilder();
184
//        for (Filter f : filters) {
185
//            result.append(getWhereStringForFilter(f, sh));
186
//            result.append(" ").append(joinString).append(" ");
187
//        }
188
//        // Remove the last instance of joinString
189
//        result.delete(result.length() - joinString.length() - 2,
190
//                result.length());
191
//        return result.toString();
192
//    }
193
//
194
//    public static String getWhereStringForFilter(Filter filter, StatementHelper sh) {
195
//        Compare compare = (Compare) filter;
196
//        sh.addParameterValue(compare.getValue());
197
//        String prop = compare.getPropertyId().toString();
198
//        switch (compare.getOperation()) {
199
//        case EQUAL:
200
//            return prop + " = ?";
201
//        case GREATER:
202
//            return prop + " > ?";
203
//        case GREATER_OR_EQUAL:
204
//            return prop + " >= ?";
205
//        case LESS:
206
//            return prop + " < ?";
207
//        case LESS_OR_EQUAL:
208
//            return prop + " <= ?";
209
//        default:
210
//            return "";
211
//        }
212
//    }
213

  
214 141
}

Also available in: Unified diff