| 85 | | try |
| 86 | | { |
| 87 | | pst.init(); |
| 88 | | pst.setString(1, xref.getId()); |
| 89 | | pst.setString(2, xref.getDataSource().getSystemCode()); |
| 90 | | ResultSet r = pst.executeQuery(); |
| 91 | | |
| 92 | | while(r.next()) |
| 93 | | { |
| 94 | | return true; |
| 95 | | } |
| 96 | | } |
| 97 | | catch (SQLException e) |
| 98 | | { |
| 99 | | throw new IDMapperException (e); |
| 100 | | } |
| 101 | | finally {pst.cleanup(); } |
| 102 | | return false; |
| | 84 | synchronized (pst) { |
| | 85 | try |
| | 86 | { |
| | 87 | pst.init(); |
| | 88 | pst.setString(1, xref.getId()); |
| | 89 | pst.setString(2, xref.getDataSource().getSystemCode()); |
| | 90 | ResultSet r = pst.executeQuery(); |
| | 91 | |
| | 92 | while(r.next()) |
| | 93 | { |
| | 94 | return true; |
| | 95 | } |
| | 96 | } |
| | 97 | catch (SQLException e) |
| | 98 | { |
| | 99 | throw new IDMapperException (e); |
| | 100 | } |
| | 101 | finally {pst.cleanup(); } |
| | 102 | return false; |
| | 103 | } |
| 113 | | Map<String, String> result = new HashMap<String, String>(); |
| 114 | | try |
| 115 | | { |
| 116 | | pst.init(); |
| 117 | | ResultSet rs = pst.executeQuery(); |
| | 115 | synchronized (pst) { |
| | 116 | try |
| | 117 | { |
| | 118 | pst.init(); |
| | 119 | ResultSet rs = pst.executeQuery(); |
| | 120 | |
| | 121 | if (rs.next()) |
| | 122 | { |
| | 123 | ResultSetMetaData rsmd = rs.getMetaData(); |
| | 124 | for (int i = 1; i <= rsmd.getColumnCount(); ++i) |
| | 125 | { |
| | 126 | String key = rsmd.getColumnName(i); |
| | 127 | String val = rs.getString(i); |
| | 128 | result.put (key, val); |
| | 129 | } |
| | 130 | } |
| | 131 | } |
| | 132 | catch (SQLException ex) |
| | 133 | { |
| | 134 | throw new IDMapperException (ex); |
| | 135 | } |
| 146 | | try |
| 147 | | { |
| 148 | | pst.init(); |
| 149 | | pst.setString(1, idc.getId()); |
| 150 | | pst.setString(2, idc.getDataSource().getSystemCode()); |
| 151 | | if (resultDs.length == 1) pst.setString(3, resultDs[0].getSystemCode()); |
| 152 | | |
| 153 | | Set<DataSource> dsFilter = new HashSet<DataSource>(Arrays.asList(resultDs)); |
| 154 | | |
| 155 | | ResultSet rs = pst.executeQuery(); |
| 156 | | while (rs.next()) |
| 157 | | { |
| 158 | | DataSource ds = DataSource.getBySystemCode(rs.getString(2)); |
| 159 | | if (resultDs.length == 0 || dsFilter.contains(ds)) |
| | 149 | synchronized (pst) { |
| | 150 | try |
| | 151 | { |
| | 152 | pst.init(); |
| | 153 | pst.setString(1, idc.getId()); |
| | 154 | pst.setString(2, idc.getDataSource().getSystemCode()); |
| | 155 | if (resultDs.length == 1) pst.setString(3, resultDs[0].getSystemCode()); |
| | 156 | |
| | 157 | Set<DataSource> dsFilter = new HashSet<DataSource>(Arrays.asList(resultDs)); |
| | 158 | |
| | 159 | ResultSet rs = pst.executeQuery(); |
| | 160 | while (rs.next()) |
| 161 | | refs.add (new Xref (rs.getString(1), ds)); |
| 162 | | } |
| 163 | | } |
| 164 | | } |
| 165 | | catch (SQLException e) |
| 166 | | { |
| 167 | | throw new IDMapperException (e); |
| 168 | | } |
| 169 | | finally {pst.cleanup(); } |
| | 162 | DataSource ds = DataSource.getBySystemCode(rs.getString(2)); |
| | 163 | if (resultDs.length == 0 || dsFilter.contains(ds)) |
| | 164 | { |
| | 165 | refs.add (new Xref (rs.getString(1), ds)); |
| | 166 | } |
| | 167 | } |
| | 168 | } |
| | 169 | catch (SQLException e) |
| | 170 | { |
| | 171 | throw new IDMapperException (e); |
| | 172 | } |
| | 173 | finally {pst.cleanup(); } |
| 180 | | try { |
| 181 | | pst.init(); |
| 182 | | pst.setString(1, attrName); |
| 183 | | pst.setString(2, attrValue); |
| 184 | | ResultSet r = pst.executeQuery(); |
| 185 | | while(r.next()) { |
| 186 | | Xref ref = new Xref(r.getString(1), DataSource.getBySystemCode(r.getString(2))); |
| 187 | | refs.add(ref); |
| 188 | | } |
| 189 | | } catch(SQLException e) { |
| 190 | | throw new IDMapperException (e); |
| 191 | | } |
| 192 | | finally {pst.cleanup(); } |
| 193 | | // Logger.log.trace("End fetching cross references by attribute"); |
| 194 | | return refs; |
| | 185 | synchronized (pst) { |
| | 186 | try { |
| | 187 | pst.init(); |
| | 188 | pst.setString(1, attrName); |
| | 189 | pst.setString(2, attrValue); |
| | 190 | ResultSet r = pst.executeQuery(); |
| | 191 | while(r.next()) { |
| | 192 | Xref ref = new Xref(r.getString(1), DataSource.getBySystemCode(r.getString(2))); |
| | 193 | refs.add(ref); |
| | 194 | } |
| | 195 | } catch(SQLException e) { |
| | 196 | throw new IDMapperException (e); |
| | 197 | } |
| | 198 | finally {pst.cleanup(); } |
| | 199 | // Logger.log.trace("End fetching cross references by attribute"); |
| | 200 | return refs; |
| | 201 | } |
| 202 | | try { |
| 203 | | pst.init(limit); |
| 204 | | pst.setString(1, "%" + text.toLowerCase() + "%"); |
| 205 | | ResultSet r = pst.executeQuery(); |
| 206 | | while(r.next()) { |
| 207 | | String id = r.getString(1); |
| 208 | | DataSource ds = DataSource.getBySystemCode(r.getString(2)); |
| 209 | | Xref ref = new Xref (id, ds); |
| 210 | | result.add (ref); |
| 211 | | } |
| 212 | | } |
| 213 | | catch (SQLException e) |
| 214 | | { |
| 215 | | throw new IDMapperException(e); |
| 216 | | } |
| 217 | | finally {pst.cleanup(); } |
| 218 | | return result; |
| | 209 | synchronized (pst) { |
| | 210 | try { |
| | 211 | pst.init(limit); |
| | 212 | pst.setString(1, "%" + text.toLowerCase() + "%"); |
| | 213 | ResultSet r = pst.executeQuery(); |
| | 214 | while(r.next()) { |
| | 215 | String id = r.getString(1); |
| | 216 | DataSource ds = DataSource.getBySystemCode(r.getString(2)); |
| | 217 | Xref ref = new Xref (id, ds); |
| | 218 | result.add (ref); |
| | 219 | } |
| | 220 | } |
| | 221 | catch (SQLException e) |
| | 222 | { |
| | 223 | throw new IDMapperException(e); |
| | 224 | } |
| | 225 | finally {pst.cleanup(); } |
| | 226 | return result; |
| | 227 | } |
| 229 | | try |
| 230 | | { |
| 231 | | pst.init(); |
| 232 | | ResultSet rs = pst.executeQuery(); |
| 233 | | while (rs.next()) |
| 234 | | { |
| 235 | | DataSource ds = DataSource.getBySystemCode(rs.getString(1)); |
| 236 | | result.add (ds); |
| 237 | | } |
| 238 | | } |
| 239 | | catch (SQLException ignore) |
| 240 | | { |
| 241 | | throw new IDMapperException(ignore); |
| 242 | | } |
| 243 | | finally {pst.cleanup(); } |
| 244 | | return result; |
| | 238 | synchronized (pst) { |
| | 239 | try |
| | 240 | { |
| | 241 | pst.init(); |
| | 242 | ResultSet rs = pst.executeQuery(); |
| | 243 | while (rs.next()) |
| | 244 | { |
| | 245 | DataSource ds = DataSource.getBySystemCode(rs.getString(1)); |
| | 246 | result.add (ds); |
| | 247 | } |
| | 248 | } |
| | 249 | catch (SQLException ignore) |
| | 250 | { |
| | 251 | throw new IDMapperException(ignore); |
| | 252 | } |
| | 253 | finally {pst.cleanup(); } |
| | 254 | return result; |
| | 255 | } |
| 290 | | try { |
| 291 | | pst.init(limit); |
| 292 | | pst.setString(1, "%" + query.toLowerCase() + "%"); |
| 293 | | ResultSet r = pst.executeQuery(); |
| 294 | | |
| 295 | | while(r.next()) |
| 296 | | { |
| 297 | | String id = r.getString("id"); |
| 298 | | String code = r.getString("code"); |
| 299 | | String symbol = r.getString("attrValue"); |
| 300 | | result.put(new Xref (id, DataSource.getBySystemCode(code)), symbol); |
| 301 | | } |
| 302 | | } catch (SQLException e) { |
| 303 | | throw new IDMapperException (e); |
| 304 | | } |
| 305 | | finally {pst.cleanup(); } |
| 306 | | return result; |
| | 301 | synchronized (pst) { |
| | 302 | try { |
| | 303 | pst.init(limit); |
| | 304 | pst.setString(1, "%" + query.toLowerCase() + "%"); |
| | 305 | ResultSet r = pst.executeQuery(); |
| | 306 | |
| | 307 | while(r.next()) |
| | 308 | { |
| | 309 | String id = r.getString("id"); |
| | 310 | String code = r.getString("code"); |
| | 311 | String symbol = r.getString("attrValue"); |
| | 312 | result.put(new Xref (id, DataSource.getBySystemCode(code)), symbol); |
| | 313 | } |
| | 314 | } catch (SQLException e) { |
| | 315 | throw new IDMapperException (e); |
| | 316 | } |
| | 317 | finally {pst.cleanup(); } |
| | 318 | return result; |
| | 319 | } |
| 314 | | try |
| 315 | | { |
| 316 | | pst.init(); |
| 317 | | ResultSet rs = pst.executeQuery(); |
| 318 | | while (rs.next()) |
| 319 | | { |
| 320 | | result.add (rs.getString(1)); |
| 321 | | } |
| 322 | | } |
| 323 | | catch (SQLException ignore) |
| 324 | | { |
| 325 | | throw new IDMapperException(ignore); |
| 326 | | } |
| 327 | | finally {pst.cleanup(); } |
| 328 | | return result; |
| | 327 | synchronized (pst) { |
| | 328 | try |
| | 329 | { |
| | 330 | pst.init(); |
| | 331 | ResultSet rs = pst.executeQuery(); |
| | 332 | while (rs.next()) |
| | 333 | { |
| | 334 | result.add (rs.getString(1)); |
| | 335 | } |
| | 336 | } |
| | 337 | catch (SQLException ignore) |
| | 338 | { |
| | 339 | throw new IDMapperException(ignore); |
| | 340 | } |
| | 341 | finally {pst.cleanup(); } |
| | 342 | return result; |
| | 343 | } |