- RIS-Exporter optimiert

- Formatierungen


git-svn-id: https://svn.libreccm.org/ccm/trunk@1677 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2012-05-29 09:23:56 +00:00
parent 697835822b
commit 986acd393e
19 changed files with 366 additions and 344 deletions

View File

@ -48,6 +48,7 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
final String path, final String path,
final String context, final String context,
final DomainObject linkObject) { final DomainObject linkObject) {
final long start = System.nanoTime();
DomainObject nObj = obj; DomainObject nObj = obj;
@ -58,6 +59,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
} }
super.walk(adapter, nObj, path, context, linkObject); super.walk(adapter, nObj, path, context, linkObject);
System.out.printf("Walked object in %d ms\n", (System.nanoTime() - start) / 1000000);
} }
@Override @Override

View File

@ -32,10 +32,10 @@ public class GenericPersonExtraXmlGenerator implements ExtraXMLGenerator {
final Element contactsElem = element.newChildElement("contacts"); final Element contactsElem = element.newChildElement("contacts");
while (contacts.next()) { while (contacts.next()) {
final GenericContact contact = contacts.getContact(GlobalizationHelper.getNegotiatedLocale().getLanguage());
generateContactXml( generateContactXml(
contactsElem, contactsElem,
contacts.getContact(GlobalizationHelper.getNegotiatedLocale(). contact,
getLanguage()),
state); state);
} }
} }

View File

@ -133,12 +133,14 @@ public class SimpleXMLGenerator implements XMLGenerator {
* @param useContext The use context * @param useContext The use context
*/ */
public void generateXML(PageState state, Element parent, String useContext) { public void generateXML(PageState state, Element parent, String useContext) {
final long start = System.nanoTime();
ContentSection section = CMS.getContext().getContentSection(); //ContentSection section = CMS.getContext().getContentSection();
ContentItem item = getContentItem(state); ContentItem item = getContentItem(state);
s_log.info("Generate XML for item " + item.getOID()); System.out.printf("After getting contentitem: %d ms\n", (System.nanoTime() - start) / 1000000);
s_log.info("Generate XML for item " + item.getOID());
Party currentParty = Kernel.getContext().getParty(); Party currentParty = Kernel.getContext().getParty();
if (currentParty == null) { if (currentParty == null) {
@ -164,6 +166,8 @@ public class SimpleXMLGenerator implements XMLGenerator {
} }
String className = item.getDefaultDomainClass(); String className = item.getDefaultDomainClass();
System.out.printf("After creating permission attributes: %d ms\n", (System.nanoTime() - start) / 1000000);
// Ensure correct subtype of ContentItem is instantiated // Ensure correct subtype of ContentItem is instantiated
if (!item.getClass().getName().equals(className)) { if (!item.getClass().getName().equals(className)) {
s_log.info("Specializing item"); s_log.info("Specializing item");
@ -179,6 +183,8 @@ public class SimpleXMLGenerator implements XMLGenerator {
} }
} }
System.out.printf("After checking type: %d ms\n", (System.nanoTime() - start) / 1000000);
// Implementing XMLGenerator directly is now deprecated // Implementing XMLGenerator directly is now deprecated
if (item instanceof XMLGenerator) { if (item instanceof XMLGenerator) {
s_log.info("Item implements XMLGenerator interface"); s_log.info("Item implements XMLGenerator interface");
@ -206,6 +212,8 @@ public class SimpleXMLGenerator implements XMLGenerator {
renderer.walk(item, ADAPTER_CONTEXT); renderer.walk(item, ADAPTER_CONTEXT);
System.out.printf("After getting rendering standard item xml: %d ms\n", (System.nanoTime() - start) / 1000000);
//parent.addContent(content); //parent.addContent(content);
/* /*
@ -222,6 +230,8 @@ public class SimpleXMLGenerator implements XMLGenerator {
generator.generateXML(item, content, state); generator.generateXML(item, content, state);
} }
} }
System.out.printf("After rendering extra xml: %d ms\n", (System.nanoTime() - start) / 1000000);
} }
} }

View File

@ -40,33 +40,23 @@ import java.util.HashSet;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* <p>This class provides a general purpose framework for iterating * <p>This class provides a general purpose framework for iterating over a domain object's properties, processing
* over a domain object's properties, processing attributes and * attributes and traversing associations as required.</p>
* traversing associations as required.</p>
* *
* <p>Subclasses should implement the startXXX and endXXX methods to * <p>Subclasses should implement the startXXX and endXXX methods to provide whatever processing logic they require upon
* provide whatever processing logic they require upon encountering * encountering attributes, roles, associations and objects.</p>
* attributes, roles, associations and objects.</p>
* *
* <p>The {@link com.arsdigita.domain.DomainObjectTraversalAdapter} * <p>The {@link com.arsdigita.domain.DomainObjectTraversalAdapter} provides a means to control which properties are
* provides a means to control which properties are processed and, * processed and, most importantly, which associations are traversed. When registering an adapter, a 'use context' is
* most importantly, which associations are traversed. When * supplied allowing different adapters to be used according to the requirements of any implementing subclass. It is
* registering an adapter, a 'use context' is supplied allowing * recommended that the use context be based on the fully qualified name of the class using DomainObjectTraversal, e.g.,
* different adapters to be used according to the requirements of any
* implementing subclass. It is recommended that the use context be
* based on the fully qualified name of the class using
* DomainObjectTraversal, e.g.,
* com.arsdigita.cms.ui.DomainObjectRenderer.</p> * com.arsdigita.cms.ui.DomainObjectRenderer.</p>
* *
* <p>The path argument provided to the adapter and the startXXX ad * <p>The path argument provided to the adapter and the startXXX ad endXXX methods indicates which associations are
* endXXX methods indicates which associations are currently being * currently being traversed. The first element in the path is always '/object'. If it then starts to traverse the
* traversed. The first element in the path is always '/object'. If it * 'rootCategory' association, the path will become '/object/rootCategory'. For self-recursive associations, rather than
* then starts to traverse the 'rootCategory' association, the path * building up a long repeating string, the path will be shortened by adding a '+' for each element that is repeated.
* will become '/object/rootCategory'. For self-recursive * For example, '/object/container+' indicates that the container association has been followed two or more times.</p>
* associations, rather than building up a long repeating string, the
* path will be shortened by adding a '+' for each element that is
* repeated. For example, '/object/container+' indicates that the
* container association has been followed two or more times.</p>
*/ */
public abstract class DomainObjectTraversal { public abstract class DomainObjectTraversal {
@ -77,8 +67,7 @@ public abstract class DomainObjectTraversal {
public final static String LINK_NAME = "link"; public final static String LINK_NAME = "link";
/** /**
* Registers a traversal adapter for an object type in a given * Registers a traversal adapter for an object type in a given context.
* context.
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param adapter the adapter for controlling object traversal * @param adapter the adapter for controlling object traversal
@ -102,8 +91,7 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Unregisters a traversal adapter for an object type in a * Unregisters a traversal adapter for an object type in a given context
* given context
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param context the context in which the adapter should be used * @param context the context in which the adapter should be used
@ -121,8 +109,7 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Registers a traversal adapter for an object type in a given * Registers a traversal adapter for an object type in a given context.
* context.
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param adapter the adapter for controlling object traversal * @param adapter the adapter for controlling object traversal
@ -137,8 +124,7 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Unregisters a traversal adapter for an object type in a * Unregisters a traversal adapter for an object type in a given context
* given context
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param context the context in which the adapter should be used * @param context the context in which the adapter should be used
@ -150,8 +136,7 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Retrieves the traversal adapter for an object type in a given * Retrieves the traversal adapter for an object type in a given context.
* context.
* *
* @param type the object type to lookup * @param type the object type to lookup
* @param context the adapter context * @param context the adapter context
@ -172,10 +157,9 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Retrieves the closest matching traversal adapter for an object type * Retrieves the closest matching traversal adapter for an object type in a given context. The algorithm looks for
* in a given context. The algorithm looks for an exact match, then * an exact match, then considers the supertype, and the supertype's supertype. If no match could be found at all,
* considers the supertype, and the supertype's supertype. If no match * returns null
* could be found at all, returns null
* *
* @param type the object type to search for * @param type the object type to search for
* @param context the adapter context * @param context the adapter context
@ -212,8 +196,7 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Walks over properties of a domain object, invoking * Walks over properties of a domain object, invoking methods to handle associations, roles and attributes.
* methods to handle associations, roles and attributes.
* *
* @param obj the domain object to traverse * @param obj the domain object to traverse
* @param context the context for the traversal adapter * @param context the context for the traversal adapter
@ -290,7 +273,8 @@ public abstract class DomainObjectTraversal {
prop, prop,
context)) { context)) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Not processing " + appendToPath(path, prop.getName()) + " in object " + oid + " and context " s_log.debug("Not processing " + appendToPath(path, prop.getName()) + " in object " + oid
+ " and context "
+ context + " with adapter " + adapter.getClass(). + context + " with adapter " + adapter.getClass().
getName()); getName());
} }
@ -353,30 +337,17 @@ public abstract class DomainObjectTraversal {
} else { } else {
//2010-11-08: Moved to seperate Methods to allow simple //2010-11-08: Moved to seperate Methods to allow simple
//extending of the handling of data assocications //extending of the handling of data assocications
/*if (s_log.isDebugEnabled()) { /*
s_log.debug(prop.getName() + " is a DataAssociation"); * if (s_log.isDebugEnabled()) { s_log.debug(prop.getName() + " is a DataAssociation"); }
} * beginAssociation(obj, path, prop);
beginAssociation(obj, path, prop); *
* DataAssociationCursor daCursor = ((DataAssociation) propValue). getDataAssociationCursor();
DataAssociationCursor daCursor = *
((DataAssociation) propValue). * while (daCursor.next()) { s_log.debug("Processing data assoication cursor..."); DataObject link =
getDataAssociationCursor(); * daCursor.getLink(); DomainObject linkObj = null; if (link != null) { linkObj = new
* LinkDomainObject(link); } walk(adapter, DomainObjectFactory.newInstance(daCursor.
while (daCursor.next()) { * getDataObject()), appendToPath(path, propName), context, linkObj); } endAssociation(obj, path, prop);
s_log.debug("Processing data assoication cursor..."); */
DataObject link = daCursor.getLink();
DomainObject linkObj = null;
if (link != null) {
linkObj = new LinkDomainObject(link);
}
walk(adapter,
DomainObjectFactory.newInstance(daCursor.
getDataObject()),
appendToPath(path, propName),
context,
linkObj);
}
endAssociation(obj, path, prop);*/
walkDataAssociations(adapter, walkDataAssociations(adapter,
obj, obj,
@ -442,38 +413,33 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* Method called when the processing of an object * Method called when the processing of an object starts
* starts
*/ */
protected abstract void beginObject(DomainObject obj, protected abstract void beginObject(DomainObject obj,
String path); String path);
/** /**
* Method called when the procesing of an object * Method called when the procesing of an object completes
* completes
*/ */
protected abstract void endObject(DomainObject obj, protected abstract void endObject(DomainObject obj,
String path); String path);
/** /**
* Method called when the processing of a Link Object * Method called when the processing of a Link Object starts
* starts
*/ */
protected void beginLink(DomainObject obj, String path) { protected void beginLink(DomainObject obj, String path) {
s_log.debug(String.format("Starting link with path = %s", path)); s_log.debug(String.format("Starting link with path = %s", path));
} }
/** /**
* Method called when the procesing of a Link Object * Method called when the procesing of a Link Object completes
* completes
*/ */
protected void endLink(DomainObject obj, String path) { protected void endLink(DomainObject obj, String path) {
s_log.debug(String.format("Finished link with path = %s", path)); s_log.debug(String.format("Finished link with path = %s", path));
} }
/** /**
* Method called when a previously visited object * Method called when a previously visited object is encountered for a second time.
* is encountered for a second time.
*/ */
protected abstract void revisitObject(DomainObject obj, protected abstract void revisitObject(DomainObject obj,
String path); String path);
@ -486,32 +452,28 @@ public abstract class DomainObjectTraversal {
Property property); Property property);
/** /**
* Method called when the processing of a role * Method called when the processing of a role starts
* starts
*/ */
protected abstract void beginRole(DomainObject obj, protected abstract void beginRole(DomainObject obj,
String path, String path,
Property property); Property property);
/** /**
* Method called when the procesing of a role * Method called when the procesing of a role completes
* completes
*/ */
protected abstract void endRole(DomainObject obj, protected abstract void endRole(DomainObject obj,
String path, String path,
Property property); Property property);
/** /**
* Method called when the processing of an association * Method called when the processing of an association starts
* starts
*/ */
protected abstract void beginAssociation(DomainObject obj, protected abstract void beginAssociation(DomainObject obj,
String path, String path,
Property property); Property property);
/** /**
* Method called when the procesing of an association * Method called when the procesing of an association completes
* completes
*/ */
protected abstract void endAssociation(DomainObject obj, protected abstract void endAssociation(DomainObject obj,
String path, String path,
@ -585,8 +547,7 @@ public abstract class DomainObjectTraversal {
} }
/** /**
* this is simply a subclass since DomainObject is abstract * this is simply a subclass since DomainObject is abstract but we don't have any other domain object to use.
* but we don't have any other domain object to use.
*/ */
protected class LinkDomainObject extends DomainObject { protected class LinkDomainObject extends DomainObject {

View File

@ -37,10 +37,8 @@ import java.util.Locale;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* An implementation of DomainObjectTraversal that generates an XML * An implementation of DomainObjectTraversal that generates an XML tree representing the DomainObject. The output
* tree representing the DomainObject. The output format of the XML * format of the XML can be controlled using the various setWrapXXX methods detailed below.
* can be controlled using the various setWrapXXX methods detailed
* below.
* *
* @version $Id: DomainObjectXMLRenderer.java 2141 2011-01-16 12:17:15Z pboy $ * @version $Id: DomainObjectXMLRenderer.java 2141 2011-01-16 12:17:15Z pboy $
*/ */
@ -61,8 +59,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
private String m_context; private String m_context;
/** /**
* Registers a traversal formatter for an object type in a given * Registers a traversal formatter for an object type in a given context.
* context.
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param formatter the formatter for controlling object traversal * @param formatter the formatter for controlling object traversal
@ -75,8 +72,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Unregisteres a traversal formatter for an object type in a * Unregisteres a traversal formatter for an object type in a given context
* given context
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param context the context in which the formatter should be used * @param context the context in which the formatter should be used
@ -87,8 +83,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Registers a traversal formatter for an object type in a given * Registers a traversal formatter for an object type in a given context.
* context.
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param formatter the formatter for controlling object traversal * @param formatter the formatter for controlling object traversal
@ -109,8 +104,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Unregisteres a traversal formatter for an object type in a * Unregisteres a traversal formatter for an object type in a given context
* given context
* *
* @param type the object type whose items will be traversed * @param type the object type whose items will be traversed
* @param context the context in which the formatter should be used * @param context the context in which the formatter should be used
@ -122,8 +116,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Retrieves the traversal formatter for an object type in a given * Retrieves the traversal formatter for an object type in a given context.
* context.
* *
* @param type the object type to lookup * @param type the object type to lookup
* @param context the formatter context * @param context the formatter context
@ -135,10 +128,9 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Retrieves the closest matching traversal formatter for an object type * Retrieves the closest matching traversal formatter for an object type in a given context. The algorithm looks for
* in a given context. The algorithm looks for an exact match, then * an exact match, then considers the supertype, and the supertype's supertype. If no match could be found at all,
* considers the supertype, and the supertype's supertype. If no match * returns null
* could be found at all, returns null
* *
* @param type the object type to search for * @param type the object type to search for
* @param context the formatter context * @param context the formatter context
@ -157,9 +149,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Creates a new DomainObject XML renderer * Creates a new DomainObject XML renderer that outputs XML into the element passed into the constructor.
* that outputs XML into the element passed into
* the constructor.
* *
* @param root the XML element in which to output children * @param root the XML element in which to output children
*/ */
@ -198,7 +188,8 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
rendered = null; rendered = null;
} }
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("FALLBACK supertype " + objectType + " formatter=" + formatter + " rendered=" + rendered); s_log.debug("FALLBACK supertype " + objectType + " formatter=" + formatter + " rendered="
+ rendered);
} }
objectType = objectType.getSupertype(); objectType = objectType.getSupertype();
} }
@ -231,43 +222,33 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
} }
/** /**
* Determines XML output for root object. * Determines XML output for root object. If set to true a separate element will be output for the root object, if
* If set to true a separate element will * false, then the element passed into the constructor will be used.
* be output for the root object, if false,
* then the element passed into the constructor
* will be used.
*/ */
public void setWrapRoot(boolean value) { public void setWrapRoot(boolean value) {
m_wrapRoot = value; m_wrapRoot = value;
} }
/** /**
* Determines XML output used for objects. * Determines XML output used for objects. If set to true, then a wrapper XML element will be generated for the
* If set to true, then a wrapper XML element * association, and then individual elements generated for each object. If false then no wrapper XML element will be
* will be generated for the association, * produced.
* and then individual elements generated for
* each object. If false then no wrapper
* XML element will be produced.
*/ */
public void setWrapObjects(boolean value) { public void setWrapObjects(boolean value) {
m_wrapObjects = value; m_wrapObjects = value;
} }
/** /**
* Determines XML output used for scalar * Determines XML output used for scalar attributes. If set to true, then each attribute is output as a separate
* attributes. If set to true, then each * element, otherwise, attributes are output as simple attributes.
* attribute is output as a separate element,
* otherwise, attributes are output as simple
* attributes.
*/ */
public void setWrapAttributes(boolean value) { public void setWrapAttributes(boolean value) {
m_wrapAttributes = value; m_wrapAttributes = value;
} }
/** /**
* Determines XML output used for objects. * Determines XML output used for objects. If set to true, then repeated objects will generate full xml. If false
* If set to true, then repeated objects will generate full xml. * then only the OID will be printed.
* If false then only the OID will be printed.
*/ */
public void setRevisitFullObject(boolean value) { public void setRevisitFullObject(boolean value) {
m_revisitFullObject = value; m_revisitFullObject = value;
@ -364,7 +345,8 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
element.addAttribute("date", dateFormatter.format(date)); element.addAttribute("date", dateFormatter.format(date));
element.addAttribute("longDate", longDateFormatter.format(date)); element.addAttribute("longDate", longDateFormatter.format(date));
element.addAttribute("time", timeFormatter.format(date)); element.addAttribute("time", timeFormatter.format(date));
element.addAttribute("monthName", calDate.getDisplayName(Calendar.MONTH, Calendar.LONG, negLocale)); element.addAttribute("monthName", calDate.getDisplayName(Calendar.MONTH, Calendar.LONG,
negLocale));
// Quasimodo: END // Quasimodo: END
} }

View File

@ -214,11 +214,10 @@ public class DataCollectionRenderer extends LockableImpl {
s_log.error(String.format("Failed to specialize object with with id %s. Skiping object.", dobj.getOID().toString())); s_log.error(String.format("Failed to specialize object with with id %s. Skiping object.", dobj.getOID().toString()));
continue; continue;
} else { } else {
s_log.error("Specializing successful."); s_log.debug("Specializing successful.");
} }
} }
Element item = Navigation.newElement(content, "item");
Element item = Navigation.newElement("item");
Iterator attributes = m_attributes.iterator(); Iterator attributes = m_attributes.iterator();
while (attributes.hasNext()) { while (attributes.hasNext()) {
@ -233,14 +232,14 @@ public class DataCollectionRenderer extends LockableImpl {
property.render(objects, item); property.render(objects, item);
} }
Element path = Navigation.newElement("path"); Element path = Navigation.newElement(item, "path");
path.setText(getStableURL(dobj, object)); path.setText(getStableURL(dobj, object));
item.addContent(path); //item.addContent(path);
generateItemXML(item, dobj, object, index); generateItemXML(item, dobj, object, index);
index++; index++;
content.addContent(item); //content.addContent(item);
} }
return content; return content;

View File

@ -63,6 +63,11 @@ public class Navigation extends Application {
NavigationConstants.NAV_NS); NavigationConstants.NAV_NS);
} }
public static Element newElement(final Element parent, final String name) {
return parent.newChildElement(String.format("%s:%s", NavigationConstants.NAV_PREFIX, name),
NavigationConstants.NAV_NS);
}
public static String redirectURL(OID oid) { public static String redirectURL(OID oid) {
ParameterMap map = new ParameterMap(); ParameterMap map = new ParameterMap();
map.setParameter( NavigationConstants.OID, oid.toString() ); map.setParameter( NavigationConstants.OID, oid.toString() );

View File

@ -3,13 +3,10 @@
* *
* Autor: Sören Bernstein * Autor: Sören Bernstein
* *
* Diese Klasse realisiert eine ObjectList für Navigation, * Diese Klasse realisiert eine ObjectList für Navigation, der man Filterbefehle für die SQL-Abfrage mitgeben kann. Auf
* der man Filterbefehle für die SQL-Abfrage mitgeben kann. * diese Weise lassen sich Objekte listen, die bestimmte Kriterien erfüllen.
* Auf diese Weise lassen sich Objekte listen, die bestimmte
* Kriterien erfüllen.
* *
* Angelegt wurde Sie für die Auflistung der aktuellen News * Angelegt wurde Sie für die Auflistung der aktuellen News und Veranstalungen auf einer Navigationsseite.
* und Veranstalungen auf einer Navigationsseite.
*/ */
package com.arsdigita.navigation.ui.object; package com.arsdigita.navigation.ui.object;
@ -50,9 +47,9 @@ public class ComplexObjectList extends AbstractObjectList {
} }
/** /**
* Hinzufügen eines SQL-Filter zur Abfrage * Hinzufügen eines SQL-Filter zur Abfrage Verarbeitet einen boolschen Filter, der SQL-konform Formatiert ist. Siehe
* Verarbeitet einen boolschen Filter, der SQL-konform Formatiert ist. * PostgreSQL-Handbuch zur where-Klausel
* Siehe PostgreSQL-Handbuch zur where-Klausel *
* @param sqlfilter * @param sqlfilter
*/ */
public void setSQLFilter(String sqlfilter) { public void setSQLFilter(String sqlfilter) {
@ -75,8 +72,8 @@ public class ComplexObjectList extends AbstractObjectList {
m_customAttributes.put(attribute, value); m_customAttributes.put(attribute, value);
} }
/* Diese Methode überschreibt die Methode aus der Eltern-Klasse, um /*
* die SQL-Filter berücksichtigen zu können * Diese Methode überschreibt die Methode aus der Eltern-Klasse, um die SQL-Filter berücksichtigen zu können
*/ */
@Override @Override
protected DataCollection getObjects(HttpServletRequest request, protected DataCollection getObjects(HttpServletRequest request,
@ -109,7 +106,9 @@ public class ComplexObjectList extends AbstractObjectList {
return objects; return objects;
} }
/* Diese Methode wird vom Servlet aufgerufen */ /*
* Diese Methode wird vom Servlet aufgerufen
*/
public Element generateXML(HttpServletRequest request, public Element generateXML(HttpServletRequest request,
HttpServletResponse response) { HttpServletResponse response) {
Element content = Navigation.newElement("complexObjectList"); Element content = Navigation.newElement("complexObjectList");

View File

@ -25,8 +25,7 @@ import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
import com.arsdigita.cms.contenttypes.SeriesCollection; import com.arsdigita.cms.contenttypes.SeriesCollection;
/** /**
* An abstract base implementation of the {@link RisConverter} interface * An abstract base implementation of the {@link RisConverter} interface providing common functionality.
* providing common functionality.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -66,16 +65,18 @@ public abstract class AbstractRisConverter implements RisConverter {
protected void convertYear(final Publication publication) { protected void convertYear(final Publication publication) {
getRisBuilder().addField(RisFields.PY, getRisBuilder().addField(RisFields.PY,
String.format("%d///", publication. String.format("%d///", publication.getYearOfPublication()));
getYearOfPublication()));
} }
protected void convertPublisher(final PublicationWithPublisher publication) { protected void convertPublisher(final PublicationWithPublisher publication) {
convertPublisher(publication, RisFields.CY);
}
protected void convertPublisher(final PublicationWithPublisher publication, final RisFields placeField) {
if (publication.getPublisher() != null) { if (publication.getPublisher() != null) {
if ((publication.getPublisher().getPlace() != null) if ((publication.getPublisher().getPlace() != null)
&& !(publication.getPublisher().getPlace().isEmpty())) { && !(publication.getPublisher().getPlace().isEmpty())) {
getRisBuilder().addField(RisFields.CY, getRisBuilder().addField(placeField, publication.getPublisher().getPlace());
publication.getPublisher().getPlace());
} }
getRisBuilder().addField(RisFields.PB, getRisBuilder().addField(RisFields.PB,

View File

@ -56,18 +56,18 @@ public class ArticleInCollectedVolumeConverter extends AbstractRisConverter {
convertYear(publication); convertYear(publication);
if (article.getCollectedVolume() != null) { if (article.getCollectedVolume() != null) {
getRisBuilder().addField(RisFields.BT, getRisBuilder().addField(RisFields.T2,
article.getCollectedVolume().getTitle()); article.getCollectedVolume().getTitle());
} }
if (article.getPagesFrom() != null) { if (article.getPagesFrom() != null) {
getRisBuilder().addField(RisFields.SP, getRisBuilder().addField(RisFields.SP,
article.getPagesFrom().toString()); String.format("%d - %d", article.getPagesFrom(), article.getPagesTo()));
if (article.getPagesTo() != null) { /*if (article.getPagesTo() != null) {
getRisBuilder().addField(RisFields.EP, getRisBuilder().addField(RisFields.EP,
article.getPagesTo().toString()); article.getPagesTo().toString());
} }*/
} }
return getRisBuilder().toRis(); return getRisBuilder().toRis();

View File

@ -50,16 +50,20 @@ public class ArticleInJournalConverter extends AbstractRisConverter {
article = (ArticleInJournal) publication; article = (ArticleInJournal) publication;
getRisBuilder().setType(RisTypes.MGZN); getRisBuilder().setType(RisTypes.JOUR);
convertAuthors(publication); convertAuthors(publication);
convertTitle(publication); convertTitle(publication);
convertYear(publication); convertYear(publication);
if (article.getJournal() != null) { if (article.getJournal() != null) {
getRisBuilder().addField(RisFields.JF, getRisBuilder().addField(RisFields.T2,
article.getJournal().getTitle()); article.getJournal().getTitle());
} }
if (article.getIssue() != null) {
getRisBuilder().addField(RisFields.M1, article.getIssue());
}
if (article.getVolume() != null) { if (article.getVolume() != null) {
getRisBuilder().addField(RisFields.VL, getRisBuilder().addField(RisFields.VL,
article.getVolume().toString()); article.getVolume().toString());
@ -67,9 +71,15 @@ public class ArticleInJournalConverter extends AbstractRisConverter {
if (article.getPagesFrom() != null) { if (article.getPagesFrom() != null) {
getRisBuilder().addField(RisFields.SP, getRisBuilder().addField(RisFields.SP,
article.getPagesFrom().toString()); String.format("%d - %d", article.getPagesFrom(), article.getPagesTo()));
getRisBuilder().addField(RisFields.EP, /*
* getRisBuilder().addField(RisFields.EP,
article.getPagesTo().toString()); article.getPagesTo().toString());
*/
}
if (article.getReviewed()) {
getRisBuilder().addField(RisFields.RI, "");
} }
return getRisBuilder().toRis(); return getRisBuilder().toRis();

View File

@ -47,7 +47,7 @@ public class CollectedVolumeConverter extends AbstractRisConverter {
collectedVolume = (CollectedVolume) publication; collectedVolume = (CollectedVolume) publication;
getRisBuilder().setType(RisTypes.BOOK); getRisBuilder().setType(RisTypes.EDBOOK);
convertAuthors(publication); convertAuthors(publication);
convertTitle(publication); convertTitle(publication);

View File

@ -29,11 +29,23 @@ public class GreyLiteratureConverter extends AbstractRisConverter {
greyLiterature = (GreyLiterature) publication; greyLiterature = (GreyLiterature) publication;
getRisBuilder().setType(RisTypes.GEN); getRisBuilder().setType(RisTypes.UNPB);
convertAuthors(publication); convertAuthors(publication);
convertTitle(publication); convertTitle(publication);
convertYear(publication); convertYear(publication);
if (greyLiterature.getPlace() != null) {
getRisBuilder().addField(RisFields.CY, greyLiterature.getPlace());
}
if (greyLiterature.getNumber() != null) {
getRisBuilder().addField(RisFields.M1, greyLiterature.getNumber());
}
if (greyLiterature.getOrganization() != null) {
getRisBuilder().addField(RisFields.PB, greyLiterature.getOrganization().getTitle());
}
return getRisBuilder().toRis(); return getRisBuilder().toRis();
} }

View File

@ -51,29 +51,28 @@ public class InProceedingsConverter extends AbstractRisConverter {
inProceedings = (InProceedings) publication; inProceedings = (InProceedings) publication;
getRisBuilder().setType(RisTypes.GEN); getRisBuilder().setType(RisTypes.CPAPER);
convertAuthors(publication); convertAuthors(publication);
convertTitle(publication); convertTitle(publication);
convertYear(publication); convertYear(publication);
if (inProceedings.getPagesFrom() != null) { if (inProceedings.getProceedings() != null) {
getRisBuilder().addField(RisFields.SP, final Proceedings proceedings = inProceedings.getProceedings();
inProceedings.getPagesFrom().toString()); if (proceedings.getPlaceOfConference() != null) {
getRisBuilder().addField(RisFields.EP, getRisBuilder().addField(RisFields.CY, proceedings.getPlaceOfConference());
inProceedings.getPagesTo().toString());
} }
if(inProceedings.getProceedings() != null) {
Proceedings proceedings;
proceedings = inProceedings.getProceedings();
getRisBuilder().addField(RisFields.BT, }
proceedings.getTitle());
convertVolume(proceedings); if (inProceedings.getPagesFrom() != null) {
convertSeries(proceedings); getRisBuilder().addField(RisFields.SP,
convertPublisher(proceedings); String.format("%d - %d",
inProceedings.getPagesFrom(),
inProceedings.getPagesTo()));
/*getRisBuilder().addField(RisFields.EP,
inProceedings.getPagesTo().toString());*/
} }
return getRisBuilder().toString(); return getRisBuilder().toString();

View File

@ -50,11 +50,19 @@ public class InternetArticleConverter extends AbstractRisConverter {
article = (InternetArticle) publication; article = (InternetArticle) publication;
getRisBuilder().setType(RisTypes.GEN); getRisBuilder().setType(RisTypes.EJOUR);
convertAuthors(publication); convertAuthors(publication);
convertTitle(publication); convertTitle(publication);
convertYear(publication); convertYear(publication);
if (article.getReviewed()) {
getRisBuilder().addField(RisFields.RI, "");
}
if (article.getUrl() != null) {
getRisBuilder().addField(RisFields.UR, article.getUrl());
}
return getRisBuilder().toRis(); return getRisBuilder().toRis();
} }

View File

@ -57,7 +57,17 @@ public class ProceedingsConverter extends AbstractRisConverter {
convertVolume(proceedings); convertVolume(proceedings);
convertSeries(publication); convertSeries(publication);
convertPublisher(proceedings); convertPublisher(proceedings, RisFields.C1);
if (proceedings.getPlaceOfConference() != null) {
getRisBuilder().addField(RisFields.CY, proceedings.getPlaceOfConference());
}
if (proceedings.getNameOfConference() != null) {
getRisBuilder().addField(RisFields.T2, proceedings.getNameOfConference());
}
return getRisBuilder().toRis(); return getRisBuilder().toRis();

View File

@ -331,5 +331,16 @@ public enum RisFields {
* Edition. Not found in the specification, but used but by some other * Edition. Not found in the specification, but used but by some other
* exports. * exports.
*/ */
ET ET,
/**
* Reviewed item
*/
RI,
/**
* DA
*/
DA,
C1,
C2,
C3
} }

View File

@ -62,6 +62,10 @@ public enum RisTypes {
* Conference proceedings * Conference proceedings
*/ */
CONF, CONF,
/**
* Conference Paper
*/
CPAPER,
/** /**
* Catalog * Catalog
*/ */
@ -70,10 +74,18 @@ public enum RisTypes {
* Data file * Data file
*/ */
DATA, DATA,
/**
* Edited book
*/
EDBOOK,
/** /**
* Electronic citation * Electronic citation
*/ */
ELEC, ELEC,
/**
* Eletronic Article
*/
EJOUR,
/** /**
* Generic * Generic
*/ */