1
2 package net.sf.voruta;
3 import java.util.Map;
4
5 /***
6 * this file is used for metadata and must be in classpath at runtime,
7 * rename "@execute" tags to "execute" in production
8 *
9 * @execute CREATE OR REPLACE FUNCTION concat_text (TEXT, TEXT) RETURNS TEXT AS '
10 * BEGIN
11 * RETURN $1 || $2;
12 * END;
13 * ' LANGUAGE 'plpgsql';
14 *
15 * @author baliuka
16 */
17 public interface Demo {
18
19 public final static String FIELD_LIST = "id,name";
20 public final static String TABLE_NAME = "TBL";
21 public final static String PRIMARY_KEY = "ID";
22
23
24 /***
25 *@query SELECT concat_text($1,$2)
26 */
27 String concatText(String s1, String s2);
28
29 /***
30 *@query SELECT MAX(DATE_FIELD) FROM ${TABLE_NAME} WHERE $1 < DATE_FIELD
31 */
32 java.sql.Date maxDate(java.sql.Date param);
33
34 /***
35 *@update CREATE TABLE ${TABLE_NAME} (
36 * ${PRIMARY_KEY} INT NOT NULL PRIMARY KEY,
37 * NAME VARCHAR(128),
38 * DATE_FIELD DATE
39 * )
40 */
41
42 void create();
43
44 /***
45 *@update DROP TABLE ${1}
46 */
47
48 void drop(String tableName);
49
50
51 /***
52 *@query SELECT COUNT(1) > 0
53 * FROM ${TABLE_NAME}
54 * WHERE $1 = ${PRIMARY_KEY}
55 */
56 public boolean exists(int id);
57
58
59 /***
60 *@query SELECT COUNT(1) > 0
61 * FROM ${2}
62 * WHERE $3 = ${1} ${DemoBean.EMPTY}
63 */
64 public boolean exists(String id,String table,int value);
65
66
67 /***
68 *@update INSERT INTO ${TABLE_NAME}
69 * (${FIELD_LIST})
70 * VALUES ($1,$2)
71 */
72 public int add(int id,String name);
73
74 /***
75 *@update INSERT INTO ${TABLE_NAME}
76 * ( ${FIELD_LIST} )
77 * VALUES ($1.id,$1.name)
78 */
79 public int add(DemoBean bean);
80
81
82 /***
83 *@update DELETE FROM ${TABLE_NAME}
84 */
85 public void clear();
86
87
88 /***
89 *@query SELECT max(${PRIMARY_KEY})
90 * FROM ${1}
91 *
92 *
93 */
94 public Integer maxId(String table);
95
96
97 /***
98 *@query SELECT ${FIELD_LIST}
99 * FROM ${TABLE_NAME}
100 * WHERE ${PRIMARY_KEY}=$1
101 */
102 public Object[] getRow( int id );
103
104 /***
105 *@query SELECT id,id,id
106 * FROM ${TABLE_NAME}
107 * WHERE ${PRIMARY_KEY}=$1
108 *@handler vector
109 */
110 public int[] getRowOfInts( int id );
111
112 /***
113 *@query SELECT ${FIELD_LIST}
114 * FROM ${TABLE_NAME}
115 * WHERE ${PRIMARY_KEY}=$1
116 */
117 public Map getRowAsMap( int id );
118
119 /***
120 *@query SELECT ${FIELD_LIST}
121 * FROM ${TABLE_NAME}
122 * WHERE ${PRIMARY_KEY}=$2
123 *
124 *@handler DemoBeanHandler
125 */
126 public DemoBean getRowAsBean( DemoBean bean, int id );
127
128 /***
129 *@query SELECT ${FIELD_LIST}
130 * FROM ${TABLE_NAME}
131 * WHERE ${PRIMARY_KEY}=$1
132 *@handler bean
133 */
134 public DemoBean getRowAsBean( int id );
135
136 /***
137 *@query SELECT ${FIELD_LIST}
138 * FROM ${TABLE_NAME}
139 *
140 *@handler beans(DemoBean)
141 */
142 public java.util.Collection getBeans();
143
144 /***
145 *@query SELECT ${FIELD_LIST}
146 * FROM ${TABLE_NAME}
147 *
148 *@handler beans(DemoBean)
149 */
150 public DemoBean[] getArrayOfBeans();
151
152
153 /***
154 *@query SELECT ${FIELD_LIST} FROM ${1}
155 */
156 public java.util.Collection getAll( String tbl );
157
158 /***
159 *@query SELECT id FROM TBL
160 *@handler column
161 */
162 public java.util.Collection getColumn();
163
164 /***
165 *@query SELECT id FROM TBL
166 *@handler column
167 */
168 public int[] getColumnAsArray();
169
170
171
172
173 /***
174 *@query SELECT $1 || $2
175 */
176 public String concat(String s1, String s2);
177
178
179 /***
180 *@query SELECT ${FIELD_LIST} FROM ${TABLE_NAME}
181 *@handler DemoHandler
182 */
183 public int print(java.io.PrintStream out) throws java.io.IOException;
184
185 /***
186 *@query SELECT ${FIELD_LIST} FROM ${2} WHERE ${3} > $4
187 *@handler DemoHandler
188 */
189 public int dynamicPrint(java.io.PrintStream out,
190 String table, String field, int value);
191
192
193
194 public int plain();
195
196 }
This page was automatically generated by Maven