View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/ebxmlrr/src/share/com/sun/ebxml/registry/persistence/rdb/RegistryObjectDAO.java,v 1.56 2003/07/24 01:40:58 farrukh_najmi Exp $ 3 */ 4 5 package com.sun.ebxml.registry.persistence.rdb; 6 7 import com.sun.ebxml.registry.RegistryException; 8 import java.sql.Connection; 9 import java.sql.ResultSet; 10 import java.sql.SQLException; 11 import java.sql.Statement; 12 import java.util.ArrayList; 13 import java.util.HashMap; 14 import java.util.Iterator; 15 import org.oasis.ebxml.registry.bindings.query.ResponseOption; 16 import org.oasis.ebxml.registry.bindings.rim.RegistryObject; 17 import org.oasis.ebxml.registry.bindings.rim.RegistryObjectType; 18 import org.oasis.ebxml.registry.bindings.rim.User; 19 20 /*** 21 * 22 * @see <{RegistryEntry}> 23 * @author Farrukh S. Najmi 24 * @author Adrian Chong 25 */ 26 public class RegistryObjectDAO { 27 28 public static String getTableNameStatic() { 29 return "RegistryObject"; 30 } 31 32 public String getTableName() { 33 return getTableNameStatic(); 34 } 35 36 /*** 37 * Generate AuditabEvent 38 */ 39 40 /* 41 public void generateAuditbleEvent(java.sql.Statement stmt, 42 RegistryObjectType roType, String eventType, User user) throws 43 RegistryException { 44 AuditableEvent ae = new AuditableEvent(); 45 ae.setId("urn:uuid:" + UUIDFactory.getInstance().newUUID().toString()); 46 ae.setUser(user); 47 ae.setObjectType("AuditableEvent"); 48 ae.setEventType(EventTypeType.valueOf(eventType)); 49 ae.setRegistryObject(roType.getId()); 50 ae.setTimestamp(new Timestamp( (new java.util.Date()).getTime())); 51 ArrayList aes = new ArrayList(); 52 aes.add(ae); 53 AuditableEventDAO.getInstance().insert(stmt, aes); 54 } 55 */ 56 57 /*** 58 * Generate AuditabEvent 59 */ 60 61 public void generateAuditbleEvent(Connection conn, RegistryObjectType roType, String eventType, User user) throws RegistryException { 62 org.oasis.ebxml.registry.bindings.rim.AuditableEvent ae = new org.oasis.ebxml.registry.bindings.rim.AuditableEvent(); 63 ae.setId("urn:uuid:" + com.sun.ebxml.registry.util.UUIDFactory.getInstance().newUUID().toString()); 64 ae.setUser(user); 65 ae.setObjectType("AuditableEvent"); 66 ae.setEventType(org.oasis.ebxml.registry.bindings.rim.types.EventTypeType.valueOf(eventType)); 67 ae.setRegistryObject(roType.getId()); 68 ae.setTimestamp(new java.sql.Timestamp( (new java.util.Date()).getTime())); 69 ArrayList aes = new ArrayList(); 70 aes.add(ae); 71 AuditableEventDAO.getInstance().insert(conn, aes); 72 } 73 74 /*** 75 * Generate AuditabEvent 76 */ 77 78 public void generateAuditbleEvent(Connection conn, ArrayList ros, String eventType, User user) throws RegistryException { 79 if (ros.size()==0) { 80 return; 81 } 82 AuditableEventDAO aeDAO = AuditableEventDAO.getInstance(); 83 ArrayList aes = new ArrayList(); 84 Iterator iter = ros.iterator(); 85 while(iter.hasNext()) { 86 RegistryObjectType roType = (RegistryObjectType)iter.next(); 87 org.oasis.ebxml.registry.bindings.rim.AuditableEvent ae = new org.oasis.ebxml.registry.bindings.rim.AuditableEvent(); 88 ae.setId("urn:uuid:" + com.sun.ebxml.registry.util.UUIDFactory.getInstance().newUUID().toString()); 89 ae.setUser(user); 90 ae.setObjectType("AuditableEvent"); 91 ae.setEventType(org.oasis.ebxml.registry.bindings.rim.types.EventTypeType.valueOf(eventType)); 92 ae.setRegistryObject(roType.getId()); 93 ae.setTimestamp(new java.sql.Timestamp( (new java.util.Date()).getTime())); 94 aes.add(ae); 95 } 96 aeDAO.insert(conn, aes); 97 } 98 99 // Should we make index on sourceObject/targetObject in Association???? 100 protected String checkAssociationReferences(Connection conn, String roId) throws RegistryException { 101 String assId = null; 102 Statement stmt = null; 103 try { 104 stmt = conn.createStatement(); 105 String sql = "SELECT sourceObject, targetObject, id FROM Association WHERE " 106 + "sourceObject='" + roId + "' OR targetObject='" + roId + "'"; 107 ResultSet rs = stmt.executeQuery(sql); 108 if (rs.next()) { 109 assId = rs.getString("id"); 110 } 111 //stmt.close(); 112 return assId; 113 } 114 catch (SQLException e){ 115 throw new RegistryException(e); 116 } finally { 117 try { 118 if (stmt != null) 119 stmt.close(); 120 } catch (SQLException sqle) { 121 sqle.printStackTrace(); 122 } 123 } 124 } 125 126 // Should we make index on classifiedObject in Classification???? 127 protected String checkClassificationReferences(Connection conn, String roId) throws RegistryException { 128 String classId = null; 129 Statement stmt = null; 130 try { 131 stmt = conn.createStatement(); 132 String sql = "SELECT id FROM Classification WHERE " 133 + "classifiedObject='" + roId + "'"; 134 ResultSet rs = stmt.executeQuery(sql); 135 if (rs.next()) { 136 classId = rs.getString("id"); 137 } 138 //stmt.close(); 139 return classId; 140 } 141 catch (SQLException e){ 142 throw new RegistryException(e); 143 } finally { 144 try { 145 if (stmt != null) 146 stmt.close(); 147 } catch (SQLException sqle) { 148 sqle.printStackTrace(); 149 } 150 } 151 } 152 153 protected void checkReferences(Connection conn, String roId) throws RegistryException { 154 /* 155 * There is a bug where Associations are not being deleted. 156 * Until the bug is fixed we will disable this check. 157 String assId = checkAssociationReferences(conn, roId); 158 if (assId != null) { 159 throw new ReferencesExistException("Association " + assId + " is referencing " + roId); 160 } 161 162 String classId = checkClassificationReferences(conn, roId); 163 if (classId != null) { 164 throw new ReferencesExistException("Classification " + classId + " is classifying " + roId); 165 } 166 */ 167 } 168 169 /*** 170 * Get the objectType of a submitted object in persistence layer 171 * @return null if the object does not exist or the objectType field is null 172 */ 173 174 public String getObjectType(Connection conn, String id, String tableName) 175 throws RegistryException { 176 String sql = "select objectType from " + tableName + " where id='" 177 + id + "'"; 178 System.err.println(sql); 179 Statement stmt = null; 180 try { 181 stmt = conn.createStatement(); 182 ResultSet rs = stmt.executeQuery(sql); 183 boolean hasNextRecord = rs.next(); 184 if (!hasNextRecord) { 185 return null; 186 } 187 else { 188 return rs.getString("objectType"); 189 } 190 } 191 catch (SQLException e){ 192 throw new RegistryException(e); 193 } finally { 194 try { 195 if (stmt != null) 196 stmt.close(); 197 } catch (SQLException sqle) { 198 sqle.printStackTrace(); 199 } 200 } 201 } 202 203 /*** 204 * Does a bulk insert of a Collection of objects that match the type for this persister. 205 * It is for inserting the nested objects, i.e., Name, Description, Slot, Classification 206 * and ExternalIdentifier 207 */ 208 public void insert(User user, Connection connection, ArrayList registryObjects) throws RegistryException { 209 Iterator iter = registryObjects.iterator(); 210 ClassificationDAO classificationDAO = new ClassificationDAO(); 211 DescriptionDAO descriptionDAO = new DescriptionDAO(); 212 ExternalIdentifierDAO externalIdentifierDAO = new ExternalIdentifierDAO(); 213 NameDAO nameDAO = new NameDAO(); 214 SlotDAO slotDAO = new SlotDAO(); 215 while (iter.hasNext()) { 216 RegistryObjectType obj = (RegistryObjectType)iter.next(); 217 218 //Process name atribute 219 org.oasis.ebxml.registry.bindings.rim.InternationalStringType name = obj.getName(); 220 221 if (name != null) { 222 nameDAO.insert(user, connection, obj.getId() 223 , name); 224 } 225 226 227 //Process description atribute 228 org.oasis.ebxml.registry.bindings.rim.InternationalStringType desc = obj.getDescription(); 229 230 if (desc != null) { 231 descriptionDAO.insert(user, connection, obj 232 .getId(), desc); 233 } 234 235 //Now insert Slots for this object 236 org.oasis.ebxml.registry.bindings.rim.Slot[] slots = obj.getSlot(); 237 238 if (slots.length > 0) { 239 ArrayList slots1 = new ArrayList(); 240 for (int i=0; i<slots.length; i++) { 241 slots1.add(slots[i]); 242 } 243 slotDAO.insert(connection, obj.getId(), slots1, true); 244 } 245 246 //Now insert any composed ExternalIdentifiers 247 org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier[] extIds = obj.getExternalIdentifier(); 248 ArrayList extIdsAL = new ArrayList(); 249 for (int i=0; i<extIds.length; i++) { 250 extIdsAL.add(extIds[i]); 251 } 252 if (extIdsAL.size() > 0) { 253 externalIdentifierDAO.insert(user, connection, obj.getId(), extIdsAL); 254 } 255 256 //Now insert any composed Classifications 257 org.oasis.ebxml.registry.bindings.rim.Classification[] classifications = obj.getClassification(); 258 ArrayList classificationsAL = new ArrayList(); 259 for (int i=0; i<classifications.length; i++) { 260 classificationsAL.add(classifications[i]); 261 } 262 if (classificationsAL.size() > 0) { 263 classificationDAO.insert(user, connection, classificationsAL); 264 } 265 } // end looping registryObjects 266 } 267 268 /*** 269 * Does a bulk update of a Collection of objects that match the type for this persister. 270 * It is for updating the nested objects (i.e. Name, Description, Slot, Classification 271 * and ExternalIdentifier. It will firstly delete all the nested objects of each objects 272 * in the ArrayList registryObjects, and then inserts the nested objects again. 273 */ 274 275 public void update(User user, Connection connection, ArrayList registryObjects) throws RegistryException { 276 if (registryObjects.size()==0) { 277 return; 278 } 279 280 Iterator iter = registryObjects.iterator(); 281 ArrayList registryObjectIds = new ArrayList(); 282 283 // Get the ids of all RegistryObject in registryObjects and fix the ids of 284 // nested Classification and ExternalIdentifier 285 com.sun.ebxml.registry.lcm.LifeCycleManagerImpl lcm = com.sun.ebxml.registry.lcm.LifeCycleManagerImpl.getInstance(); 286 287 HashMap idMap = new HashMap(); 288 289 while(iter.hasNext()) { 290 Object obj = iter.next(); 291 if (obj instanceof RegistryObjectType) { 292 RegistryObjectType ro = (RegistryObjectType) obj; 293 registryObjectIds.add(ro.getId()); 294 // Fix the id of nested ExternalIdentifier and also its nested objects 295 org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier[] extIds = ro.getExternalIdentifier(); 296 ArrayList extIdsAL = new ArrayList(); 297 for (int i=0; i<extIds.length; i++) { 298 extIdsAL.add(extIds[i]); 299 } 300 if (extIdsAL.size() > 0) { 301 lcm.fixTemporaryIds(extIdsAL, idMap); 302 } 303 304 // Fix the id of nested Classification and also its nested objects 305 org.oasis.ebxml.registry.bindings.rim.Classification[] classifications = ro.getClassification(); 306 ArrayList classificationsAL = new ArrayList(); 307 for (int i=0; i < classifications.length; i++) { 308 classificationsAL.add(classifications[i]); 309 } 310 if (classificationsAL.size() > 0) { 311 lcm.fixTemporaryIds(classificationsAL, idMap); 312 } 313 } 314 else { 315 throw new RegistryException("Unknown RegistryObjectType!"); 316 } 317 } 318 319 //Delete name atribute for the specified objects 320 NameDAO nameDAO = new NameDAO(); 321 nameDAO.deleteByParentIds(connection, registryObjectIds); 322 323 //Delete description atribute for the specified objects 324 DescriptionDAO descriptionDAO = new DescriptionDAO(); 325 descriptionDAO.deleteByParentIds(connection, registryObjectIds); 326 327 SlotDAO slotDAO = new SlotDAO(); 328 slotDAO.deleteByParentIds(connection, registryObjectIds); 329 330 ExternalIdentifierDAO externalIdentifierDAO = new ExternalIdentifierDAO(); 331 externalIdentifierDAO.deleteByParentIds(user, connection, registryObjectIds); 332 333 ClassificationDAO classificationDAO = new ClassificationDAO(); 334 classificationDAO.deleteByParentIds(user, connection, registryObjectIds); 335 336 // Inserting the composed Name, Description, Slot, Classification and ExternalIdentifier of the ROs 337 /* Now we have to instantiate another RegistryObjectDAO otherwise the 338 insert() of DAO for various types of RO will be called instead if this 339 update() method is being called by update() of DAOs 340 */ 341 RegistryObjectDAO roDAO = new RegistryObjectDAO(); 342 roDAO.insert(user, connection, registryObjects); 343 } 344 345 private ArrayList getRegistryObjectsIds(ArrayList registryObjects) throws RegistryException { 346 //System.err.println("size: " + registryObjects.size()); 347 Iterator iter = registryObjects.iterator(); 348 ArrayList ids = new ArrayList(); 349 while(iter.hasNext()) { 350 //String id = ((RegistryObject)iter.next()).getId(); 351 String id = com.sun.ebxml.registry.util.BindingUtility.getInstance().getObjectId(iter.next()); 352 System.err.println("id!!!!=" + id); 353 ids.add(id); 354 } 355 return ids; 356 } 357 358 359 /*** 360 * Sort registryObjectIds by their objectType. 361 * @return The HashMap storing the objectType String as keys and ArrayList of ids 362 * as values. For ExtrinsicObject, the objectType key is stored as "ExtrinsicObject" 363 * rather than the objectType of the repository items. 364 */ 365 public HashMap sortIdsByObjectType(Connection connection, ArrayList registryObjectIds) throws RegistryException { 366 HashMap map = new HashMap(); 367 Statement stmt = null; 368 369 try { 370 371 if (registryObjectIds.size() > 0) { 372 stmt = connection.createStatement(); 373 374 String str = "SELECT id, objectType FROM " + getTableName() + 375 " WHERE id IN ( "; 376 377 Iterator iter = registryObjectIds.iterator(); 378 while (iter.hasNext()) { 379 String id = (String)iter.next(); 380 381 if (iter.hasNext()) { 382 str = str + "'" + id + "', "; 383 } 384 else { 385 str = str + "'" + id + "' )"; 386 } 387 } 388 389 System.err.println("stmt = " + str); 390 ResultSet rs = stmt.executeQuery(str); 391 392 ArrayList associationsIds = new ArrayList(); 393 ArrayList auditableEventsIds = new ArrayList(); 394 ArrayList classificationsIds = new ArrayList(); 395 ArrayList classificationSchemesIds = new ArrayList(); 396 ArrayList classificationNodesIds = new ArrayList(); 397 ArrayList externalIdentifiersIds = new ArrayList(); 398 ArrayList externalLinksIds = new ArrayList(); 399 ArrayList extrinsicObjectsIds = new ArrayList(); 400 ArrayList organizationsIds = new ArrayList(); 401 ArrayList registryPackagesIds = new ArrayList(); 402 ArrayList serviceBindingsIds = new ArrayList(); 403 ArrayList servicesIds = new ArrayList(); 404 ArrayList specificationLinksIds = new ArrayList(); 405 ArrayList usersIds = new ArrayList(); 406 407 408 while(rs.next()) { 409 String id = rs.getString(1); 410 String objectType = rs.getString(2); 411 // System.err.println("objectType: " + objectType + "!!!!!!!"); 412 if (objectType.equalsIgnoreCase("Association")) { 413 associationsIds.add(id); 414 } 415 else if (objectType.equalsIgnoreCase("AuditableEvent")) { 416 auditableEventsIds.add(id); 417 } 418 else if (objectType.equalsIgnoreCase("Classification")) { 419 classificationsIds.add(id); 420 } 421 else if (objectType.equalsIgnoreCase("ClassificationScheme")) { 422 classificationSchemesIds.add(id); 423 } 424 else if (objectType.equalsIgnoreCase("ClassificationNode")) { 425 classificationNodesIds.add(id); 426 } 427 else if (objectType.equalsIgnoreCase("ExternalIdentifier")) { 428 externalIdentifiersIds.add(id); 429 } 430 else if (objectType.equalsIgnoreCase("ExternalLink")) { 431 externalLinksIds.add(id); 432 } 433 else if (objectType.equalsIgnoreCase("Organization")) { 434 organizationsIds.add(id); 435 } 436 else if (objectType.equalsIgnoreCase("RegistryPackage")) { 437 registryPackagesIds.add(id); 438 } 439 else if (objectType.equalsIgnoreCase("ServiceBinding")) { 440 serviceBindingsIds.add(id); 441 } 442 else if (objectType.equalsIgnoreCase("Service")) { 443 servicesIds.add(id); 444 } 445 else if (objectType.equalsIgnoreCase("SpecificationLink")) { 446 specificationLinksIds.add(id); 447 } 448 else if (objectType.equalsIgnoreCase("User")) { 449 usersIds.add(id); 450 } 451 else { 452 // ExtrinsicObject 453 extrinsicObjectsIds.add(id); 454 } 455 } // end looping ResultSet 456 457 // Now put the ArrayList of id of varios RO type into the HashMap 458 if ( associationsIds.size() > 0) { 459 map.put("Association", associationsIds); 460 } 461 if (auditableEventsIds.size() > 0) { 462 map.put("AuditableEvent", auditableEventsIds); 463 } 464 if (classificationsIds.size() > 0) { 465 map.put("Classification", classificationsIds); 466 } 467 if (classificationSchemesIds.size() > 0) { 468 map.put("ClassificationScheme", classificationSchemesIds); 469 } 470 if (classificationNodesIds.size() > 0) { 471 map.put("ClassificationNode", classificationNodesIds); 472 } 473 if (externalIdentifiersIds.size() > 0) { 474 map.put("ExternalIdentifer", externalIdentifiersIds); 475 } 476 if (externalLinksIds.size() > 0) { 477 map.put("ExternalLink", externalLinksIds); 478 } 479 if (organizationsIds.size() > 0) { 480 map.put("Organization", organizationsIds); 481 } 482 if (registryPackagesIds.size() > 0) { 483 map.put("RegistryPackage", registryPackagesIds); 484 } 485 if (serviceBindingsIds.size() > 0) { 486 map.put("ServiceBinding", serviceBindingsIds); 487 } 488 if (servicesIds.size() > 0) { 489 map.put("Service", servicesIds); 490 } 491 if (specificationLinksIds.size() > 0) { 492 map.put("SpecificationLink", specificationLinksIds); 493 } 494 if (usersIds.size() > 0) { 495 map.put("User", usersIds); 496 } 497 if (extrinsicObjectsIds.size() > 0) { 498 map.put("ExtrinsicObject", extrinsicObjectsIds); 499 } 500 } // end if checking the size of registryObjectsIds 501 } 502 catch (SQLException e) { 503 e.printStackTrace(); 504 throw new RegistryException(e); 505 } finally { 506 try { 507 if (stmt != null) 508 stmt.close(); 509 } catch (SQLException sqle) { 510 sqle.printStackTrace(); 511 } 512 } 513 return map; 514 } 515 516 /*** 517 * Does a bulk delete of a Collection of objects that match the type for this persister. 518 * 519 */ 520 public void delete(User user, Connection connection, ArrayList registryObjectIds) throws RegistryException { 521 if (registryObjectIds.size()==0) { 522 return; 523 } 524 525 System.err.println("Deleting " + registryObjectIds.size() + " " + getTableName()); 526 527 //Delete name atribute for the specified objects 528 NameDAO nameDAO = new NameDAO(); 529 nameDAO.deleteByParentIds(connection, registryObjectIds); 530 531 //Delete description atribute for the specified objects 532 DescriptionDAO descriptionDAO = new DescriptionDAO(); 533 descriptionDAO.deleteByParentIds(connection, registryObjectIds); 534 535 SlotDAO slotDAO = new SlotDAO(); 536 slotDAO.deleteByParentIds(connection, registryObjectIds); 537 538 ExternalIdentifierDAO externalIdentifierDAO = new ExternalIdentifierDAO(); 539 externalIdentifierDAO.deleteByParentIds(user, connection, registryObjectIds); 540 541 ClassificationDAO classificationDAO = new ClassificationDAO(); 542 classificationDAO.deleteByParentIds(user, connection, registryObjectIds); 543 Statement stmt = null; 544 545 try { 546 stmt = connection.createStatement(); 547 548 Iterator iter = registryObjectIds.iterator(); 549 ArrayList ros = new ArrayList(); 550 while (iter.hasNext()) { 551 String registryObjectId = (String)iter.next(); 552 // Check any other references 553 checkReferences(connection, registryObjectId); 554 stmt.addBatch("DELETE from " + getTableName() + " WHERE id = '" + 555 registryObjectId + "' "); 556 RegistryObject ro = new RegistryObject(); 557 ro.setId(registryObjectId); 558 ros.add(ro); 559 } 560 561 int [] updateCounts = stmt.executeBatch(); 562 //stmt.close(); 563 // Now generate the AE for deleting RO 564 generateAuditbleEvent(connection, ros, "Deleted", user); 565 } 566 catch (SQLException e) { 567 RegistryException exception = new RegistryException(e); 568 throw exception; 569 } finally { 570 try { 571 if (stmt != null) 572 stmt.close(); 573 } catch (SQLException sqle) { 574 sqle.printStackTrace(); 575 } 576 } 577 578 } 579 580 /*** 581 * Return true if the RegistryObject exist 582 */ 583 public boolean registryObjectExist(Connection conn, String id) throws RegistryException{ 584 585 Statement stmt = null; 586 try { 587 stmt = conn.createStatement(); 588 String sql = "SELECT id from RegistryObject where id='"+ id +"'"; 589 ResultSet rs = stmt.executeQuery(sql); 590 boolean result = false; 591 if (rs.next()) { 592 result = true; 593 } 594 //stmt.close(); 595 return result; 596 597 } 598 catch(SQLException e) { 599 throw new RegistryException(e); 600 } finally { 601 try { 602 if (stmt != null) 603 stmt.close(); 604 } catch (SQLException sqle) { 605 sqle.printStackTrace(); 606 } 607 } 608 } 609 610 /*** 611 * Check whether the object exists in the specified table. 612 */ 613 public boolean registryObjectExist(Connection conn, String id, String tableName) throws RegistryException{ 614 Statement stmt = null; 615 try { 616 stmt = conn.createStatement(); 617 String sql = "SELECT id from " + tableName + " where id='"+ id +"'"; 618 ResultSet rs = stmt.executeQuery(sql); 619 boolean result = false; 620 if (rs.next()) { 621 result = true; 622 } 623 //stmt.close(); 624 return result; 625 } 626 catch(SQLException e) { 627 throw new RegistryException(e); 628 } finally { 629 try { 630 if (stmt != null) 631 stmt.close(); 632 } catch (SQLException sqle) { 633 sqle.printStackTrace(); 634 } 635 } 636 } 637 638 /*** 639 * Returns ArrayList of ids of non-existent RegistryObject. 640 */ 641 public ArrayList registryObjectsExist(Connection conn, ArrayList ids) throws RegistryException { 642 ArrayList notExistIdList = new ArrayList(); 643 Iterator iter = ids.iterator(); 644 Statement stmt = null; 645 try { 646 stmt = conn.createStatement(); 647 while (iter.hasNext()) { 648 String id = (String)iter.next(); 649 ResultSet rs = stmt.executeQuery("select id from RegistryObject where " + 650 "id = '" + id+ "'"); 651 if (!rs.next()) { 652 // the RegistryObject does not exist 653 notExistIdList.add(id); 654 } 655 } 656 //stmt.close(); 657 } 658 catch(SQLException e) { 659 throw new RegistryException(e); 660 } finally { 661 try { 662 if (stmt != null) 663 stmt.close(); 664 } catch (SQLException sqle) { 665 sqle.printStackTrace(); 666 } 667 } 668 return notExistIdList; 669 } 670 671 /*** 672 * Returns ArrayList of ids of non-existent RegistryObject. 673 */ 674 public ArrayList registryObjectsExist(Connection conn, ArrayList ids, String tableName) throws RegistryException { 675 ArrayList notExistIdList = new ArrayList(); 676 if (ids.size()==0) { 677 return notExistIdList; 678 } 679 Iterator iter = ids.iterator(); 680 Statement stmt = null; 681 try { 682 683 stmt = conn.createStatement(); 684 String sql = "SELECT id FROM " + tableName + " WHERE id IN ("; 685 ArrayList existingIdList = new ArrayList(); 686 /* We need to count the number of item in "IN" list. We need to split the a single 687 SQL Strings if it is too long. Some database such as Oracle, does not 688 allow the IN list is too long*/ 689 int listCounter = 0; 690 while (iter.hasNext()) { 691 String id = (String)iter.next(); 692 if (iter.hasNext() && listCounter < 99 ) { 693 sql += "'" + id + "',"; 694 } 695 else { 696 sql += "'" + id + "')"; 697 //System.err.println("!!!!!!!!!!!!!!!!!!!" + sql); 698 ResultSet rs = stmt.executeQuery(sql); 699 while (rs.next()) { 700 existingIdList.add(rs.getString("id")); 701 } 702 sql = "SELECT id FROM " + tableName + " WHERE id IN ("; 703 listCounter = 0; 704 } 705 listCounter++; 706 } 707 708 for(int i=0; i < ids.size(); i++) { 709 String id = (String) ids.get(i); 710 if (!existingIdList.contains(id)) { 711 notExistIdList.add(id); 712 } 713 } 714 //stmt.close(); 715 } 716 catch(SQLException e){ 717 throw new RegistryException(e); 718 } finally { 719 try { 720 if (stmt != null) 721 stmt.close(); 722 } catch (SQLException sqle) { 723 sqle.printStackTrace(); 724 } 725 } 726 return notExistIdList; 727 } 728 729 /*** 730 * It is to update exisitng Registry Objects when any existing objects can be 731 * found within SubmitObjectsRequest. It should be called by the method 732 * insert() of subclass DAO. 733 * @return ArrayList of RegistryObjects that are not existing 734 */ 735 protected ArrayList updateExistingObjects(User user, Connection conn, ArrayList ros) throws RegistryException { 736 737 //System.err.println("Updating!!!"); 738 com.sun.ebxml.registry.util.BindingUtility bindingUtility = com.sun.ebxml.registry.util.BindingUtility.getInstance(); 739 //System.err.println(getTableName() + "!!!"); 740 ArrayList notExistIds = registryObjectsExist(conn, bindingUtility 741 .getIdsFromRegistryObjects(ros), getTableName()); // getTableName() is the one which is the overidding one of subclass DAO 742 ArrayList notExistROs = bindingUtility.getRegistryObjectsFromIds(ros, notExistIds); 743 ArrayList existingROs = new ArrayList(); 744 Iterator rosIter = ros.iterator(); 745 while(rosIter.hasNext()) { 746 RegistryObjectType ro = (RegistryObjectType)rosIter.next(); 747 if (!notExistROs.contains(ro)) { 748 existingROs.add(ro); 749 } 750 } 751 //System.err.println(existingROs.size() + "!!!!"); 752 /* 753 We do not check the existence because we are sure all the objects passed to this method are all existing. 754 But we re-check the authorization again. The first authorization checking is not done in persistence layer. 755 SHOULD WE MAKE THE AUTHORIZATION ALWAYS IN PERSISTENCE LAYER???? IT IS MORE CONSISTENT 756 */ 757 update(user, conn, existingROs, false, true); 758 return notExistROs; 759 760 } 761 762 /*** 763 * This should be overrided by subclass DAO. It is called by updateExistingObjects() methods. 764 */ 765 protected void update(User user, Connection conn, ArrayList ros, boolean checkExistence, boolean checkAuthorization) throws RegistryException { 766 throw new RegistryException("Implementation Error: method should be implemented by sub-class but is not"); 767 } 768 769 public static ArrayList getByIds(Connection conn, ArrayList ids, boolean getComposedObjects) throws RegistryException { 770 ArrayList res = new ArrayList(); 771 Statement stmt = null; 772 773 try { 774 stmt = conn.createStatement(); 775 ResultSet rs = null; 776 777 Iterator iter = ids.iterator(); 778 StringBuffer idsSB = new StringBuffer(); 779 while (iter.hasNext()) { 780 String id = (String)iter.next(); 781 idsSB.append("'"); 782 idsSB.append(id); 783 idsSB.append("'"); 784 if (iter.hasNext()) { 785 idsSB.append(", "); 786 } 787 } 788 789 while (iter.hasNext()) { 790 String id = (String)iter.next(); 791 RegistryObject ro = new RegistryObject(); 792 ro.setId(id); 793 794 rs = stmt.executeQuery("select * from RegistryObject where id IN (" + idsSB + ")"); 795 while(rs.next()) { 796 ro.setAccessControlPolicy(null); 797 ro.setObjectType(rs.getString("objectType")); 798 } 799 rs.close(); 800 801 rs = stmt.executeQuery("select * from Name where parent = '" + id + "'"); 802 org.oasis.ebxml.registry.bindings.rim.Name name = new org.oasis.ebxml.registry.bindings.rim.Name(); 803 ro.setName(name); 804 while(rs.next()) { 805 org.oasis.ebxml.registry.bindings.rim.LocalizedString ls = new org.oasis.ebxml.registry.bindings.rim.LocalizedString(); 806 ls.setCharset(rs.getString("charset")); 807 ls.setLang(rs.getString("lang")); 808 ls.setValue(rs.getString("value")); 809 org.oasis.ebxml.registry.bindings.rim.InternationalStringTypeItem isi = new org.oasis.ebxml.registry.bindings.rim.InternationalStringTypeItem(); 810 isi.setLocalizedString(ls); 811 name.addInternationalStringTypeItem(isi); 812 } 813 rs.close(); 814 815 res.add(ro); 816 } 817 } catch (SQLException e) { 818 e.printStackTrace(); 819 System.err.println(e.toString()); 820 throw new RegistryException(e); 821 } finally { 822 try { 823 if (stmt != null) 824 stmt.close(); 825 } catch (SQLException sqle) { 826 sqle.printStackTrace(); 827 } 828 } 829 830 return res; 831 } 832 833 ArrayList getRegistryObjectList(Connection conn, ResultSet rs, ResponseOption responseOption) throws RegistryException { 834 ArrayList res = new ArrayList(); 835 836 try { 837 while(rs.next()) { 838 RegistryObject ro = new RegistryObject(); 839 loadObjectFromResultSet(conn, ro, rs, responseOption, new ArrayList()); 840 841 res.add(ro); 842 } 843 } 844 catch (SQLException e) { 845 e.printStackTrace(); 846 throw new RegistryException(e); 847 } 848 849 return res; 850 } 851 852 public void loadObjectFromResultSet(Connection conn, Object obj, ResultSet rs, ResponseOption responseOption, ArrayList objectRefs) throws RegistryException { 853 try { 854 if (!(obj instanceof RegistryObjectType)) { 855 throw new RegistryException("Unexpected object " + obj + ". Was expecting org.oasis.ebxml.registry.bindings.rim.RegistryObjectType."); 856 } 857 858 RegistryObjectType ro = (RegistryObjectType)obj; 859 ro.setAccessControlPolicy(null); 860 861 String id = rs.getString("id"); 862 ro.setId(id); 863 864 String objectType = rs.getString("objectType"); 865 ro.setObjectType(objectType); 866 867 NameDAO nameDAO = new NameDAO(); 868 org.oasis.ebxml.registry.bindings.rim.Name name = nameDAO.getNameByParent(conn, id); 869 ro.setName(name); 870 871 DescriptionDAO descriptionDAO = new DescriptionDAO(); 872 org.oasis.ebxml.registry.bindings.rim.Description desc = descriptionDAO.getDescriptionByParent(conn, id); 873 ro.setDescription(desc); 874 875 SlotDAO slotDAO = new SlotDAO(); 876 ArrayList slots = slotDAO.getSlotsByParent(conn, id); 877 org.oasis.ebxml.registry.bindings.rim.Slot[] slots1 = new org.oasis.ebxml.registry.bindings.rim.Slot[slots.size()]; 878 879 Iterator iter = slots.iterator(); 880 int i=0; 881 while (iter.hasNext()) { 882 slots1[i++] = (org.oasis.ebxml.registry.bindings.rim.Slot) iter.next(); 883 } 884 ro.setSlot(slots1); 885 886 boolean returnComposedObjects = responseOption.getReturnComposedObjects(); 887 if (returnComposedObjects) { 888 ClassificationDAO classificationDAO = new ClassificationDAO(); 889 ArrayList classifications = classificationDAO.getByParentId(conn, id, responseOption, objectRefs); 890 iter = classifications.iterator(); 891 while (iter.hasNext()) { 892 org.oasis.ebxml.registry.bindings.rim.Classification c = (org.oasis.ebxml.registry.bindings.rim.Classification)iter.next(); 893 objectRefs.add(c.getClassifiedObject()); 894 org.oasis.ebxml.registry.bindings.rim.ObjectRef refClassScheme = (org.oasis.ebxml.registry.bindings.rim.ObjectRef) c.getClassificationScheme(); 895 org.oasis.ebxml.registry.bindings.rim.ObjectRef refClassNode = (org.oasis.ebxml.registry.bindings.rim.ObjectRef) c.getClassificationNode(); 896 if (refClassScheme != null) { 897 objectRefs.add(refClassScheme); 898 } 899 if (refClassNode != null) { 900 objectRefs.add(refClassNode); 901 } 902 ro.addClassification(c); 903 } 904 ExternalIdentifierDAO externalIdentifierDAO = new ExternalIdentifierDAO(); 905 ArrayList extIds = externalIdentifierDAO.getByParentId(conn, id, objectRefs); 906 iter = extIds.iterator(); 907 while (iter.hasNext()) { 908 org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier ei = (org.oasis.ebxml.registry.bindings.rim.ExternalIdentifier)iter.next(); 909 ro.addExternalIdentifier(ei); 910 } 911 } 912 } 913 catch (SQLException e) { 914 e.printStackTrace(); 915 throw new RegistryException(e); 916 } 917 } 918 919 private void getRegistryObjectsIdsFromResultSet(ResultSet rs 920 , StringBuffer associations 921 , StringBuffer auEvents 922 , StringBuffer classifications 923 , StringBuffer schemes 924 , StringBuffer classificationNodes 925 , StringBuffer externalIds 926 , StringBuffer externalLinks 927 , StringBuffer extrinsicObjects 928 , StringBuffer organizations 929 , StringBuffer packages 930 , StringBuffer serviceBindings 931 , StringBuffer services 932 , StringBuffer specificationLinks 933 , StringBuffer users 934 ) throws SQLException { 935 936 937 while(rs.next()) { 938 String id = rs.getString("id"); 939 String type = rs.getString("objectType"); 940 941 //System.err.println("objectType = '" + type + "'"); 942 943 if (type.equalsIgnoreCase("Association")) { 944 if (associations.length()==0) { 945 associations.append("'" + id + "'"); 946 } 947 else { 948 associations.append(",'" + id + "'"); 949 } 950 } 951 else if (type.equalsIgnoreCase("AuditableEvent")) { 952 if (auEvents.length()==0) { 953 auEvents.append("'" + id + "'"); 954 } 955 else { 956 auEvents.append(",'" + id + "'"); 957 } 958 } 959 else if (type.equalsIgnoreCase("Classification")) { 960 if (classifications.length()==0) { 961 classifications.append("'" + id + "'"); 962 } 963 else { 964 classifications.append(",'" + id + "'"); 965 } 966 } 967 else if (type.equalsIgnoreCase("ClassificationNode")) { 968 if (classificationNodes.length()==0) { 969 classificationNodes.append("'" + id + "'"); 970 } 971 else { 972 classificationNodes.append(",'" + id + "'"); 973 } 974 } 975 else if (type.equalsIgnoreCase("ClassificationScheme")) { 976 if (schemes.length()==0) { 977 schemes.append("'" + id + "'"); 978 } 979 else { 980 schemes.append(",'" + id + "'"); 981 } 982 } 983 else if (type.equalsIgnoreCase("ExternalIdentifier")) { 984 if (externalIds.length()==0) { 985 externalIds.append("'" + id + "'"); 986 } 987 else { 988 externalIds.append(",'" + id + "'"); 989 } 990 } 991 else if (type.equalsIgnoreCase("ExternalLink")) { 992 if (externalLinks.length()==0) { 993 externalLinks.append("'" + id + "'"); 994 } 995 else { 996 externalLinks.append(",'" + id + "'"); 997 } 998 } 999 else if (type.equalsIgnoreCase("ExtrinsicObject")) { 1000 if (extrinsicObjects.length()==0) { 1001 extrinsicObjects.append("'" + id + "'"); 1002 } 1003 else { 1004 extrinsicObjects.append(",'" + id + "'"); 1005 } 1006 } 1007 else if (type.equalsIgnoreCase("Organization")) { 1008 if (organizations.length()==0) { 1009 organizations.append("'" + id + "'"); 1010 } 1011 else { 1012 organizations.append(",'" + id + "'"); 1013 } 1014 } 1015 else if (type.equalsIgnoreCase("RegistryPackage")) { 1016 if (packages.length()==0) { 1017 packages.append("'" + id + "'"); 1018 } 1019 else { 1020 packages.append(",'" + id + "'"); 1021 } 1022 } 1023 else if (type.equalsIgnoreCase("ServiceBinding")) { 1024 if (serviceBindings.length()==0) { 1025 serviceBindings.append("'" + id + "'"); 1026 } 1027 else { 1028 serviceBindings.append(",'" + id + "'"); 1029 } 1030 } 1031 else if (type.equalsIgnoreCase("Service")) { 1032 if (services.length()==0) { 1033 services.append("'" + id + "'"); 1034 } 1035 else { 1036 services.append(",'" + id + "'"); 1037 } 1038 } 1039 else if (type.equalsIgnoreCase("SpecificationLink")) { 1040 if (specificationLinks.length()==0) { 1041 specificationLinks.append("'" + id + "'"); 1042 } 1043 else { 1044 specificationLinks.append(",'" + id + "'"); 1045 } 1046 } 1047 else if (type.equalsIgnoreCase("User")) { 1048 if (users.length()==0) { 1049 users.append("'" + id + "'"); 1050 } 1051 else { 1052 users.append(",'" + id + "'"); 1053 } 1054 } 1055 else { 1056 //??This is dangerous. Need a better way to tell ExtrinsicObjects 1057 if (extrinsicObjects.length()==0) { 1058 extrinsicObjects.append("'" + id + "'"); 1059 } 1060 else { 1061 extrinsicObjects.append(",'" + id + "'"); 1062 } 1063 } 1064 1065 } 1066 } 1067 1068 public ArrayList getLeafObjectList(Connection conn, ResultSet rs, ResponseOption responseOption, ArrayList objectRefs) throws RegistryException { 1069 1070 ArrayList res = new ArrayList(); 1071 String sql = null; 1072 1073 StringBuffer associationsIds = new StringBuffer(); 1074 StringBuffer auditableEventsIds = new StringBuffer(); 1075 StringBuffer classificationsIds = new StringBuffer(); 1076 StringBuffer schemesIds = new StringBuffer(); 1077 StringBuffer classificationNodesIds = new StringBuffer(); 1078 StringBuffer externalIdsIds = new StringBuffer(); 1079 StringBuffer externalLinksIds = new StringBuffer(); 1080 StringBuffer extrinsicObjectsIds = new StringBuffer(); 1081 StringBuffer organizationsIds = new StringBuffer(); 1082 StringBuffer packagesIds = new StringBuffer(); 1083 StringBuffer serviceBindingsIds = new StringBuffer(); 1084 StringBuffer servicesIds = new StringBuffer(); 1085 StringBuffer specificationLinksIds = new StringBuffer(); 1086 StringBuffer usersIds = new StringBuffer(); 1087 1088 Statement stmt = null; 1089 1090 1091 try { 1092 stmt = conn.createStatement(); 1093 1094 getRegistryObjectsIdsFromResultSet(rs, associationsIds, auditableEventsIds 1095 , classificationsIds, schemesIds, classificationNodesIds, externalIdsIds 1096 , externalLinksIds, extrinsicObjectsIds, organizationsIds, packagesIds 1097 , serviceBindingsIds, servicesIds, specificationLinksIds, usersIds); 1098 1099 ResultSet leafObjectsRs = null; 1100 if (associationsIds.length() > 0) { 1101 AssociationDAO assDAO = new AssociationDAO(); 1102 sql = "SELECT * FROM " + assDAO.getTableName() + " WHERE id IN (" + associationsIds + ")"; 1103 //System.out.println(sql); 1104 leafObjectsRs = stmt.executeQuery(sql); 1105 res.addAll(assDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1106 } 1107 if (auditableEventsIds.length() > 0) { 1108 AuditableEventDAO aeDAO = new AuditableEventDAO(); 1109 sql = "SELECT * FROM " + aeDAO.getTableName() + " WHERE id IN (" + auditableEventsIds + ")"; 1110 leafObjectsRs = stmt.executeQuery(sql); 1111 res.addAll(aeDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1112 } 1113 if (classificationsIds.length() > 0) { 1114 ClassificationDAO classDAO = new ClassificationDAO(); 1115 sql = "SELECT * FROM " + classDAO.getTableName() + " WHERE id IN (" + classificationsIds + ")"; 1116 leafObjectsRs = stmt.executeQuery(sql); 1117 res.addAll(classDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1118 } 1119 if (schemesIds.length() > 0) { 1120 ClassificationSchemeDAO schemeDAO = new ClassificationSchemeDAO(); 1121 sql = "SELECT * FROM " + schemeDAO.getTableName() + " WHERE id IN (" + schemesIds + ")"; 1122 leafObjectsRs = stmt.executeQuery(sql); 1123 res.addAll(schemeDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1124 } 1125 if (classificationNodesIds.length() > 0) { 1126 ClassificationNodeDAO nodeDAO = new ClassificationNodeDAO(); 1127 sql = "SELECT * FROM " + nodeDAO.getTableName() + " WHERE id IN (" + classificationNodesIds + ")"; 1128 leafObjectsRs = stmt.executeQuery(sql); 1129 res.addAll(nodeDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1130 } 1131 if (externalIdsIds.length() > 0) { 1132 ExternalIdentifierDAO externalIdDAO = new ExternalIdentifierDAO(); 1133 sql = "SELECT * FROM " + externalIdDAO.getTableName() + " WHERE id IN (" + externalIdsIds + ")"; 1134 leafObjectsRs = stmt.executeQuery(sql); 1135 res.addAll(externalIdDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1136 } 1137 if (externalLinksIds.length() > 0) { 1138 ExternalLinkDAO externalLinkDAO = new ExternalLinkDAO(); 1139 sql = "SELECT * FROM " + externalLinkDAO.getTableName() + " WHERE id IN (" + externalLinksIds + ")"; 1140 leafObjectsRs = stmt.executeQuery(sql); 1141 res.addAll(externalLinkDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1142 } 1143 if (extrinsicObjectsIds.length() > 0) { 1144 ExtrinsicObjectDAO extrinsicObjectDAO = new ExtrinsicObjectDAO(); 1145 sql = "SELECT * FROM " + extrinsicObjectDAO.getTableName() + " WHERE id IN (" + extrinsicObjectsIds + ")"; 1146 leafObjectsRs = stmt.executeQuery(sql); 1147 res.addAll(extrinsicObjectDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1148 } 1149 if (organizationsIds.length() > 0) { 1150 OrganizationDAO organizationDAO = new OrganizationDAO(); 1151 sql = "SELECT * FROM " + organizationDAO.getTableName() + " WHERE id IN (" + organizationsIds + ")"; 1152 leafObjectsRs = stmt.executeQuery(sql); 1153 res.addAll(organizationDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1154 } 1155 if (packagesIds.length() > 0) { 1156 RegistryPackageDAO pkgDAO = new RegistryPackageDAO(); 1157 sql = "SELECT * FROM " + pkgDAO.getTableName() + " WHERE id IN (" + packagesIds + ")"; 1158 leafObjectsRs = stmt.executeQuery(sql); 1159 res.addAll(pkgDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1160 } 1161 if (serviceBindingsIds.length() > 0) { 1162 ServiceBindingDAO serviceBindingDAO = new ServiceBindingDAO(); 1163 sql = "SELECT * FROM " + serviceBindingDAO.getTableName() + " WHERE id IN (" + serviceBindingsIds + ")"; 1164 leafObjectsRs = stmt.executeQuery(sql); 1165 res.addAll(serviceBindingDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1166 } 1167 if (servicesIds.length() > 0) { 1168 ServiceDAO serviceDAO = new ServiceDAO(); 1169 sql = "SELECT * FROM " + serviceDAO.getTableName() + " WHERE id IN (" + servicesIds + ")"; 1170 leafObjectsRs = stmt.executeQuery(sql); 1171 res.addAll(serviceDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1172 } 1173 if (specificationLinksIds.length() > 0) { 1174 SpecificationLinkDAO specLinkDAO = new SpecificationLinkDAO(); 1175 sql = "SELECT * FROM " + specLinkDAO.getTableName() + " WHERE id IN (" + specificationLinksIds + ")"; 1176 leafObjectsRs = stmt.executeQuery(sql); 1177 res.addAll(specLinkDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1178 } 1179 if (usersIds.length() > 0) { 1180 UserDAO userDAO = new UserDAO(); 1181 sql = "SELECT * FROM " + userDAO.getTableName() + " WHERE id IN (" + usersIds + ")"; 1182 leafObjectsRs = stmt.executeQuery(sql); 1183 res.addAll(userDAO.getLeafObjectList(conn, leafObjectsRs, responseOption, objectRefs)); 1184 } 1185 } 1186 catch (SQLException e) { 1187 e.printStackTrace(); 1188 throw new RegistryException(e); 1189 } finally { 1190 try { 1191 if (stmt != null) 1192 stmt.close(); 1193 } catch (SQLException sqle) { 1194 sqle.printStackTrace(); 1195 } 1196 } 1197 1198 return res; 1199 } 1200 1201 /*** 1202 * Get the User that is the owner for the object with specified objectId 1203 */ 1204 public static User getOwner(Connection connection, String objectId) throws RegistryException, SQLException { 1205 User owner = null; 1206 1207 Statement stmt = connection.createStatement(); 1208 1209 String query = "SELECT * from User_ u WHERE u.id IN (SELECT user_ from AuditableEvent where registryObject = '" + objectId + "' AND eventType = 'Created') "; 1210 System.err.println("query=" + query); 1211 ResultSet rs = stmt.executeQuery(query); 1212 1213 UserDAO userDAO = new UserDAO(); 1214 if (rs.next()) { 1215 1216 owner = new User(); 1217 ResponseOption responseOption = new ResponseOption(); 1218 responseOption.setReturnComposedObjects(false); 1219 userDAO.loadObjectFromResultSet(connection, owner, rs, responseOption, new ArrayList()); 1220 } 1221 else { 1222 throw new com.sun.ebxml.registry.security.OwnerNotFoundException(objectId); 1223 } 1224 1225 stmt.close(); 1226 1227 return owner; 1228 } 1229 1230 /*** 1231 * Get a HashMap with registry object id as key and owner id as value 1232 */ 1233 public HashMap getOwnersMap(Connection connection, ArrayList ids) throws RegistryException { 1234 Statement stmt = null; 1235 HashMap ownersMap = new HashMap(); 1236 if (ids.size() == 0) { 1237 return ownersMap; 1238 } 1239 try { 1240 stmt = connection.createStatement(); 1241 StringBuffer idsList = com.sun.ebxml.registry.util.BindingUtility.getInstance().getIdListFromIds(ids); 1242 String query = "SELECT ae.registryObject, ae.user_ FROM AuditableEvent ae WHERE ae.registryObject IN (" + 1243 idsList + ") AND ae.eventType = 'Created'"; 1244 System.err.println(query); 1245 ResultSet rs = stmt.executeQuery(query); 1246 while(rs.next()) { 1247 ownersMap.put(rs.getString(1), rs.getString(2)); 1248 } 1249 return ownersMap; 1250 } 1251 catch (SQLException e) { 1252 e.printStackTrace(); 1253 throw new RegistryException(e); 1254 } finally { 1255 try { 1256 if (stmt != null) 1257 stmt.close(); 1258 } catch (SQLException sqle) { 1259 sqle.printStackTrace(); 1260 } 1261 } 1262 } 1263 }

This page was automatically generated by Maven