- XMLDeliveryCache funktioniert jetzt

- Debug-Ausgaben aus PublicationExtraXmlGenerator entfernt


git-svn-id: https://svn.libreccm.org/ccm/trunk@2167 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-06-03 10:59:51 +00:00
parent a8cc9548a1
commit 598104f542
2 changed files with 26 additions and 22 deletions

View File

@ -316,6 +316,9 @@ public final class XMLDeliveryCache {
// //
// } // }
/**
* Helper class, containing the XML for different contexts.
*/
private class CachedItem { private class CachedItem {
private final Map<String, CachedXml> cachedXml = new HashMap<String, CachedXml>(); private final Map<String, CachedXml> cachedXml = new HashMap<String, CachedXml>();

View File

@ -31,7 +31,7 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
public void generateXML(final ContentItem item, public void generateXML(final ContentItem item,
final Element element, final Element element,
final PageState state) { final PageState state) {
final long start = System.nanoTime(); // final long start = System.nanoTime();
if (!(item instanceof Publication)) { if (!(item instanceof Publication)) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"ExtraXMLGenerator '%s' only supports items of type '%s'.", "ExtraXMLGenerator '%s' only supports items of type '%s'.",
@ -41,13 +41,13 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
final Publication publication = (Publication) item; final Publication publication = (Publication) item;
createAuthorsXml(publication, element, state); createAuthorsXml(publication, element, state);
System.out.printf("[%s] Created authors XML in %d ms\n", // System.out.printf("[%s] Created authors XML in %d ms\n",
PublicationExtraXmlGenerator.class.getName(), // PublicationExtraXmlGenerator.class.getName(),
(System.nanoTime() - start) / 1000000); // (System.nanoTime() - start) / 1000000);
createSeriesXml(publication, element, state); createSeriesXml(publication, element, state);
System.out.printf("[%s] Created series XML in %d ms\n", // System.out.printf("[%s] Created series XML in %d ms\n",
PublicationExtraXmlGenerator.class.getName(), // PublicationExtraXmlGenerator.class.getName(),
(System.nanoTime() - start) / 1000000); // (System.nanoTime() - start) / 1000000);
if (!listMode) { if (!listMode) {
createOrgaUnitsXml(publication, element, state); createOrgaUnitsXml(publication, element, state);
@ -57,22 +57,22 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
createExportLink(format, element, (Publication) item, state); createExportLink(format, element, (Publication) item, state);
} }
} }
System.out.printf("[%s] Created extra XML in %d ms\n", // System.out.printf("[%s] Created extra XML in %d ms\n",
PublicationExtraXmlGenerator.class.getName(), // PublicationExtraXmlGenerator.class.getName(),
(System.nanoTime() - start) / 1000000); // (System.nanoTime() - start) / 1000000);
} }
private void createAuthorsXml(final Publication publication, private void createAuthorsXml(final Publication publication,
final Element parent, final Element parent,
final PageState state) { final PageState state) {
final long start = System.nanoTime(); // final long start = System.nanoTime();
final AuthorshipCollection authors = publication.getAuthors(); final AuthorshipCollection authors = publication.getAuthors();
if ((authors == null) || authors.isEmpty()) { if ((authors == null) || authors.isEmpty()) {
return; return;
} }
System.out.printf("[%s#createAuthorsXML] Got authors in %d ms\n", // System.out.printf("[%s#createAuthorsXML] Got authors in %d ms\n",
PublicationExtraXmlGenerator.class.getName(), // PublicationExtraXmlGenerator.class.getName(),
(System.nanoTime() - start) / 1000000); // (System.nanoTime() - start) / 1000000);
final Element authorsElem = parent.newChildElement("authors"); final Element authorsElem = parent.newChildElement("authors");
while (authors.next()) { while (authors.next()) {
@ -82,9 +82,9 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
authorsElem, authorsElem,
state); state);
} }
System.out.printf("[%s#createAuthorsXML] Created XML for authors in %d ms\n", // System.out.printf("[%s#createAuthorsXML] Created XML for authors in %d ms\n",
PublicationExtraXmlGenerator.class.getName(), // PublicationExtraXmlGenerator.class.getName(),
(System.nanoTime() - start) / 1000000); // (System.nanoTime() - start) / 1000000);
} }
private void createAuthorXml(final GenericPerson author, private void createAuthorXml(final GenericPerson author,
@ -92,17 +92,17 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
final Integer order, final Integer order,
final Element authorsElem, final Element authorsElem,
final PageState state) { final PageState state) {
final long start = System.nanoTime(); // final long start = System.nanoTime();
final XmlGenerator generator = new XmlGenerator(author); final XmlGenerator generator = new XmlGenerator(author);
generator.setItemElemName("author", ""); generator.setItemElemName("author", "");
generator.addItemAttribute("isEditor", isAuthor.toString()); generator.addItemAttribute("isEditor", isAuthor.toString());
generator.addItemAttribute("order", order.toString()); generator.addItemAttribute("order", order.toString());
generator.setListMode(listMode); generator.setListMode(listMode);
generator.generateXML(state, authorsElem, ""); generator.generateXML(state, authorsElem, "");
System.out.printf("[%s] Created XML for author %s in %d ms\n", // System.out.printf("[%s] Created XML for author %s in %d ms\n",
PublicationExtraXmlGenerator.class.getName(), // PublicationExtraXmlGenerator.class.getName(),
author.getTitle(), // author.getTitle(),
(System.nanoTime() - start) / 1000000); // (System.nanoTime() - start) / 1000000);
} }
private void createOrgaUnitsXml(final Publication publication, private void createOrgaUnitsXml(final Publication publication,
@ -178,6 +178,7 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
publicationIdElem.setText(publication.getID().toString()); publicationIdElem.setText(publication.getID().toString());
} }
@Override
public void addGlobalStateParams(final Page page) { public void addGlobalStateParams(final Page page) {
//Nothing for now //Nothing for now
} }