/** * Returns a list of BibliographicItems from the metadata database. * * @param dbManager the database manager * @param conn the database connection * @return a list of BibliobraphicItems from the metadata database. */ public static List<BibliographicItem> getBibliographicItems( DbManager dbManager, Connection conn) { final String DEBUG_HEADER = "getBibliographicItems(): "; BibliographicItem previousItem = null; List<BibliographicItem> items = new ArrayList<BibliographicItem>(); PreparedStatement statement = null; ResultSet resultSet = null; try { if (log.isDebug3()) log.debug3(DEBUG_HEADER + "bibliographicItemsQuery = " + bibliographicItemsQuery); statement = dbManager.prepareStatement(conn, bibliographicItemsQuery); resultSet = dbManager.executeQuery(statement); while (resultSet.next()) { BibliographicItem item = new BibliographicDatabaseItem(resultSet); // Avoid adding items that differ only in some proprietary identifier. if (!item.sameInNonProprietaryIdProperties(previousItem)) { items.add(item); } } } catch (IllegalArgumentException ex) { log.warning(ex.getMessage()); log.warning("bibliographicItemsQuery = " + bibliographicItemsQuery); } catch (SQLException ex) { log.warning(ex.getMessage()); log.warning("bibliographicItemsQuery = " + bibliographicItemsQuery); } catch (DbException ex) { log.warning(ex.getMessage()); log.warning("bibliographicItemsQuery = " + bibliographicItemsQuery); } finally { DbManager.safeCloseResultSet(resultSet); DbManager.safeCloseStatement(statement); } return items; }
/** * Provides an indication of whether there are no differences between this object and another * one in anything other than proprietary identifiers. * * @param other A BibliographicItem with the other object. * @return <code>true</code> if there are no differences in anything other than their * proprietary identifiers, <code>false</code> otherwise. */ @Override public boolean sameInNonProprietaryIdProperties(BibliographicItem other) { return other != null && areSameProperty(publisher, other.getPublisherName()) && areSameProperty(seriesTitle, other.getSeriesTitle()) && areSameProperty(publicationTitle, other.getPublicationTitle()) && areSameProperty(eissn, other.getEissn()) && areSameProperty(printissn, other.getPrintIssn()) && areSameProperty(eisbn, other.getEisbn()) && areSameProperty(printisbn, other.getPrintIsbn()) && areSameProperty(year, other.getYear()) && areSameProperty(volume, other.getVolume()) && areSameProperty(coverageDepth, other.getCoverageDepth()) && areSameProperty(publicationType, other.getPublicationType()) && areSameProperty(provider, other.getProviderName()); }