NativeSQL lists for publications now show the series
git-svn-id: https://svn.libreccm.org/ccm/trunk@5033 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c9885cf0ff
commit
09f021601f
|
|
@ -256,6 +256,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
final PreparedStatement collectedVolumeQueryStatement;
|
final PreparedStatement collectedVolumeQueryStatement;
|
||||||
final PreparedStatement proceedingsQueryStatement;
|
final PreparedStatement proceedingsQueryStatement;
|
||||||
final PreparedStatement organizationQueryStatement;
|
final PreparedStatement organizationQueryStatement;
|
||||||
|
final PreparedStatement seriesQueryStatement;
|
||||||
|
|
||||||
final StringBuffer whereBuffer = new StringBuffer();
|
final StringBuffer whereBuffer = new StringBuffer();
|
||||||
// final int page;
|
// final int page;
|
||||||
|
|
@ -333,6 +334,15 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
+ "JOIN cms_bundles ON cms_items.parent_id = cms_bundles.bundle_id "
|
+ "JOIN cms_bundles ON cms_items.parent_id = cms_bundles.bundle_id "
|
||||||
+ "JOIN ct_unpublished_organization_map ON cms_bundles.bundle_id = ct_unpublished_organization_map.organization_id "
|
+ "JOIN ct_unpublished_organization_map ON cms_bundles.bundle_id = ct_unpublished_organization_map.organization_id "
|
||||||
+ "WHERE ct_unpublished_organization_map.unpublished_id = ?");
|
+ "WHERE ct_unpublished_organization_map.unpublished_id = ?");
|
||||||
|
seriesQueryStatement = connection.prepareStatement(
|
||||||
|
"SELECT cms_items.item_id, name, version, language, master_id, "
|
||||||
|
+ "parent_id, title, cms_pages.description, ct_publications_volume_in_series.volumeofseries "
|
||||||
|
+ "FROM cms_items "
|
||||||
|
+ "JOIN cms_pages ON cms_items.item_id = cms_pages.item_id "
|
||||||
|
+ "JOIN ct_series ON cms_items.item_id = ct_series.series_id "
|
||||||
|
+ "JOIN cms_bundles ON cms_items.parent_id = cms_bundles.bundle_id "
|
||||||
|
+ "JOIN ct_publications_volume_in_series ON cms_bundles.bundle_id = ct_publications_volume_in_series.series_id "
|
||||||
|
+ "WHERE ct_publications_volume_in_series.publication_id = ?");
|
||||||
|
|
||||||
final String orderBy = "ORDER BY year DESC, authors, title ";
|
final String orderBy = "ORDER BY year DESC, authors, title ";
|
||||||
|
|
||||||
|
|
@ -598,6 +608,10 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
mainQueryResult.getBigDecimal("parent_id"),
|
mainQueryResult.getBigDecimal("parent_id"),
|
||||||
publication,
|
publication,
|
||||||
publisherQueryStatement);
|
publisherQueryStatement);
|
||||||
|
generateSeriesNativeSql(
|
||||||
|
mainQueryResult.getBigDecimal("parent_id"),
|
||||||
|
publication,
|
||||||
|
seriesQueryStatement);
|
||||||
|
|
||||||
if (ArticleInJournal.BASE_DATA_OBJECT_TYPE
|
if (ArticleInJournal.BASE_DATA_OBJECT_TYPE
|
||||||
.equals(mainQueryResult.getString("object_type"))) {
|
.equals(mainQueryResult.getString("object_type"))) {
|
||||||
|
|
@ -1391,6 +1405,22 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
generateAuthorsXmlNativeSql(publication, publicationElem);
|
generateAuthorsXmlNativeSql(publication, publicationElem);
|
||||||
generatePublisherXmlNativeSql(publication, publicationElem);
|
generatePublisherXmlNativeSql(publication, publicationElem);
|
||||||
|
|
||||||
|
if (publication.containsKey("series")) {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
final Map<String, Object> series = (Map<String, Object>) publication
|
||||||
|
.get("series");
|
||||||
|
|
||||||
|
final Element seriesElem = publicationElem
|
||||||
|
.newChildElement("series");
|
||||||
|
|
||||||
|
seriesElem.addAttribute("title", Objects.toString(series
|
||||||
|
.get("title")));
|
||||||
|
seriesElem.addAttribute("volume-of-series",
|
||||||
|
Objects.toString(series.get(
|
||||||
|
"volume-of-series")));
|
||||||
|
}
|
||||||
|
|
||||||
if (ArticleInJournal.BASE_DATA_OBJECT_TYPE
|
if (ArticleInJournal.BASE_DATA_OBJECT_TYPE
|
||||||
.equals(publication.get("object_type"))) {
|
.equals(publication.get("object_type"))) {
|
||||||
|
|
||||||
|
|
@ -1802,6 +1832,27 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void generateSeriesNativeSql(
|
||||||
|
final BigDecimal publicationId,
|
||||||
|
final Map<String, Object> publication,
|
||||||
|
final PreparedStatement seriesQueryStatement)
|
||||||
|
throws SQLException {
|
||||||
|
|
||||||
|
seriesQueryStatement.setBigDecimal(1, publicationId);
|
||||||
|
|
||||||
|
try (final ResultSet resultSet = seriesQueryStatement.executeQuery()) {
|
||||||
|
|
||||||
|
if (resultSet.next()) {
|
||||||
|
final Map<String, Object> series = new HashMap<>();
|
||||||
|
series.put("title", resultSet.getString("title"));
|
||||||
|
series.put("volume-of-series", resultSet
|
||||||
|
.getString("volumeofseries"));
|
||||||
|
|
||||||
|
publication.put("series", series);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void generateJournalNativeSql(
|
private void generateJournalNativeSql(
|
||||||
final BigDecimal publicationId,
|
final BigDecimal publicationId,
|
||||||
final Map<String, Object> publication,
|
final Map<String, Object> publication,
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,11 @@ public class PublicationList extends AbstractComponent {
|
||||||
*/
|
*/
|
||||||
private final PreparedStatement organizationQueryStatement;
|
private final PreparedStatement organizationQueryStatement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepared statement for fetching the series of publication.
|
||||||
|
*/
|
||||||
|
private final PreparedStatement seriesQueryStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default limit per of publications per page.
|
* Default limit per of publications per page.
|
||||||
*/
|
*/
|
||||||
|
|
@ -243,6 +248,16 @@ public class PublicationList extends AbstractComponent {
|
||||||
+ "JOIN ct_unpublished_organization_map ON cms_bundles.bundle_id = ct_unpublished_organization_map.organization_id "
|
+ "JOIN ct_unpublished_organization_map ON cms_bundles.bundle_id = ct_unpublished_organization_map.organization_id "
|
||||||
+ "WHERE ct_unpublished_organization_map.unpublished_id = ?");
|
+ "WHERE ct_unpublished_organization_map.unpublished_id = ?");
|
||||||
|
|
||||||
|
seriesQueryStatement = connection.prepareStatement(
|
||||||
|
"SELECT cms_items.item_id, name, version, language, master_id, "
|
||||||
|
+ "parent_id, title, cms_pages.description, ct_publications_volume_in_series.volumeofseries "
|
||||||
|
+ "FROM cms_items "
|
||||||
|
+ "JOIN cms_pages ON cms_items.item_id = cms_pages.item_id "
|
||||||
|
+ "JOIN ct_series ON cms_items.item_id = ct_series.series_id "
|
||||||
|
+ "JOIN cms_bundles ON cms_items.parent_id = cms_bundles.bundle_id "
|
||||||
|
+ "JOIN ct_publications_volume_in_series ON cms_bundles.bundle_id = ct_publications_volume_in_series.series_id "
|
||||||
|
+ "WHERE ct_publications_volume_in_series.publication_id = ?");
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
throw new UncheckedWrapperException(ex);
|
throw new UncheckedWrapperException(ex);
|
||||||
}
|
}
|
||||||
|
|
@ -783,6 +798,8 @@ public class PublicationList extends AbstractComponent {
|
||||||
publicationElem);
|
publicationElem);
|
||||||
generatePublishers(resultSet.getBigDecimal("parent_id"),
|
generatePublishers(resultSet.getBigDecimal("parent_id"),
|
||||||
publicationElem);
|
publicationElem);
|
||||||
|
generateSeries(resultSet.getBigDecimal("parent_id"),
|
||||||
|
publicationElem);
|
||||||
|
|
||||||
if (ArticleInJournal.BASE_DATA_OBJECT_TYPE.equals(resultSet.getString(
|
if (ArticleInJournal.BASE_DATA_OBJECT_TYPE.equals(resultSet.getString(
|
||||||
"object_type"))) {
|
"object_type"))) {
|
||||||
|
|
@ -870,6 +887,26 @@ public class PublicationList extends AbstractComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void generateSeries(final BigDecimal publicationId,
|
||||||
|
final Element publicationElem)
|
||||||
|
throws SQLException {
|
||||||
|
|
||||||
|
seriesQueryStatement.setBigDecimal(1, publicationId);
|
||||||
|
|
||||||
|
try (final ResultSet resultSet = seriesQueryStatement.executeQuery()) {
|
||||||
|
|
||||||
|
if (resultSet.next()) {
|
||||||
|
final Element seriesElem = publicationElem
|
||||||
|
.newChildElement("series");
|
||||||
|
|
||||||
|
seriesElem.addAttribute("title", resultSet.getString("title"));
|
||||||
|
seriesElem.addAttribute(
|
||||||
|
"volume-of-series",
|
||||||
|
resultSet.getString("volumeofseries"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void generateJournal(final BigDecimal articleId,
|
public void generateJournal(final BigDecimal articleId,
|
||||||
final Element publicationElem)
|
final Element publicationElem)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue