From 09eeec3a34e554d76fe4aec421e606e8caa352b9 Mon Sep 17 00:00:00 2001 From: jensp Date: Tue, 31 May 2011 19:02:37 +0000 Subject: [PATCH] Korrekturen und Formatierungen git-svn-id: https://svn.libreccm.org/ccm/trunk@946 8810af33-2d31-482b-a856-94f89814c4df --- .../ui/GenericOrganizationalUnitPanel.java | 5 + .../cms/publishToFile/QueueManager.java | 156 ++++++++---------- .../com/arsdigita/templating/XSLTemplate.java | 67 ++++---- ccm-core/src/com/arsdigita/xml/XMLConfig.java | 105 ++++++------ .../london/navigation/ui/GreetingItem.java | 9 +- .../navigation/ui/object/CompareFilter.java | 30 ++-- .../ui/object/CustomizableObjectList.java | 6 +- .../cms/contenttypes/SciOrganization.xml | 4 +- .../navigation/templates/SciProjectList.jsp | 4 +- 9 files changed, 189 insertions(+), 197 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java index bcfd3b9ce..db5d00c67 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java @@ -32,6 +32,7 @@ import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPersonContactCollection; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.xml.Element; +import org.apache.log4j.Logger; /** * @@ -39,6 +40,8 @@ import com.arsdigita.xml.Element; */ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel { + private final static Logger logger = Logger.getLogger(GenericOrganizationalUnit.class); + public static final String SHOW_CONTACTS = "contacts"; public static final String SHOW_MEMBERS = "members"; private boolean displayContacts = true; @@ -72,6 +75,7 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel { protected void generateContactsXML(GenericOrganizationalUnit orga, Element parent, PageState state) { + long start = System.currentTimeMillis(); GenericOrganizationalUnitContactCollection contacts; contacts = orga.getContacts(); @@ -98,6 +102,7 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel { Integer.toString(contacts.getContactOrder()), true); } + System.out.printf("Generated Contacts XML in %d ms.\n", System.currentTimeMillis() - start); } protected void generateMembersXML(GenericOrganizationalUnit orga, diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java index 1f810523a..5601a916d 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java @@ -38,7 +38,6 @@ import java.math.BigDecimal; import java.util.HashSet; import java.io.File; - /** * Class for queuing tasks for publishing and unpublishing to * the file system and for processing the queue. When processing @@ -66,34 +65,27 @@ public class QueueManager implements Runnable { // Creates a s_logging category with name = to the full name of class private static Logger s_log = Logger.getLogger(QueueManager.class); - // Should probably use these constants. Are hardcoded for now because // matches DataQuery suffex. // final static String BLOCK_SELECT_METHOD_QUEUED_ORDER = "QueuedOrder"; // final static String BLOCK_SELECT_METHOD_GROUP_BY_PARENT = "GroupByParent"; - // Parameters involved in processing the queue and their default values. // Set to values other than default by calling methods from an initializer. private int m_startupDelay; private int m_pollDelay; - static Integer s_retryDelay = new Integer(120); static Integer s_blockSize = new Integer(20); static String s_blockSelectMethod = "QueuedOrder"; static Integer s_maximumFailCount = new Integer(-1); - // Following true if should keep watching queue - static private boolean s_keepWatchingQueue = true; - + static private boolean s_keepWatchingQueue = true; static private Thread s_queueThread = null; - // Class implementing methods run when publishing or unpublishing to file. private static PublishToFileListener s_publishListener = null; //////////////////////////////////////////////////////////////////// // Constructor related code. // - /** * * @param startupDelay @@ -107,7 +99,6 @@ public class QueueManager implements Runnable { //////////////////////////////////////////////////////////////////// // Initialization related code. // - /** * Set how many seconds the queue manager should wait before trying to * process an entry which has previously failed. @@ -146,7 +137,6 @@ public class QueueManager implements Runnable { s_maximumFailCount = maxFailCount; } - /*** * Set the listener that processes the publish and unpublish requests. */ @@ -157,7 +147,6 @@ public class QueueManager implements Runnable { //////////////////////////////////////////////////////////////////// // Methods for queuing tasks // - public static void requeueMissingFiles() { DomainCollection files = PublishedFile.retrieveAll(); @@ -167,7 +156,7 @@ public class QueueManager implements Runnable { HashSet done = new HashSet(); while (files.next()) { - PublishedFile fileRecord = (PublishedFile)files.getDomainObject(); + PublishedFile fileRecord = (PublishedFile) files.getDomainObject(); if (done.contains(fileRecord.getFileName())) { continue; @@ -182,26 +171,26 @@ public class QueueManager implements Runnable { } else if (file.exists()) { if (s_log.isDebugEnabled()) { - s_log.debug( "File " + file.getAbsolutePath() + - " already exists"); + s_log.debug("File " + file.getAbsolutePath() + + " already exists"); } } else { if (s_log.isInfoEnabled()) { - s_log.info("Published file " + file.getAbsolutePath() + - " for item " + fileRecord.getItemId() + - " isn't on the filesystem. Scheduling for " + - "republishing."); + s_log.info("Published file " + file.getAbsolutePath() + + " for item " + fileRecord.getItemId() + + " isn't on the filesystem. Scheduling for " + + "republishing."); } ContentItem item = fileRecord.getItem(); if (item == null) { - s_log.warn - ("No corresponding content item found for " + - "published file " + fileRecord.getFileName() + " " + - "(draft id " + fileRecord.getDraftId() + ", " + - "item id " + fileRecord.getItemId() + ")"); + s_log.warn("No corresponding content item found for " + + "published file " + fileRecord.getFileName() + + " " + "(draft id " + fileRecord.getDraftId() + + ", " + "item id " + fileRecord.getItemId() + + ")"); } else { ACSObject parent = item.getParent(); BigDecimal parentID = null; @@ -215,7 +204,6 @@ public class QueueManager implements Runnable { } } - /*** * Schedule an item for publishing. This should be called just after a new * live version of an item becomes available. @@ -225,8 +213,8 @@ public class QueueManager implements Runnable { * @pre ! item instanceof ContainerItem ***/ public static void queuePublish(ContentItem item) { - Assert.isTrue( !(item instanceof ContentBundle), - "Cannot queue content bundle " + item ); + Assert.isTrue(!(item instanceof ContentBundle), + "Cannot queue content bundle " + item); Assert.isTrue(item.isLiveVersion(), "Item is not live"); if (s_log.isInfoEnabled()) { s_log.info("Queue publish task for " + item.getID()); @@ -234,17 +222,17 @@ public class QueueManager implements Runnable { String task = QueueEntry.TASK_PUBLISH; QueueEntryCollection q = new QueueEntryCollection( - item.getID()); + item.getID()); while (q.next()) { - if ( q.isPublishTask() ) { + if (q.isPublishTask()) { if (s_log.isDebugEnabled()) { s_log.debug("Deleting existing publish task " + q.getID()); } q.delete(); - } else if ( q.isUnpublishTask() || q.isRepublishTask() ) { + } else if (q.isUnpublishTask() || q.isRepublishTask()) { if (s_log.isDebugEnabled()) { - s_log.debug("Deleting existing (un|re)publish task " + - q.getID()); + s_log.debug("Deleting existing (un|re)publish task " + q. + getID()); } task = QueueEntry.TASK_REPUBLISH; q.delete(); @@ -253,7 +241,6 @@ public class QueueManager implements Runnable { queue(item, task); } - /*** * Schedule an item for unpublishing. This should be called just before * the live version item is deleted. @@ -268,11 +255,11 @@ public class QueueManager implements Runnable { } QueueEntryCollection q = new QueueEntryCollection( - item.getID()); + item.getID()); while (q.next()) { - if ( q.isPublishTask() - || q.isRepublishTask() - || q.isUnpublishTask() ) { + if (q.isPublishTask() + || q.isRepublishTask() + || q.isUnpublishTask()) { if (s_log.isDebugEnabled()) { s_log.debug("Deleting existing (un|re|new)publish task " + q.getID()); @@ -283,7 +270,6 @@ public class QueueManager implements Runnable { queue(item, QueueEntry.TASK_UNPUBLISH); } - /*** * Schedule an item for republishing. This should be called whenever an * existing live item item should be refreshed in the file @@ -300,16 +286,16 @@ public class QueueManager implements Runnable { } QueueEntryCollection q = new QueueEntryCollection( - item.getID()); + item.getID()); while (q.next()) { - if ( q.isUnpublishTask() - || q.isPublishTask() ) { + if (q.isUnpublishTask() + || q.isPublishTask()) { if (s_log.isDebugEnabled()) { s_log.debug("Deleting existing (un|new)publish task " + q.getID()); } q.delete(); - } else if ( q.isRepublishTask() ) { + } else if (q.isRepublishTask()) { if (s_log.isDebugEnabled()) { s_log.debug("Aborting because there is already a republish " + q.getID()); @@ -339,11 +325,11 @@ public class QueueManager implements Runnable { } Assert.isTrue(liveItem != null && liveItem.isLiveVersion(), - "Item is not live"); + "Item is not live"); Assert.isTrue(source != null && source.isLiveVersion(), - "Source is not live"); + "Source is not live"); Assert.isTrue(destination != null && destination.isLiveVersion(), - "Destination is not live"); + "Destination is not live"); // for move put itemId as destination folder ID, for parent_id source // folder ID we do not need any other information for move @@ -354,8 +340,8 @@ public class QueueManager implements Runnable { } private static void queue(ContentItem item, String task) { - Assert.isTrue( !(item instanceof ContentBundle), - "Cannot queue content bundle " + item ); + Assert.isTrue(!(item instanceof ContentBundle), + "Cannot queue content bundle " + item); Assert.isTrue(item.isLiveVersion(), "Item is not live"); ACSObject parent = item.getParent(); @@ -374,12 +360,12 @@ public class QueueManager implements Runnable { String task, String destination) { if (s_log.isDebugEnabled()) { - s_log.debug("Queue " + task + " for " + item.getOID() + " on all hosts"); + s_log.debug("Queue " + task + " for " + item.getOID() + + " on all hosts"); } DestinationStub dest = PublishToFile.getDestination( - item.getSpecificObjectType() - ); + item.getSpecificObjectType()); // No destination configured for this object type, lets // get outta here, since they obviously don't want to // p2fs it.... @@ -388,7 +374,7 @@ public class QueueManager implements Runnable { } DomainCollection hosts = Host.retrieveAll(); - while ( hosts.next() ) { + while (hosts.next()) { Host host = (Host) hosts.getDomainObject(); if (s_log.isDebugEnabled()) { @@ -410,8 +396,7 @@ public class QueueManager implements Runnable { String destination, Host host) { if (s_log.isDebugEnabled()) { - s_log.debug("Queue item " + item + " for " + - task + " on " + host); + s_log.debug("Queue item " + item + " for " + task + " on " + host); } QueueEntry q = QueueEntry.create(item, @@ -425,8 +410,6 @@ public class QueueManager implements Runnable { //////////////////////////////////////////////////////////////////// // Routines from here down involved with processing the queue. // - - /** * Start watching and processing the queue. This method spawns a * background thread that processes the queue. Queue processing starts @@ -439,11 +422,12 @@ public class QueueManager implements Runnable { * has any entries. */ public static void startWatchingQueue(int startupDelay, int pollDelay) { - if ( startupDelay > 0 ) { + if (startupDelay > 0) { if (s_log.isInfoEnabled()) { s_log.info("Going to start queue processing."); } - s_queueThread = new Thread( new QueueManager(startupDelay, pollDelay) ); + s_queueThread = + new Thread(new QueueManager(startupDelay, pollDelay)); s_queueThread.setDaemon(true); s_queueThread.setName("cms-p2fs-queue"); s_queueThread.start(); @@ -464,8 +448,6 @@ public class QueueManager implements Runnable { s_keepWatchingQueue = false; } - - /*** * Watch queue for entries to process. The main routine that starts * queue processing. @@ -477,13 +459,12 @@ public class QueueManager implements Runnable { HashSet failedItems = new HashSet(); - while ( sleep(m_pollDelay) && s_keepWatchingQueue ) { + while (sleep(m_pollDelay) && s_keepWatchingQueue) { // synchronized( Scheduler.class ) { //while there are more entries in queue process them.HashSet //is used to store the failed items and for checking that //they do not get processed again. - while ( processQueueItems(failedItems) ) - ; + while (processQueueItems(failedItems)); // clear failed items failedItems.clear(); @@ -499,8 +480,8 @@ public class QueueManager implements Runnable { try { Thread.sleep(n * 1000); return true; - } catch ( InterruptedException e ) { - s_log.error( "Waiting was interrupted."); + } catch (InterruptedException e) { + s_log.error("Waiting was interrupted."); return false; } } @@ -525,11 +506,11 @@ public class QueueManager implements Runnable { s_log.warn("Ignoring uncaught exception", e); } finally { try { - if ( query != null ) { + if (query != null) { query.close(); } - if ( txn.inTxn() ) { + if (txn.inTxn()) { txn.abortTxn(); s_log.info("Aborting transaction"); } @@ -548,7 +529,8 @@ public class QueueManager implements Runnable { * This method exists so that we can test p2fs without the * transaction management code. */ - private static boolean processQueueItemsInternal(DataQuery query, HashSet failedItems) { + private static boolean processQueueItemsInternal(DataQuery query, + HashSet failedItems) { Host host = Web.getConfig().getCurrentHost(); boolean hasMore = false; @@ -558,7 +540,7 @@ public class QueueManager implements Runnable { query.setParameter("maximumFailCount", s_maximumFailCount); int entryCount = 0; - while ( query.next() && entryCount < s_blockSize.intValue() ) { + while (query.next() && entryCount < s_blockSize.intValue()) { DataObject dobj = (DataObject) query.get("queueEntry"); QueueEntry qe = new QueueEntry(dobj); if (s_log.isDebugEnabled()) { @@ -566,7 +548,7 @@ public class QueueManager implements Runnable { } BigDecimal itemId = qe.getItemId(); - if ( !failedItems.contains(itemId) ) { + if (!failedItems.contains(itemId)) { try { if (entryCount == 0) { // Tell the publish listener that we are about @@ -580,17 +562,20 @@ public class QueueManager implements Runnable { s_publishListener.doTask(qe); qe.delete(); // successfully processed item, delete from queue - } catch ( PublishToFileException e ) { - flagError(itemId, "PublishToFileException.", e, qe, failedItems); - } catch ( Exception e ) { - flagError(itemId, "Task " + qe + " failed:", e, qe, failedItems); + } catch (PublishToFileException e) { + flagError(itemId, "PublishToFileException.", e, qe, + failedItems); + } catch (Exception e) { + flagError(itemId, "Task " + qe + " failed:", e, qe, + failedItems); } entryCount++; } } - if ( entryCount > 0 ) + if (entryCount > 0) { s_publishListener.transactionEnd(); + } hasMore = !query.isAfterLast(); @@ -598,19 +583,19 @@ public class QueueManager implements Runnable { } - /** * Get items to process * @return Query for fetching block to process. */ static DataQuery getBlockQuery() { - DataQuery query = SessionManager.getSession() - .retrieveQuery("com.arsdigita.cms.publishToFile.getBlock"); + DataQuery query = SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.publishToFile.getBlock"); - if ("GroupByParent".equals(s_blockSelectMethod)) + if ("GroupByParent".equals(s_blockSelectMethod)) { query.addOrder("queueEntry.parentId, queueEntry.sortOrder"); - else + } else { query.addOrder("queueEntry.sortOrder"); + } return query; } @@ -620,16 +605,13 @@ public class QueueManager implements Runnable { // Flag that queue entry failed failedItems.add(itemId); Long failCount = qe.getFailCount(); - s_log.error( exName + " itemId=" + itemId + - " task=" + qe + - " destination=" + qe.getDestination() + " failCount=" + failCount + - " error=" + e.getMessage(), e); + s_log.error(exName + " itemId=" + itemId + " task=" + qe + + " destination=" + qe.getDestination() + " failCount=" + + failCount + " error=" + e.getMessage(), e); DataOperation operation = SessionManager.getSession(). - retrieveDataOperation( - "com.arsdigita.cms.publishToFile.flagPublishFailed" - ); + retrieveDataOperation( + "com.arsdigita.cms.publishToFile.flagPublishFailed"); operation.setParameter("id", qe.getID()); operation.execute(); } - } diff --git a/ccm-core/src/com/arsdigita/templating/XSLTemplate.java b/ccm-core/src/com/arsdigita/templating/XSLTemplate.java index f9db7f67d..5e6d619fc 100755 --- a/ccm-core/src/com/arsdigita/templating/XSLTemplate.java +++ b/ccm-core/src/com/arsdigita/templating/XSLTemplate.java @@ -57,13 +57,12 @@ import org.w3c.dom.Document; * @version $Id: XSLTemplate.java 287 2005-02-22 00:29:02Z sskracic $ */ public final class XSLTemplate { + public static final String versionId = - "$Id: XSLTemplate.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; - + "$Id: XSLTemplate.java 287 2005-02-22 00:29:02Z sskracic $" + + "$Author: sskracic $" + + "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(XSLTemplate.class); - private final URL m_source; private final Templates m_templates; private final List m_dependents; @@ -93,12 +92,12 @@ public final class XSLTemplate { s_log.debug("Getting new templates object"); final TransformerFactory factory = - TransformerFactory.newInstance(); + TransformerFactory.newInstance(); factory.setURIResolver(resolver); factory.setErrorListener(listener); - m_templates = factory.newTemplates - (resolver.resolve(m_source.toString(), null)); + m_templates = factory.newTemplates(resolver.resolve(m_source. + toString(), null)); s_log.debug("Done getting new templates"); } catch (TransformerConfigurationException ex) { @@ -175,8 +174,8 @@ public final class XSLTemplate { final Result result, final ErrorListener listener) { if (s_log.isDebugEnabled()) { - s_log.debug("Transforming " + source + " and sending it to " + - result + " using error listener " + listener); + s_log.debug("Transforming " + source + " and sending it to " + + result + " using error listener " + listener); } if (Assert.isEnabled()) { @@ -189,12 +188,10 @@ public final class XSLTemplate { final Transformer transformer = newTransformer(); transformer.setErrorListener(listener); - if (s_log.isDebugEnabled()) { - s_log.debug("Transforming the XML source document"); - } - + s_log.debug("Transforming the XML source document"); + transformer.transform(source, result); - + s_log.debug("Finished transforming"); } catch (TransformerConfigurationException tce) { throw new WrappedTransformerException(tce); @@ -268,14 +265,14 @@ public final class XSLTemplate { */ public final boolean isModified() { if (s_log.isDebugEnabled()) { - s_log.debug("Checking if the XSL files for " + this + " " + - "have been modified and need to be re-read"); + s_log.debug("Checking if the XSL files for " + this + " " + + "have been modified and need to be re-read"); } final Iterator iter = m_dependents.iterator(); while (iter.hasNext()) { - final URL url = Templating.transformURL((URL)iter.next()); + final URL url = Templating.transformURL((URL) iter.next()); Assert.exists(url, URL.class); if (url.getProtocol().equals("file")) { @@ -283,16 +280,16 @@ public final class XSLTemplate { if (file.lastModified() > m_created.getTime()) { if (s_log.isInfoEnabled()) { - s_log.info("File " + file + " was modified " + - file.lastModified()); + s_log.info("File " + file + " was modified " + file. + lastModified()); } return true; } } else { if (s_log.isDebugEnabled()) { - s_log.debug("The URL is not to a file; assuming " + - url + " is not modified"); + s_log.debug("The URL is not to a file; assuming " + url + + " is not modified"); } } } @@ -316,11 +313,11 @@ public final class XSLTemplate { * @param base the base directory in which the files will extract */ public void toZIP(OutputStream os, - String base) - throws IOException { - + String base) + throws IOException { + final ZipOutputStream zos = new ZipOutputStream(os); - + URL src = getSource(); String srcProto = src.getProtocol(); @@ -330,7 +327,7 @@ public final class XSLTemplate { final Iterator sheets = getDependents().iterator(); while (sheets.hasNext()) { - URL xsl = (URL)sheets.next(); + URL xsl = (URL) sheets.next(); if (xsl.getProtocol().equals(srcProto)) { if (s_log.isDebugEnabled()) { s_log.debug("Outputting file " + xsl); @@ -339,19 +336,20 @@ public final class XSLTemplate { if (path.startsWith("/")) { path = path.substring(1); } - + zos.putNextEntry(new ZipEntry(base + "/" + path)); - + IO.copy(xsl.openStream(), zos); } else { - s_log.warn("Not outputting file " + xsl + - " because its not under protocol " + srcProto); + s_log.warn("Not outputting file " + xsl + + " because its not under protocol " + srcProto); } } zos.finish(); } private static class Log4JErrorListener implements ErrorListener { + public void warning(TransformerException e) throws TransformerException { log(Level.WARN, e); } @@ -360,13 +358,14 @@ public final class XSLTemplate { log(Level.ERROR, e); } - public void fatalError(TransformerException e) throws TransformerException { + public void fatalError(TransformerException e) throws + TransformerException { log(Level.FATAL, e); } private static void log(Level level, TransformerException ex) { - s_log.log(level, "Transformer " + level + ": " + - ex.getLocationAsString() + ": " + ex.getMessage(), + s_log.log(level, "Transformer " + level + ": " + ex. + getLocationAsString() + ": " + ex.getMessage(), ex); } } diff --git a/ccm-core/src/com/arsdigita/xml/XMLConfig.java b/ccm-core/src/com/arsdigita/xml/XMLConfig.java index 55cc708c3..7738924dc 100755 --- a/ccm-core/src/com/arsdigita/xml/XMLConfig.java +++ b/ccm-core/src/com/arsdigita/xml/XMLConfig.java @@ -37,38 +37,34 @@ import org.apache.log4j.Logger; public final class XMLConfig extends AbstractConfig { public final static String versionId = - "$Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; - - private static final Logger s_log = Logger.getLogger - (XMLConfig.class); - + "$Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $" + + "$Author: sskracic $" + + "$DateTime: 2004/08/16 18:10:38 $"; + private static final Logger s_log = Logger.getLogger(XMLConfig.class); private static XMLConfig s_config; - // supported XSL transformer implementations private static final String RESIN = - "com.caucho.xsl.Xsl"; + "com.caucho.xsl.Xsl"; private static final String JD_XSLT = - "jd.xml.xslt.trax.TransformerFactoryImpl"; + "jd.xml.xslt.trax.TransformerFactoryImpl"; private static final String XSLTC = - "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; + "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; private static final String SAXON = - "com.icl.saxon.TransformerFactoryImpl"; + "com.icl.saxon.TransformerFactoryImpl"; + private static final String SAXON_HE = + "net.sf.saxon.TransformerFactoryImpl"; private static final String XALAN = - "org.apache.xalan.processor.TransformerFactoryImpl"; - + "org.apache.xalan.processor.TransformerFactoryImpl"; // supported documentBuilder implementations private static final String DOM_XERCES = - "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; + "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; private static final String DOM_RESIN = - "com.caucho.xml.parsers.XmlDocumentBuilderFactory"; - + "com.caucho.xml.parsers.XmlDocumentBuilderFactory"; // supported SAX parser implementations private static final String SAX_XERCES = - "org.apache.xerces.jaxp.SAXParserFactoryImpl"; + "org.apache.xerces.jaxp.SAXParserFactoryImpl"; private static final String SAX_RESIN = - "com.caucho.xml.parsers.XmlSAXParserFactory"; + "com.caucho.xml.parsers.XmlSAXParserFactory"; /** * Returns the singleton configuration record for the XML functionality @@ -84,22 +80,18 @@ public final class XMLConfig extends AbstractConfig { return s_config; } - - private final Parameter m_xfmr = new StringParameter - ("waf.xml.xsl_transformer", Parameter.REQUIRED, "saxon"); - - private final Parameter m_builder = new StringParameter - ("waf.xml.dom_builder", Parameter.REQUIRED, "xerces"); - - private final Parameter m_parser = new StringParameter - ("waf.xml.sax_parser", Parameter.REQUIRED, "xerces"); - - private Parameter m_activateFullTimeFormatter = new BooleanParameter - ("waf.xml.activate_full_date_formatter", - Parameter.OPTIONAL, new Boolean(false)); - - - + private final Parameter m_xfmr = new StringParameter( + "waf.xml.xsl_transformer", Parameter.REQUIRED, "saxon"); + private final Parameter m_builder = new StringParameter( + "waf.xml.dom_builder", Parameter.REQUIRED, "xerces"); + private final Parameter m_parser = new StringParameter("waf.xml.sax_parser", + Parameter.REQUIRED, + "xerces"); + private Parameter m_activateFullTimeFormatter = new BooleanParameter( + "waf.xml.activate_full_date_formatter", + Parameter.OPTIONAL, + new Boolean( + false)); /** * Constructs an empty XMLConfig object following the singelton pattern. @@ -108,10 +100,9 @@ public final class XMLConfig extends AbstractConfig { * it does not work with the associated classes AbstractConfig and * ConfigRegistry because they can currently not deal with a private constructor */ - // private XMLConfig() { public XMLConfig() { - + register(m_xfmr); register(m_builder); register(m_parser); @@ -120,10 +111,7 @@ public final class XMLConfig extends AbstractConfig { loadInfo(); } - /* ************ public getter / setter section ************ */ - - /** * Returns the XSL Transformer factory class name to use. * @@ -136,12 +124,20 @@ public final class XMLConfig extends AbstractConfig { String m_key = (String) get(m_xfmr); // Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc - if(m_key.toLowerCase().equals("xsltc")) return XSLTC; - if(m_key.toLowerCase().equals("xalan")) return XALAN ; - if(m_key.toLowerCase().equals("resin")) return RESIN; - if(m_key.toLowerCase().equals("jd.xslt")) return JD_XSLT; - // return defaultValue - return SAXON; + if (m_key.toLowerCase().equals("xsltc")) { + return XSLTC; + } else if (m_key.toLowerCase().equals("xalan")) { + return XALAN; + } else if (m_key.toLowerCase().equals("resin")) { + return RESIN; + } else if (m_key.toLowerCase().equals("jd.xslt")) { + return JD_XSLT; + } else if (m_key.toLowerCase().equals("saxonhe")) { + return SAXON_HE; + } else { + // return defaultValue + return SAXON; + } } /** @@ -156,8 +152,11 @@ public final class XMLConfig extends AbstractConfig { String m_key = (String) get(m_builder); // Defined values: xerces (default)|resin - if(m_key.toLowerCase().equals("resin")) return DOM_RESIN; - else return DOM_XERCES; + if (m_key.toLowerCase().equals("resin")) { + return DOM_RESIN; + } else { + return DOM_XERCES; + } } /** @@ -172,8 +171,11 @@ public final class XMLConfig extends AbstractConfig { String m_key = (String) get(m_parser); // Defined values: xerces (default)|resin - if(m_key.toLowerCase().equals("resin")) return SAX_RESIN; - else return SAX_XERCES; + if (m_key.toLowerCase().equals("resin")) { + return SAX_RESIN; + } else { + return SAX_XERCES; + } } /** @@ -187,7 +189,6 @@ public final class XMLConfig extends AbstractConfig { * Sets the activateFullTimeFormatter flag. */ public void setActivateFullTimeFormatter(boolean activateFullTimeFormatter) { - set (m_activateFullTimeFormatter,new Boolean(activateFullTimeFormatter)); + set(m_activateFullTimeFormatter, new Boolean(activateFullTimeFormatter)); } - } diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/GreetingItem.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/GreetingItem.java index 0a2d87d1e..16e8e4149 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/GreetingItem.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/GreetingItem.java @@ -55,10 +55,11 @@ public class GreetingItem extends AbstractComponent { public Element generateXML(HttpServletRequest request, HttpServletResponse response) { + long start = System.currentTimeMillis(); ContentItem item = (ContentItem) getObject(); if (null == item || !item.isLive()) { return null; - } + } if (!ContentItem.VERSION.equals(item.getVersion())) { item = item.getLiveVersion(); @@ -106,7 +107,7 @@ public class GreetingItem extends AbstractComponent { if (baseItem == null) { // get the primary instance instead (fallback) baseItem = bundle.getPrimaryInstance(); - } + } Element itemEl = content.newChildElement("cms:item", CMS.CMS_XML_NS); @@ -122,8 +123,8 @@ public class GreetingItem extends AbstractComponent { renderer.walk(baseItem, SimpleXMLGenerator.ADAPTER_CONTEXT);*/ generateGreetingItemXml(itemEl, baseItem); - - return content; + + return content; } /** diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CompareFilter.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CompareFilter.java index ebd7ffc8b..4a1103680 100644 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CompareFilter.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CompareFilter.java @@ -20,8 +20,7 @@ public class CompareFilter implements Filter { private final String label; private final boolean allOption; private final boolean allOptionIsDefault; - private final boolean propertyIsNumeric; - private final boolean includeNull; + private final boolean propertyIsNumeric; private Map options = new LinkedHashMap(); private String value; @@ -29,14 +28,13 @@ public class CompareFilter implements Filter { final String label, final boolean allOption, final boolean allOptionIsDefault, - final boolean propertyIsNumeric, - final boolean includeNull) { + final boolean propertyIsNumeric + ) { this.property = property; this.label = label; this.allOption = allOption; this.allOptionIsDefault = allOptionIsDefault; - this.propertyIsNumeric = propertyIsNumeric; - this.includeNull = includeNull; + this.propertyIsNumeric = propertyIsNumeric; } @Override @@ -45,14 +43,15 @@ public class CompareFilter implements Filter { } public CompareFilter addOption(final String label, final String value) { - return addOption(label, Operators.EQ, value); + return addOption(label, Operators.EQ, value, false); } public CompareFilter addOption(final String label, final Operators operator, - final String value) { + final String value, + final boolean includeNull) { Option option; - option = new Option(label, operator, value); + option = new Option(label, operator, value, includeNull); options.put(label, option); return this; } @@ -113,10 +112,10 @@ public class CompareFilter implements Filter { filter.append('\''); } - if (includeNull) { + if (selectedOption.getIncludeNull()) { filter.append(String.format(" or %s is null", property)); } - + return filter.toString(); } @@ -173,13 +172,16 @@ public class CompareFilter implements Filter { private final String label; private final Operators operator; private final String value; + private final boolean includeNull; public Option(final String label, final Operators operator, - final String value) { + final String value, + final boolean includeNull) { this.label = label; this.operator = operator; this.value = value; + this.includeNull = includeNull; } public String getLabel() { @@ -193,5 +195,9 @@ public class CompareFilter implements Filter { public String getValue() { return value; } + + public boolean getIncludeNull() { + return includeNull; + } } } diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CustomizableObjectList.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CustomizableObjectList.java index 5ab5b2644..cd87dcdfa 100644 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CustomizableObjectList.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/object/CustomizableObjectList.java @@ -142,16 +142,14 @@ public class CustomizableObjectList extends ComplexObjectList { final String label, final boolean allOption, final boolean allOptionIsDefault, - final boolean propertyIsNumeric, - final boolean includeNull) { + final boolean propertyIsNumeric) { CompareFilter filter; filter = new CompareFilter(property, label, allOption, allOptionIsDefault, - propertyIsNumeric, - includeNull); + propertyIsNumeric); filters.put(label, filter); return filter; diff --git a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml b/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml index f8908a25b..e3903afea 100644 --- a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml +++ b/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml @@ -13,7 +13,7 @@ - + diff --git a/ccm-zes-aplaws/web/packages/navigation/templates/SciProjectList.jsp b/ccm-zes-aplaws/web/packages/navigation/templates/SciProjectList.jsp index 2ee6cd435..ccb76568a 100644 --- a/ccm-zes-aplaws/web/packages/navigation/templates/SciProjectList.jsp +++ b/ccm-zes-aplaws/web/packages/navigation/templates/SciProjectList.jsp @@ -47,8 +47,8 @@ now.get(java.util.GregorianCalendar.DATE)); objList.addCompareFilter("projectend", "projectstatus", true, true, false) - .addOption("ongoing", CompareFilter.Operators.GTEQ, today) - .addOption("finished", CompareFilter.Operators.LT, today); + .addOption("ongoing", CompareFilter.Operators.GTEQ, today, true) + .addOption("finished", CompareFilter.Operators.LT, today, false); objList.addSortField("title", "title asc"); objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));