Fixed typos

git-svn-id: https://svn.libreccm.org/ccm/trunk@4968 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2017-08-31 12:56:05 +00:00
parent bc4fe63b24
commit 74df11a33f
2 changed files with 61 additions and 86 deletions

View File

@ -113,7 +113,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
private static final Logger s_log = LogManager.getLogger(
ContentSectionServlet.class);
/**
* Stringarray of file name patterns for index files.
* String array of file name patterns for index files.
*/
// private static final String[] WELCOME_FILES = new String[]{
// "index.jsp", "index.html"
@ -284,8 +284,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
s_log.debug("Path info is: " + pathInfo);
if (CMSConfig.getInstanceOf().getUseLanguageExtension()
&& (!pathInfo.endsWith(".jsp")
|| !pathInfo.endsWith(".xml"))) {
&& (!pathInfo.endsWith(".jsp") || !pathInfo.endsWith(".xml"))) {
if (pathInfo.lastIndexOf(".") == -1) {
final String lang;
@ -341,13 +340,15 @@ public class ContentSectionServlet extends BaseApplicationServlet {
}
}
final ContentItem item = getItem(section, pathInfo, sreq, sresp,
final ContentItem item = getItem(section,
pathInfo,
sreq,
sresp,
itemResolver);
Assert.exists(pathInfo,
"String pathInfo");
if (pathInfo.length()
> 1 && pathInfo.endsWith("/")) {
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
* start with a '/' character. It currently carries a
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
@ -362,8 +363,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
// Serve the page
// ////////////////////////////////////////////////////////////////////
/* FIRST try new style servlet based service */
if (page
!= null) {
if (page != null) {
// Check user access.
// checkUserAccess(sreq, sresp); // done in individual pages ??
@ -384,8 +384,7 @@ public class ContentSectionServlet extends BaseApplicationServlet {
}
/* SECONDLY try if we have to serve an item (old style dispatcher based */
} else if (item
!= null) {
} else if (item != null) {
/* We have to serve an item here */
String param = sreq.getParameter("transID");

View File

@ -138,6 +138,12 @@ public class PublicationList extends AbstractComponent {
*/
private final PreparedStatement proceedingsQueryStatement;
/**
* Prepared statement for fetching the organisation of grey literature
* publications.
*/
private final PreparedStatement organizationQueryStatement;
/**
* Default limit per of publications per page.
*/
@ -227,6 +233,15 @@ public class PublicationList extends AbstractComponent {
+ "WHERE ct_proceedings_papers_map.paper_id = ?"
);
organizationQueryStatement = connection.prepareStatement(
"SELECT cms_items.item_id, name, version, language, master_id, "
+ "parent_id, title, cms_pages.description "
+ "FROM cms_items "
+ "JOIN cms_pages ON cms_items.item_id = cms_pages.item_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 "
+ "WHERE ct_unpublished_organization_map.unpublished_id = ?");
} catch (SQLException ex) {
throw new UncheckedWrapperException(ex);
}
@ -357,7 +372,8 @@ public class PublicationList extends AbstractComponent {
publicationsQueryStatement.setString(1, categoryId);
publicationsQueryStatement.setString(2, GlobalizationHelper
.getNegotiatedLocale().getLanguage());
.getNegotiatedLocale()
.getLanguage());
publicationsQueryStatement.setInt(3, limit);
if (request.getParameter("page") == null) {
@ -649,7 +665,7 @@ public class PublicationList extends AbstractComponent {
final Element numberElem = publicationElem.newChildElement(
"internet-article-number");
placeElem.setText(resultSet.getString("internet_article_number"));
numberElem.setText(resultSet.getString("internet_article_number"));
final Element internetArticleNumberOfPagesElem = publicationElem
.newChildElement(
@ -782,26 +798,24 @@ public class PublicationList extends AbstractComponent {
publicationElem);
}
if (UnPublished.BASE_DATA_OBJECT_TYPE
.equals(resultSet.getString("object_type"))
|| GreyLiterature.BASE_DATA_OBJECT_TYPE
.equals(resultSet.getString("object_type"))
|| WorkingPaper.BASE_DATA_OBJECT_TYPE
.equals(resultSet.getString("object_type"))) {
generateOrganization(resultSet.getBigDecimal("parent_id"),
publicationElem);
}
}
private void generateAuthors(final BigDecimal publicationId,
final Element publicationElem)
throws SQLException {
final Connection connection = SessionManager
.getSession()
.getConnection();
// final PreparedStatement statement = connection.prepareStatement(
// "SELECT surname, givenname, titlepre, titlepost, editor, authorship_order "
// + "FROM cms_persons "
// + "JOIN cms_items ON cms_persons.person_id = cms_items.item_id "
// + "JOIN cms_bundles ON cms_items.parent_id = cms_bundles.bundle_id "
// + "JOIN ct_publications_authorship ON cms_bundles.bundle_id = ct_publications_authorship.person_id "
// + "WHERE publication_id = ? "
// + "ORDER BY authorship_order");
// statement.setBigDecimal(1, publicationId);
// final ResultSet resultSet = statement.executeQuery();
authorsQueryStatement.setBigDecimal(1, publicationId);
try (final ResultSet resultSet = authorsQueryStatement.executeQuery()) {
@ -827,71 +841,12 @@ public class PublicationList extends AbstractComponent {
"editor")));
}
}
// final PreparedStatement statement = connection.prepareStatement(
// "SELECT person_id, editor, authorship_order "
// + "FROM ct_publications_authorship "
// + "WHERE publication_id = ? "
// + "ORDER BY authorship_order");
// statement.setBigDecimal(1, publicationId);
// final ResultSet resultSet = statement.executeQuery();
//
// final Element authorsElem = publicationElem.newChildElement("authors");
//
// while (resultSet.next()) {
// generateAuthor(resultSet.getBigDecimal("person_id"),
// resultSet.getInt("authorship_order"),
// resultSet.getBoolean("editor"),
// authorsElem);
// }
}
// private void generateAuthor(final BigDecimal authorBundleId,
// final int order,
// final boolean editor,
// final Element authorsElem) throws SQLException {
//
// final Connection connection = SessionManager
// .getSession()
// .getConnection();
//
// final PreparedStatement statement = connection.prepareStatement(
// "SELECT surname, givenname, titlepre, titlepost "
// + "FROM cms_persons JOIN cms_items ON cms_persons.person_id = cms_items.item_id "
// + "WHERE parent_id = ?");
// statement.setBigDecimal(1, authorBundleId);
// final ResultSet resultSet = statement.executeQuery();
//
// while (resultSet.next()) {
// final Element authorElem = authorsElem.newChildElement("author");
// authorElem.addAttribute("surname", resultSet.getString("surname"));
// authorElem.addAttribute("givenname",
// resultSet.getString("givenname"));
// authorElem.addAttribute("titlepre", resultSet.getString("titlepre"));
// authorElem.addAttribute("titlepost",
// resultSet.getString("titlepost"));
// authorElem.addAttribute("order", Integer.toString(order));
// authorElem.addAttribute("editor", Boolean.toString(editor));
// }
//
// }
public void generatePublishers(final BigDecimal publicationId,
final Element publicationElem)
throws SQLException {
// final Connection connection = SessionManager
// .getSession()
// .getConnection();
// final PreparedStatement statement = connection.prepareStatement(
// "SELECT publishername, ct_publisher.place "
// + "FROM ct_publisher "
// + "JOIN cms_items ON ct_publisher.publisher_id = cms_items.item_id "
// + "JOIN cms_bundles ON cms_items.parent_id = cms_bundles.bundle_id "
// + "JOIN ct_publication_with_publisher_publisher_map ON cms_bundles.bundle_id = ct_publication_with_publisher_publisher_map.publisher_id "
// + "WHERE publication_id = ?"
// );
// statement.setBigDecimal(1, publicationId);
// final ResultSet resultSet = statement.executeQuery();
publisherQueryStatement.setBigDecimal(1, publicationId);
try (final ResultSet resultSet = publisherQueryStatement.executeQuery()) {
@ -1047,6 +1002,27 @@ public class PublicationList extends AbstractComponent {
}
}
public void generateOrganization(final BigDecimal publicationId,
final Element publicationElem)
throws SQLException {
organizationQueryStatement.setBigDecimal(1, publicationId);
try (final ResultSet resultSet = organizationQueryStatement
.executeQuery()) {
if (resultSet.next()) {
final Element organizationElem = publicationElem
.newChildElement("organization");
final Element titleElem = organizationElem
.newChildElement("title");
titleElem.setText(resultSet.getString("title"));
}
}
}
public void addAdditionalJoin(final String join) {
if (join.trim().toLowerCase().startsWith("join")
|| join.trim().toLowerCase().startsWith("left join")