diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java b/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java index 43f7c98c8..9fc24107c 100644 --- a/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java @@ -48,7 +48,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer { final String path, final String context, final DomainObject linkObject) { - + final long start = System.nanoTime(); + DomainObject nObj = obj; if (nObj instanceof ContentBundle) { @@ -58,6 +59,8 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer { } super.walk(adapter, nObj, path, context, linkObject); + + System.out.printf("Walked object in %d ms\n", (System.nanoTime() - start) / 1000000); } @Override diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java index ea23a07ec..e2833dc0d 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java @@ -13,31 +13,31 @@ import com.arsdigita.xml.Element; /** * - * @author Jens Pelzetter + * @author Jens Pelzetter * @version $Id$ */ public class GenericPersonExtraXmlGenerator implements ExtraXMLGenerator { public void generateXML(final ContentItem item, final Element element, - final PageState state) { + final PageState state) { if (!(item instanceof GenericPerson)) { throw new IllegalArgumentException( "The GenericPersonExtraXmlGenerator can only process " + "instances of GenericPerson"); - } + } final GenericPerson person = (GenericPerson) item; - final GenericPersonContactCollection contacts = person.getContacts(); + final GenericPersonContactCollection contacts = person.getContacts(); final Element contactsElem = element.newChildElement("contacts"); - while (contacts.next()) { + while (contacts.next()) { + final GenericContact contact = contacts.getContact(GlobalizationHelper.getNegotiatedLocale().getLanguage()); generateContactXml( - contactsElem, - contacts.getContact(GlobalizationHelper.getNegotiatedLocale(). - getLanguage()), - state); - } + contactsElem, + contact, + state); + } } private void generateContactXml(final Element contactsElem, @@ -52,7 +52,7 @@ public class GenericPersonExtraXmlGenerator implements ExtraXMLGenerator { public void addGlobalStateParams(final Page page) { //Nothing } - + @Override public void setListMode(final boolean listMode) { //nothing diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java index 0b43fec6d..30e65696f 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java @@ -133,13 +133,15 @@ public class SimpleXMLGenerator implements XMLGenerator { * @param useContext The use context */ public void generateXML(PageState state, Element parent, String useContext) { - - ContentSection section = CMS.getContext().getContentSection(); + final long start = System.nanoTime(); + + //ContentSection section = CMS.getContext().getContentSection(); ContentItem item = getContentItem(state); + 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(); if (currentParty == null) { currentParty = Kernel.getPublicUser(); @@ -164,6 +166,8 @@ public class SimpleXMLGenerator implements XMLGenerator { } 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 if (!item.getClass().getName().equals(className)) { s_log.info("Specializing item"); @@ -178,6 +182,8 @@ public class SimpleXMLGenerator implements XMLGenerator { ex); } } + + System.out.printf("After checking type: %d ms\n", (System.nanoTime() - start) / 1000000); // Implementing XMLGenerator directly is now deprecated if (item instanceof XMLGenerator) { @@ -205,6 +211,8 @@ public class SimpleXMLGenerator implements XMLGenerator { renderer.setRevisitFullObject(true); renderer.walk(item, ADAPTER_CONTEXT); + + System.out.printf("After getting rendering standard item xml: %d ms\n", (System.nanoTime() - start) / 1000000); //parent.addContent(content); @@ -222,6 +230,8 @@ public class SimpleXMLGenerator implements XMLGenerator { generator.generateXML(item, content, state); } } + + System.out.printf("After rendering extra xml: %d ms\n", (System.nanoTime() - start) / 1000000); } } diff --git a/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java b/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java index 13b634282..88ad412b7 100755 --- a/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java +++ b/ccm-core/src/com/arsdigita/domain/DomainObjectTraversal.java @@ -40,33 +40,23 @@ import java.util.HashSet; import org.apache.log4j.Logger; /** - *

This class provides a general purpose framework for iterating - * over a domain object's properties, processing attributes and - * traversing associations as required.

+ *

This class provides a general purpose framework for iterating over a domain object's properties, processing + * attributes and traversing associations as required.

* - *

Subclasses should implement the startXXX and endXXX methods to - * provide whatever processing logic they require upon encountering - * attributes, roles, associations and objects.

+ *

Subclasses should implement the startXXX and endXXX methods to provide whatever processing logic they require upon + * encountering attributes, roles, associations and objects.

* - *

The {@link com.arsdigita.domain.DomainObjectTraversalAdapter} - * provides a means to control which properties are processed and, - * most importantly, which associations are traversed. When - * registering an adapter, a 'use context' is supplied allowing - * 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., + *

The {@link com.arsdigita.domain.DomainObjectTraversalAdapter} provides a means to control which properties are + * processed and, most importantly, which associations are traversed. When registering an adapter, a 'use context' is + * supplied allowing 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.

* - *

The path argument provided to the adapter and the startXXX ad - * endXXX methods indicates which associations are currently being - * traversed. The first element in the path is always '/object'. If it - * then starts to traverse the 'rootCategory' association, the path - * will become '/object/rootCategory'. For self-recursive - * 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.

+ *

The path argument provided to the adapter and the startXXX ad endXXX methods indicates which associations are + * currently being traversed. The first element in the path is always '/object'. If it then starts to traverse the + * 'rootCategory' association, the path will become '/object/rootCategory'. For self-recursive 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.

*/ public abstract class DomainObjectTraversal { @@ -77,39 +67,37 @@ public abstract class DomainObjectTraversal { public final static String LINK_NAME = "link"; /** - * Registers a traversal adapter for an object type in a given - * context. + * Registers a traversal adapter for an object type in a given context. * * @param type the object type whose items will be traversed * @param adapter the adapter for controlling object traversal * @param context the context in which the adapter should be used */ public static void registerAdapter(final ObjectType type, - final DomainObjectTraversalAdapter adapter, - final String context) { + final DomainObjectTraversalAdapter adapter, + final String context) { Assert.exists(adapter, - "The DomainObjectTraversalAdapter is null for context '" - + context + "' and object type '" + type); + "The DomainObjectTraversalAdapter is null for context '" + + context + "' and object type '" + type); Assert.exists(type, "The ObjectType for context '" + context - + "' and adapter '" + adapter + "' is null"); + + "' and adapter '" + adapter + "' is null"); Assert.exists(context, String.class); if (s_log.isDebugEnabled()) { s_log.debug("Registering adapter " + adapter.getClass() - + " for object type " + type.getQualifiedName() - + " in context " + context); + + " for object type " + type.getQualifiedName() + + " in context " + context); } s_adapters.put(new AdapterKey(type, context), adapter); } /** - * Unregisters a traversal adapter for an object type in a - * given context + * Unregisters a traversal adapter for an object type in a given context * * @param type the object type whose items will be traversed * @param context the context in which the adapter should be used */ public static void unregisterAdapter(final ObjectType type, - final String context) { + final String context) { Assert.exists(type, ObjectType.class); Assert.exists(context, String.class); @@ -121,37 +109,34 @@ public abstract class DomainObjectTraversal { } /** - * Registers a traversal adapter for an object type in a given - * context. + * Registers a traversal adapter for an object type in a given context. * * @param type the object type whose items will be traversed * @param adapter the adapter for controlling object traversal * @param context the context in which the adapter should be used */ public static void registerAdapter(final String type, - final DomainObjectTraversalAdapter adapter, - final String context) { + final DomainObjectTraversalAdapter adapter, + final String context) { registerAdapter(SessionManager.getMetadataRoot().getObjectType(type), - adapter, - context); + adapter, + context); } /** - * Unregisters a traversal adapter for an object type in a - * given context + * Unregisters a traversal adapter for an object type in a given context * * @param type the object type whose items will be traversed * @param context the context in which the adapter should be used */ public static void unregisterAdapter(final String type, - final String context) { + final String context) { unregisterAdapter(SessionManager.getMetadataRoot().getObjectType(type), - context); + context); } /** - * Retrieves the traversal adapter for an object type in a given - * context. + * Retrieves the traversal adapter for an object type in a given context. * * @param type the object type to lookup * @param context the adapter context @@ -163,7 +148,7 @@ public abstract class DomainObjectTraversal { Assert.exists(context, String.class); if (s_log.isDebugEnabled()) { s_log.debug("lookupAdapter for type " + type.getQualifiedName() - + " in context " + context); + + " in context " + context); } @@ -172,21 +157,20 @@ public abstract class DomainObjectTraversal { } /** - * Retrieves the closest matching traversal adapter for an object type - * in a given context. The algorithm looks for an exact match, then - * considers the supertype, and the supertype's supertype. If no match - * could be found at all, returns null + * Retrieves the closest matching traversal adapter for an object type in a given context. The algorithm looks for + * an exact match, then considers the supertype, and the supertype's supertype. If no match could be found at all, + * returns null * * @param type the object type to search for * @param context the adapter context */ public static DomainObjectTraversalAdapter findAdapter(ObjectType type, - final String context) { + final String context) { Assert.exists(type, ObjectType.class); Assert.exists(context, String.class); if (s_log.isDebugEnabled()) { s_log.debug("findAdapter for type " + type.getQualifiedName() - + " in context " + context); + + " in context " + context); StringBuilder buf = new StringBuilder(); buf.append("Adapters contain:\n"); @@ -212,19 +196,18 @@ public abstract class DomainObjectTraversal { } /** - * Walks over properties of a domain object, invoking - * methods to handle associations, roles and attributes. + * Walks over properties of a domain object, invoking methods to handle associations, roles and attributes. * * @param obj the domain object to traverse * @param context the context for the traversal adapter */ public void walk(final DomainObject obj, - final String context) { + final String context) { final DomainObjectTraversalAdapter adapter = findAdapter(obj.getObjectType(), - context); + context); if (adapter == null) { final String errorMsg = "No adapter for object " + obj.getOID() - + " in context " + context; + + " in context " + context; s_log.error(errorMsg); throw new IllegalArgumentException(errorMsg); } @@ -232,8 +215,8 @@ public abstract class DomainObjectTraversal { } protected void walk(final DomainObject obj, - final String context, - final DomainObjectTraversalAdapter adapter) { + final String context, + final DomainObjectTraversalAdapter adapter) { Assert.exists(adapter, DomainObjectTraversalAdapter.class); walk(adapter, obj, "/object", context, null); } @@ -245,12 +228,12 @@ public abstract class DomainObjectTraversal { // content item during XML generation, I have to test for ContentBundle and // negotiate the language version. This is not possible in com.arsdigita.ccm. protected void walk(final DomainObjectTraversalAdapter adapter, - final DomainObject obj, - final String path, - final String context, - final DomainObject linkObject) { + final DomainObject obj, + final String path, + final String context, + final DomainObject linkObject) { s_log.debug(String.format("Walking with path %s and context %s...", path, - context)); + context)); OID oid = obj.getOID(); OID linkOid = null; if (linkObject != null) { @@ -271,10 +254,10 @@ public abstract class DomainObjectTraversal { if (linkObject != null) { beginLink(linkObject, path); walk(adapter, - linkObject, - appendToPath(path, LINK_NAME), - context, - null); + linkObject, + appendToPath(path, LINK_NAME), + context, + null); endLink(linkObject, path); } @@ -286,12 +269,13 @@ public abstract class DomainObjectTraversal { String propName = prop.getName(); if (!adapter.processProperty(obj, - appendToPath(path, prop.getName()), - prop, - context)) { + appendToPath(path, prop.getName()), + prop, + context)) { if (s_log.isDebugEnabled()) { - s_log.debug("Not processing " + appendToPath(path, prop.getName()) + " in object " + oid + " and context " - + context + " with adapter " + adapter.getClass(). + s_log.debug("Not processing " + appendToPath(path, prop.getName()) + " in object " + oid + + " and context " + + context + " with adapter " + adapter.getClass(). getName()); } continue; @@ -300,7 +284,7 @@ public abstract class DomainObjectTraversal { if (propValue == null) { if (s_log.isDebugEnabled()) { s_log.debug("Object " + oid.toString() + " doesn't " - + "contain property " + propName); + + "contain property " + propName); } continue; } @@ -317,10 +301,10 @@ public abstract class DomainObjectTraversal { beginRole(obj, path, prop); walk(adapter, - DomainObjectFactory.newInstance((DataObject) propValue), - appendToPath(path, propName), - context, - null); + DomainObjectFactory.newInstance((DataObject) propValue), + appendToPath(path, propName), + context, + null); endRole(obj, path, prop); } else if (propValue instanceof DataAssociation) { @@ -332,11 +316,11 @@ public abstract class DomainObjectTraversal { if (prop.getName().equals("fileAttachments") && !Domain.getConfig().queryBlobContentForFileAttachments()) { // make true a config DataQuery fileAttachmentsQuery = - SessionManager.getSession().retrieveQuery( + SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contentassets.fileAttachmentsQuery"); fileAttachmentsQuery.setParameter("item_id", - obj.getOID().get("id")); + obj.getOID().get("id")); DataCollection files = new DataQueryDataCollectionAdapter( fileAttachmentsQuery, "file"); @@ -344,47 +328,34 @@ public abstract class DomainObjectTraversal { while (files.next()) { DataObject file = files.getDataObject(); walk(adapter, - DomainObjectFactory.newInstance(file), - appendToPath(path, propName), - context, - null); + DomainObjectFactory.newInstance(file), + appendToPath(path, propName), + context, + null); } } else { //2010-11-08: Moved to seperate Methods to allow simple //extending of the handling of data assocications - /*if (s_log.isDebugEnabled()) { - s_log.debug(prop.getName() + " is a DataAssociation"); - } - beginAssociation(obj, path, prop); - - DataAssociationCursor daCursor = - ((DataAssociation) propValue). - getDataAssociationCursor(); - - while (daCursor.next()) { - 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);*/ + /* + * if (s_log.isDebugEnabled()) { s_log.debug(prop.getName() + " is a DataAssociation"); } + * beginAssociation(obj, path, prop); + * + * DataAssociationCursor daCursor = ((DataAssociation) propValue). getDataAssociationCursor(); + * + * while (daCursor.next()) { 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, - obj, - path, - context, - prop, - propName, - propValue); + obj, + path, + context, + prop, + propName, + propValue); } } else { // Unknown property value type - do nothing @@ -396,129 +367,120 @@ public abstract class DomainObjectTraversal { } protected void walkDataAssociations(DomainObjectTraversalAdapter adapter, - DomainObject obj, - String path, - String context, - Property prop, - String propName, - Object propValue) { + DomainObject obj, + String path, + String context, + Property prop, + String propName, + Object propValue) { s_log.debug(String.format("%s is a DataAssociation", prop.getName())); beginAssociation(obj, path, prop); DataAssociationCursor daCursor = - ((DataAssociation) propValue).getDataAssociationCursor(); + ((DataAssociation) propValue).getDataAssociationCursor(); while (daCursor.next()) { walkDataAssociation(adapter, - obj, - path, - context, - propName, - daCursor); + obj, + path, + context, + propName, + daCursor); } endAssociation(obj, path, prop); } protected void walkDataAssociation(DomainObjectTraversalAdapter adapter, - DomainObject obj, - String path, - String context, - String propName, - DataAssociationCursor daCursor) { + DomainObject obj, + String path, + String context, + String propName, + DataAssociationCursor daCursor) { s_log.debug(String.format("Processing data assoication cursor for object '%s'...", - obj.getOID().toString())); + obj.getOID().toString())); 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); + DomainObjectFactory.newInstance(daCursor.getDataObject()), + appendToPath(path, propName), + context, + linkObj); } /** - * Method called when the processing of an object - * starts + * Method called when the processing of an object starts */ protected abstract void beginObject(DomainObject obj, - String path); + String path); /** - * Method called when the procesing of an object - * completes + * Method called when the procesing of an object completes */ protected abstract void endObject(DomainObject obj, - String path); + String path); /** - * Method called when the processing of a Link Object - * starts + * Method called when the processing of a Link Object starts */ protected void beginLink(DomainObject obj, String path) { s_log.debug(String.format("Starting link with path = %s", path)); } /** - * Method called when the procesing of a Link Object - * completes + * Method called when the procesing of a Link Object completes */ protected void endLink(DomainObject obj, String path) { s_log.debug(String.format("Finished link with path = %s", path)); } /** - * Method called when a previously visited object - * is encountered for a second time. + * Method called when a previously visited object is encountered for a second time. */ protected abstract void revisitObject(DomainObject obj, - String path); + String path); /** * Method called when an attribute is encountered */ protected abstract void handleAttribute(DomainObject obj, - String path, - Property property); + String path, + Property property); /** - * Method called when the processing of a role - * starts + * Method called when the processing of a role starts */ protected abstract void beginRole(DomainObject obj, - String path, - Property property); + String path, + Property property); /** - * Method called when the procesing of a role - * completes + * Method called when the procesing of a role completes */ protected abstract void endRole(DomainObject obj, - String path, - Property property); + String path, + Property property); /** - * Method called when the processing of an association - * starts + * Method called when the processing of an association starts */ protected abstract void beginAssociation(DomainObject obj, - String path, - Property property); + String path, + Property property); /** - * Method called when the procesing of an association - * completes + * Method called when the procesing of an association completes */ protected abstract void endAssociation(DomainObject obj, - String path, - Property property); + String path, + Property property); protected String appendToPath(String path, - String name) { + String name) { if (path.endsWith("/" + name)) { path = path + "+"; } else if (!path.endsWith("/" + name + "+")) { @@ -556,7 +518,7 @@ public abstract class DomainObjectTraversal { private final String m_context; public AdapterKey(ObjectType type, - String context) { + String context) { Assert.exists(type, ObjectType.class); Assert.exists(context, String.class); m_type = type; @@ -585,8 +547,7 @@ public abstract class DomainObjectTraversal { } /** - * this is simply a subclass since DomainObject is abstract - * but we don't have any other domain object to use. + * this is simply a subclass since DomainObject is abstract but we don't have any other domain object to use. */ protected class LinkDomainObject extends DomainObject { diff --git a/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java b/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java index 7b3b90552..c6bfc12e5 100755 --- a/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java +++ b/ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java @@ -37,10 +37,8 @@ import java.util.Locale; import org.apache.log4j.Logger; /** - * An implementation of DomainObjectTraversal that generates an XML - * tree representing the DomainObject. The output format of the XML - * can be controlled using the various setWrapXXX methods detailed - * below. + * An implementation of DomainObjectTraversal that generates an XML tree representing the DomainObject. The output + * format of the XML can be controlled using the various setWrapXXX methods detailed below. * * @version $Id: DomainObjectXMLRenderer.java 2141 2011-01-16 12:17:15Z pboy $ */ @@ -61,69 +59,64 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { private String m_context; /** - * Registers a traversal formatter for an object type in a given - * context. + * Registers a traversal formatter for an object type in a given context. * * @param type the object type whose items will be traversed * @param formatter the formatter for controlling object traversal * @param context the context in which the formatter should be used */ public static void registerFormatter(ObjectType type, - DomainObjectXMLFormatter formatter, - String context) { + DomainObjectXMLFormatter formatter, + String context) { s_formatters.put(new AdapterKey(type, context), formatter); } /** - * Unregisteres a traversal formatter for an object type in a - * given context + * Unregisteres a traversal formatter for an object type in a given context * * @param type the object type whose items will be traversed * @param context the context in which the formatter should be used */ public static void unregisterFormatter(ObjectType type, - String context) { + String context) { s_formatters.remove(new AdapterKey(type, context)); } /** - * Registers a traversal formatter for an object type in a given - * context. + * Registers a traversal formatter for an object type in a given context. * * @param type the object type whose items will be traversed * @param formatter the formatter for controlling object traversal * @param context the context in which the formatter should be used */ public static void registerFormatter(String type, - DomainObjectXMLFormatter formatter, - String context) { + DomainObjectXMLFormatter formatter, + String context) { if (s_log.isDebugEnabled()) { s_log.debug("Registering formatter " - + formatter.getClass().getName() + " for type " + type - + " in context " + context); + + formatter.getClass().getName() + " for type " + type + + " in context " + context); } registerFormatter(MetadataRoot.getMetadataRoot().getObjectType(type), - formatter, - context); + formatter, + context); } /** - * Unregisteres a traversal formatter for an object type in a - * given context + * Unregisteres a traversal formatter for an object type in a given context * * @param type the object type whose items will be traversed * @param context the context in which the formatter should be used */ public static void unregisterFormatter(String type, - String context) { + String context) { unregisterFormatter(MetadataRoot.getMetadataRoot().getObjectType(type), - context); + context); } /** - * Retrieves the traversal formatter for an object type in a given - * context. + * Retrieves the traversal formatter for an object type in a given context. * * @param type the object type to lookup * @param context the formatter context @@ -135,16 +128,15 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } /** - * Retrieves the closest matching traversal formatter for an object type - * in a given context. The algorithm looks for an exact match, then - * considers the supertype, and the supertype's supertype. If no match - * could be found at all, returns null + * Retrieves the closest matching traversal formatter for an object type in a given context. The algorithm looks for + * an exact match, then considers the supertype, and the supertype's supertype. If no match could be found at all, + * returns null * * @param type the object type to search for * @param context the formatter context */ public static DomainObjectXMLFormatter findFormatter(ObjectType type, - String context) { + String context) { DomainObjectXMLFormatter formatter = null; while (formatter == null && type != null) { formatter = getFormatter(type, context); @@ -157,9 +149,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } /** - * Creates a new DomainObject XML renderer - * that outputs XML into the element passed into - * the constructor. + * Creates a new DomainObject XML renderer that outputs XML into the element passed into the constructor. * * @param root the XML element in which to output children */ @@ -169,20 +159,20 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } public void setNamespace(String prefix, - String uri) { + String uri) { m_namespacePrefix = prefix; m_namespaceURI = uri; } protected Object format(DomainObject obj, - String path, - Property prop, - Object value) { + String path, + Property prop, + Object value) { if (m_formatter != null) { String propertyPath = appendToPath(path, prop.getName()); Object rendered = m_formatter.format(obj, - propertyPath, - prop, value); + propertyPath, + prop, value); if (s_log.isDebugEnabled()) { s_log.debug("FORMAT " + obj + " m_formatter=" + m_formatter + " rendered=" + rendered); } @@ -198,7 +188,8 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { rendered = null; } 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(); } @@ -213,11 +204,11 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { @Override protected void walk(DomainObject obj, - String context, - DomainObjectTraversalAdapter adapter) { + String context, + DomainObjectTraversalAdapter adapter) { if (s_log.isDebugEnabled()) { s_log.debug("Traversing " + obj + " for context " + context + " " - + "using adapter " + adapter); + + "using adapter " + adapter); } m_formatter = findFormatter(obj.getObjectType(), context); @@ -231,43 +222,33 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } /** - * Determines XML output for root object. - * If set to true a separate element will - * be output for the root object, if false, - * then the element passed into the constructor - * will be used. + * Determines XML output for root object. If set to true a separate element will be output for the root object, if + * false, then the element passed into the constructor will be used. */ public void setWrapRoot(boolean value) { m_wrapRoot = value; } /** - * Determines XML output used for objects. - * If set to true, then a wrapper XML element - * will be generated for the association, - * and then individual elements generated for - * each object. If false then no wrapper - * XML element will be produced. + * Determines XML output used for objects. If set to true, then a wrapper XML element will be generated for the + * association, and then individual elements generated for each object. If false then no wrapper XML element will be + * produced. */ public void setWrapObjects(boolean value) { m_wrapObjects = value; } /** - * Determines XML output used for scalar - * attributes. If set to true, then each - * attribute is output as a separate element, - * otherwise, attributes are output as simple - * attributes. + * Determines XML output used for scalar attributes. If set to true, then each attribute is output as a separate + * element, otherwise, attributes are output as simple attributes. */ public void setWrapAttributes(boolean value) { m_wrapAttributes = value; } /** - * Determines XML output used for objects. - * If set to true, then repeated objects will generate full xml. - * If false then only the OID will be printed. + * Determines XML output used for objects. If set to true, then repeated objects will generate full xml. If false + * then only the OID will be printed. */ public void setRevisitFullObject(boolean value) { m_revisitFullObject = value; @@ -286,7 +267,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } protected void beginObject(DomainObject obj, - String path) { + String path) { if (m_wrapRoot || !path.equals("/object")) { String name = m_wrapObjects ? "object" : nameFromPath(path); Element element = newElement(m_element, name); @@ -301,14 +282,14 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } protected void endObject(DomainObject obj, - String path) { + String path) { if (m_wrapRoot || !path.equals("/object")) { m_element = (Element) m_elements.pop(); } } protected void revisitObject(DomainObject obj, - String path) { + String path) { Element priorElement = null; if (m_revisitFullObject) { priorElement = (Element) m_objectElements.get(obj.getOID()); @@ -324,8 +305,8 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } protected void handleAttribute(DomainObject obj, - String path, - Property property) { + String path, + Property property) { String name = property.getName(); Object value = obj.get(name); @@ -346,7 +327,7 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { Date date = (Date) value; Calendar calDate = Calendar.getInstance(); calDate.setTime(date); - + // locale-independent date output element.addAttribute("year", Integer.toString(calDate.get(Calendar.YEAR))); element.addAttribute("month", Integer.toString(calDate.get(Calendar.MONTH) + 1)); @@ -364,21 +345,22 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { element.addAttribute("date", dateFormatter.format(date)); element.addAttribute("longDate", longDateFormatter.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 } } } else { m_element.addAttribute(property.getName(), - (String) format(obj, path, property, value)); + (String) format(obj, path, property, value)); } } } protected void beginRole(DomainObject obj, - String path, - Property property) { + String path, + Property property) { if (m_wrapObjects) { Element element = newElement(m_element, property.getName()); m_elements.push(m_element); @@ -387,16 +369,16 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } protected void endRole(DomainObject obj, - String path, - Property property) { + String path, + Property property) { if (m_wrapObjects) { m_element = (Element) m_elements.pop(); } } protected void beginAssociation(DomainObject obj, - String path, - Property property) { + String path, + Property property) { if (m_wrapObjects) { Element element = newElement(m_element, property.getName()); m_elements.push(m_element); @@ -405,8 +387,8 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } protected void endAssociation(DomainObject obj, - String path, - Property property) { + String path, + Property property) { if (m_wrapObjects) { m_element = (Element) m_elements.pop(); } @@ -425,20 +407,20 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal { } protected Element newElement(Element parent, - String name) { + String name) { return m_namespaceURI == null - ? parent.newChildElement(name) - : parent.newChildElement(m_namespacePrefix + ":" + name, - m_namespaceURI); + ? parent.newChildElement(name) + : parent.newChildElement(m_namespacePrefix + ":" + name, + m_namespaceURI); } protected Element newElement(Element parent, - String name, - Element copy) { + String name, + Element copy) { return m_namespaceURI == null - ? parent.newChildElement(name, copy) - : parent.newChildElement(m_namespacePrefix + ":" + name, - m_namespaceURI, - copy); + ? parent.newChildElement(name, copy) + : parent.newChildElement(m_namespacePrefix + ":" + name, + m_namespaceURI, + copy); } } diff --git a/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java b/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java index 897c02f26..53ae7a665 100755 --- a/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java +++ b/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java @@ -140,7 +140,7 @@ public class DataCollectionRenderer extends LockableImpl { // Quasimodo: End Element content = Navigation.newElement("objectList"); - + //Return the empty nav:item & nav:paginator tags. // Quasimodo: Why should I??? There is no need for a paginator if there aren't any elements if (!m_navItems) { @@ -203,9 +203,9 @@ public class DataCollectionRenderer extends LockableImpl { paginator.addAttribute("objectCount", new Long(objectCount).toString()); content.addContent(paginator); - + int index = 0; - while (objects.next()) { + while (objects.next()) { DataObject dobj = objects.getDataObject(); ACSObject object = null; if (m_specializeObjects) { @@ -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())); continue; } else { - s_log.error("Specializing successful."); + s_log.debug("Specializing successful."); } - } - - Element item = Navigation.newElement("item"); + } + Element item = Navigation.newElement(content, "item"); Iterator attributes = m_attributes.iterator(); while (attributes.hasNext()) { @@ -226,23 +225,23 @@ public class DataCollectionRenderer extends LockableImpl { String[] paths = StringUtils.split(name, '.'); outputValue(item, dobj, name, paths, 0); } - + Iterator properties = m_properties.iterator(); while (properties.hasNext()) { DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next(); property.render(objects, item); } - - Element path = Navigation.newElement("path"); + + Element path = Navigation.newElement(item, "path"); path.setText(getStableURL(dobj, object)); - item.addContent(path); + //item.addContent(path); generateItemXML(item, dobj, object, index); index++; - content.addContent(item); + //content.addContent(item); } - + return content; } diff --git a/ccm-navigation/src/com/arsdigita/navigation/Navigation.java b/ccm-navigation/src/com/arsdigita/navigation/Navigation.java index 8418e1217..b6344d749 100755 --- a/ccm-navigation/src/com/arsdigita/navigation/Navigation.java +++ b/ccm-navigation/src/com/arsdigita/navigation/Navigation.java @@ -63,6 +63,11 @@ public class Navigation extends Application { 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) { ParameterMap map = new ParameterMap(); map.setParameter( NavigationConstants.OID, oid.toString() ); diff --git a/ccm-navigation/src/com/arsdigita/navigation/cms/CMSDataCollectionRenderer.java b/ccm-navigation/src/com/arsdigita/navigation/cms/CMSDataCollectionRenderer.java index d63636740..90f5d1932 100755 --- a/ccm-navigation/src/com/arsdigita/navigation/cms/CMSDataCollectionRenderer.java +++ b/ccm-navigation/src/com/arsdigita/navigation/cms/CMSDataCollectionRenderer.java @@ -61,7 +61,7 @@ public class CMSDataCollectionRenderer extends DataCollectionRenderer { DataObject dobj, ACSObject obj, int index) { - if (obj != null) { + if (obj != null) { ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(item); renderer.setRevisitFullObject(false); renderer.setWrapAttributes(true); @@ -74,7 +74,7 @@ public class CMSDataCollectionRenderer extends DataCollectionRenderer { * possible to set the adapter context used from a JSP template, * using DataCollectionRenderer#setSpecializeObjectsContext(String). */ - renderer.walk(obj, getSpecializeObjectsContext()); + renderer.walk(obj, getSpecializeObjectsContext()); if ((obj instanceof ContentItem) && useExtraXml) { final ContentItem contentItem = (ContentItem) obj; @@ -84,7 +84,7 @@ public class CMSDataCollectionRenderer extends DataCollectionRenderer { generator.generateXML(contentItem, item, null); } - } + } } } } diff --git a/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java b/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java index 0ea7b1bf2..caea7f084 100755 --- a/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java +++ b/ccm-navigation/src/com/arsdigita/navigation/ui/object/ComplexObjectList.java @@ -3,13 +3,10 @@ * * Autor: Sören Bernstein * - * Diese Klasse realisiert eine ObjectList für Navigation, - * der man Filterbefehle für die SQL-Abfrage mitgeben kann. - * Auf diese Weise lassen sich Objekte listen, die bestimmte - * Kriterien erfüllen. + * Diese Klasse realisiert eine ObjectList für Navigation, der man Filterbefehle für die SQL-Abfrage mitgeben kann. Auf + * diese Weise lassen sich Objekte listen, die bestimmte Kriterien erfüllen. * - * Angelegt wurde Sie für die Auflistung der aktuellen News - * und Veranstalungen auf einer Navigationsseite. + * Angelegt wurde Sie für die Auflistung der aktuellen News und Veranstalungen auf einer Navigationsseite. */ package com.arsdigita.navigation.ui.object; @@ -50,9 +47,9 @@ public class ComplexObjectList extends AbstractObjectList { } /** - * Hinzufügen eines SQL-Filter zur Abfrage - * Verarbeitet einen boolschen Filter, der SQL-konform Formatiert ist. - * Siehe PostgreSQL-Handbuch zur where-Klausel + * Hinzufügen eines SQL-Filter zur Abfrage Verarbeitet einen boolschen Filter, der SQL-konform Formatiert ist. Siehe + * PostgreSQL-Handbuch zur where-Klausel + * * @param sqlfilter */ public void setSQLFilter(String sqlfilter) { @@ -75,8 +72,8 @@ public class ComplexObjectList extends AbstractObjectList { 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 protected DataCollection getObjects(HttpServletRequest request, @@ -109,7 +106,9 @@ public class ComplexObjectList extends AbstractObjectList { return objects; } - /* Diese Methode wird vom Servlet aufgerufen */ + /* + * Diese Methode wird vom Servlet aufgerufen + */ public Element generateXML(HttpServletRequest request, HttpServletResponse response) { Element content = Navigation.newElement("complexObjectList"); @@ -121,9 +120,9 @@ public class ComplexObjectList extends AbstractObjectList { for (Map.Entry attribute : m_customAttributes.entrySet()) { content.addAttribute(attribute.getKey(), attribute.getValue()); } - + content.addContent(generateObjectListXML(request, response)); - + return content; } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java index 14f79cef0..dde5c4c43 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java @@ -25,8 +25,7 @@ import com.arsdigita.cms.contenttypes.PublicationWithPublisher; import com.arsdigita.cms.contenttypes.SeriesCollection; /** - * An abstract base implementation of the {@link RisConverter} interface - * providing common functionality. + * An abstract base implementation of the {@link RisConverter} interface providing common functionality. * * @author Jens Pelzetter */ @@ -66,16 +65,18 @@ public abstract class AbstractRisConverter implements RisConverter { protected void convertYear(final Publication publication) { getRisBuilder().addField(RisFields.PY, - String.format("%d///", publication. - getYearOfPublication())); + String.format("%d///", publication.getYearOfPublication())); } 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().getPlace() != null) && !(publication.getPublisher().getPlace().isEmpty())) { - getRisBuilder().addField(RisFields.CY, - publication.getPublisher().getPlace()); + getRisBuilder().addField(placeField, publication.getPublisher().getPlace()); } getRisBuilder().addField(RisFields.PB, diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInCollectedVolumeConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInCollectedVolumeConverter.java index 1a1282d2f..b87a1faf3 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInCollectedVolumeConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInCollectedVolumeConverter.java @@ -56,18 +56,18 @@ public class ArticleInCollectedVolumeConverter extends AbstractRisConverter { convertYear(publication); if (article.getCollectedVolume() != null) { - getRisBuilder().addField(RisFields.BT, + getRisBuilder().addField(RisFields.T2, article.getCollectedVolume().getTitle()); } if (article.getPagesFrom() != null) { getRisBuilder().addField(RisFields.SP, - article.getPagesFrom().toString()); - if (article.getPagesTo() != null) { + String.format("%d - %d", article.getPagesFrom(), article.getPagesTo())); + /*if (article.getPagesTo() != null) { getRisBuilder().addField(RisFields.EP, article.getPagesTo().toString()); - } + }*/ } return getRisBuilder().toRis(); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInJournalConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInJournalConverter.java index 450234ffa..97b41a4eb 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInJournalConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ArticleInJournalConverter.java @@ -50,16 +50,20 @@ public class ArticleInJournalConverter extends AbstractRisConverter { article = (ArticleInJournal) publication; - getRisBuilder().setType(RisTypes.MGZN); + getRisBuilder().setType(RisTypes.JOUR); convertAuthors(publication); convertTitle(publication); convertYear(publication); if (article.getJournal() != null) { - getRisBuilder().addField(RisFields.JF, + getRisBuilder().addField(RisFields.T2, article.getJournal().getTitle()); } + if (article.getIssue() != null) { + getRisBuilder().addField(RisFields.M1, article.getIssue()); + } + if (article.getVolume() != null) { getRisBuilder().addField(RisFields.VL, article.getVolume().toString()); @@ -67,11 +71,17 @@ public class ArticleInJournalConverter extends AbstractRisConverter { if (article.getPagesFrom() != null) { getRisBuilder().addField(RisFields.SP, - article.getPagesFrom().toString()); - getRisBuilder().addField(RisFields.EP, + String.format("%d - %d", article.getPagesFrom(), article.getPagesTo())); + /* + * getRisBuilder().addField(RisFields.EP, article.getPagesTo().toString()); + */ } - + + if (article.getReviewed()) { + getRisBuilder().addField(RisFields.RI, ""); + } + return getRisBuilder().toRis(); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/CollectedVolumeConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/CollectedVolumeConverter.java index 9014c10b5..ed19d7351 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/CollectedVolumeConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/CollectedVolumeConverter.java @@ -47,7 +47,7 @@ public class CollectedVolumeConverter extends AbstractRisConverter { collectedVolume = (CollectedVolume) publication; - getRisBuilder().setType(RisTypes.BOOK); + getRisBuilder().setType(RisTypes.EDBOOK); convertAuthors(publication); convertTitle(publication); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/GreyLiteratureConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/GreyLiteratureConverter.java index 334b5f353..9f2b84d12 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/GreyLiteratureConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/GreyLiteratureConverter.java @@ -29,10 +29,22 @@ public class GreyLiteratureConverter extends AbstractRisConverter { greyLiterature = (GreyLiterature) publication; - getRisBuilder().setType(RisTypes.GEN); + getRisBuilder().setType(RisTypes.UNPB); convertAuthors(publication); convertTitle(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(); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InProceedingsConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InProceedingsConverter.java index 7572920e7..f02aaa73d 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InProceedingsConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InProceedingsConverter.java @@ -51,31 +51,30 @@ public class InProceedingsConverter extends AbstractRisConverter { inProceedings = (InProceedings) publication; - getRisBuilder().setType(RisTypes.GEN); + getRisBuilder().setType(RisTypes.CPAPER); convertAuthors(publication); convertTitle(publication); convertYear(publication); + if (inProceedings.getProceedings() != null) { + final Proceedings proceedings = inProceedings.getProceedings(); + if (proceedings.getPlaceOfConference() != null) { + getRisBuilder().addField(RisFields.CY, proceedings.getPlaceOfConference()); + } + + + + } + if (inProceedings.getPagesFrom() != null) { getRisBuilder().addField(RisFields.SP, - inProceedings.getPagesFrom().toString()); - getRisBuilder().addField(RisFields.EP, - inProceedings.getPagesTo().toString()); + String.format("%d - %d", + inProceedings.getPagesFrom(), + inProceedings.getPagesTo())); + /*getRisBuilder().addField(RisFields.EP, + inProceedings.getPagesTo().toString());*/ } - - if(inProceedings.getProceedings() != null) { - Proceedings proceedings; - - proceedings = inProceedings.getProceedings(); - - getRisBuilder().addField(RisFields.BT, - proceedings.getTitle()); - - convertVolume(proceedings); - convertSeries(proceedings); - convertPublisher(proceedings); - } - + return getRisBuilder().toString(); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java index dc6b381fd..61a5344fd 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java @@ -50,10 +50,18 @@ public class InternetArticleConverter extends AbstractRisConverter { article = (InternetArticle) publication; - getRisBuilder().setType(RisTypes.GEN); + getRisBuilder().setType(RisTypes.EJOUR); convertAuthors(publication); convertTitle(publication); convertYear(publication); + + if (article.getReviewed()) { + getRisBuilder().addField(RisFields.RI, ""); + } + + if (article.getUrl() != null) { + getRisBuilder().addField(RisFields.UR, article.getUrl()); + } return getRisBuilder().toRis(); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ProceedingsConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ProceedingsConverter.java index b6d74778b..79d87d5da 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ProceedingsConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/ProceedingsConverter.java @@ -57,7 +57,17 @@ public class ProceedingsConverter extends AbstractRisConverter { convertVolume(proceedings); 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(); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisFields.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisFields.java index ef44a4f41..bf64fd829 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisFields.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisFields.java @@ -331,5 +331,16 @@ public enum RisFields { * Edition. Not found in the specification, but used but by some other * exports. */ - ET + ET, + /** + * Reviewed item + */ + RI, + /** + * DA + */ + DA, + C1, + C2, + C3 } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisTypes.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisTypes.java index e0c62750b..5642042f3 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisTypes.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/RisTypes.java @@ -62,6 +62,10 @@ public enum RisTypes { * Conference proceedings */ CONF, + /** + * Conference Paper + */ + CPAPER, /** * Catalog */ @@ -70,10 +74,18 @@ public enum RisTypes { * Data file */ DATA, + /** + * Edited book + */ + EDBOOK, /** * Electronic citation */ ELEC, + /** + * Eletronic Article + */ + EJOUR, /** * Generic */