From 3a54653bb725b4b25165e33075d512322f67afde Mon Sep 17 00:00:00 2001 From: pb Date: Sun, 4 Oct 2009 16:54:54 +0000 Subject: [PATCH] Integrated r1968, r1973, r1974: Postgresql 8.3 compatibility; various formatting and documentation. git-svn-id: https://svn.libreccm.org/ccm/trunk@273 8810af33-2d31-482b-a856-94f89814c4df --- .../content-section/Content-queries.pdl | 2 +- .../content-section/LifecycleService.pdl | 8 ++++---- .../query-getEnabledUserTasks.ora.pdl | 8 ++++---- .../query-getEnabledUserTasks.pg.pdl | 8 ++++---- .../src/com/arsdigita/cms/ContentBundle.java | 4 ---- .../com/arsdigita/cms/UserHomeFolderMap.java | 4 ++-- .../dispatcher/MultilingualItemResolver.java | 12 ++---------- .../cms/publishToFile/Initializer.java | 2 +- .../cms/publishToFile/QueueManager.java | 19 +++++++++++-------- .../cms/ui/folder/FolderBrowser.java | 6 +----- .../kernel/permissions/PermissionManager.java | 6 +++--- .../runtime/CompoundInitializer.java | 4 +--- .../com/arsdigita/runtime/Initializer.java | 4 ---- .../arsdigita/web/ApplicationFileServlet.java | 11 ++++++++--- .../src/com/arsdigita/web/BaseServlet.java | 4 ---- .../web/CCMApplicationContextListener.java | 8 +++----- ccm-core/src/com/arsdigita/web/Web.java | 11 ++++------- .../web/packages/bebop/xsl/XinhaEditor.xsl | 2 +- 18 files changed, 50 insertions(+), 73 deletions(-) diff --git a/ccm-cms/pdl/com/arsdigita/content-section/Content-queries.pdl b/ccm-cms/pdl/com/arsdigita/content-section/Content-queries.pdl index da9a0d0c5..97f1d0a95 100755 --- a/ccm-cms/pdl/com/arsdigita/content-section/Content-queries.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-section/Content-queries.pdl @@ -20,7 +20,7 @@ query getContentItemExpiredBeforeInSection { where m.item_id = o.object_id and m.cycle_id = l.cycle_id and - l.has_ended = 0 and + l.has_ended = '0' and :endDateTime >= l.end_date_time and i.item_id = o.object_id and i.section_id = :sectionId and diff --git a/ccm-cms/pdl/com/arsdigita/content-section/LifecycleService.pdl b/ccm-cms/pdl/com/arsdigita/content-section/LifecycleService.pdl index 880c510ad..373e353bb 100755 --- a/ccm-cms/pdl/com/arsdigita/content-section/LifecycleService.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-section/LifecycleService.pdl @@ -57,7 +57,7 @@ query getLifecycleStart { where m.item_id = o.object_id and m.cycle_id = l.cycle_id and - l.has_begun = 0 and + l.has_begun = '0' and :startDateTime >= l.start_date_time } map { objectId = o.object_id; @@ -87,7 +87,7 @@ query getLifecycleEnd { where m.item_id = o.object_id and m.cycle_id = l.cycle_id and - l.has_ended = 0 and + l.has_ended = '0' and :endDateTime >= l.end_date_time } map { objectId = o.object_id; @@ -117,7 +117,7 @@ query getPhaseStart { where m.item_id = o.object_id and m.cycle_id = p.cycle_id and - p.has_begun = 0 and + p.has_begun = '0' and :startDateTime >= p.start_date_time } map { objectId = o.object_id; @@ -149,7 +149,7 @@ query getPhaseEnd { where m.item_id = o.object_id and m.cycle_id = p.cycle_id and - p.has_ended = 0 and + p.has_ended = '0' and :endDateTime >= p.end_date_time } map { objectId = o.object_id; diff --git a/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl b/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl index 2142bcfba..132debcd9 100755 --- a/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl @@ -35,7 +35,7 @@ query getEnabledUserTasks { BigDecimal lockingUserID; String taskType; String taskTypeClass; - Integer status; + String status; String processLabel; do { select cw_tasks.task_id, @@ -56,11 +56,11 @@ query getEnabledUserTasks { cms_items.name, cms_pages.title, CASE WHEN (cw_user_tasks.locking_user_id = :userId) then - 1 + '1' WHEN (cw_user_tasks.locking_user_id is null) then - 2 + '2' ELSE - 3 + '3' END as status, cw_user_tasks.locking_user_id, cw_tasks_proc.label as processLabel diff --git a/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl b/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl index b558a9669..c6c4ec9de 100755 --- a/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl @@ -35,7 +35,7 @@ query getEnabledUserTasks { BigDecimal lockingUserID; String taskType; String taskTypeClass; - Integer status; + String status; String processLabel; do { select cw_tasks.task_id, @@ -56,11 +56,11 @@ query getEnabledUserTasks { cms_items.name, cms_pages.title, CASE WHEN (cw_user_tasks.locking_user_id = :userId) then - 1 + '1' WHEN (cw_user_tasks.locking_user_id is null) then - 2 + '2' ELSE - 3 + '3' END as status, cw_user_tasks.locking_user_id, cw_tasks_proc.label as processLabel diff --git a/ccm-cms/src/com/arsdigita/cms/ContentBundle.java b/ccm-cms/src/com/arsdigita/cms/ContentBundle.java index 9bfab3910..a3636b612 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentBundle.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentBundle.java @@ -56,10 +56,6 @@ import org.apache.log4j.Logger; * @version $Id: ContentBundle.java 967 2005-10-28 18:08:42Z sskracic $ */ public class ContentBundle extends ContentItem { - public static final String versionId = - "$Id: ContentBundle.java 967 2005-10-28 18:08:42Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: $"; private static final Logger s_log = Logger.getLogger(ContentBundle.class); diff --git a/ccm-cms/src/com/arsdigita/cms/UserHomeFolderMap.java b/ccm-cms/src/com/arsdigita/cms/UserHomeFolderMap.java index 048a2f832..b4bee6f74 100755 --- a/ccm-cms/src/com/arsdigita/cms/UserHomeFolderMap.java +++ b/ccm-cms/src/com/arsdigita/cms/UserHomeFolderMap.java @@ -159,8 +159,8 @@ public class UserHomeFolderMap extends ACSObject { public static UserHomeFolderMap findUserHomeFolderMap(User user, ContentSection section) { DataCollection maps = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - maps.addEqualsFilter(USER_ID,user.getID().toString()); - maps.addEqualsFilter(SECTION_ID,section.getID().toString()); + maps.addEqualsFilter(USER_ID, user.getID()); + maps.addEqualsFilter(SECTION_ID, section.getID()); UserHomeFolderMap map = null; if ( maps.next() ) { diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java index 41f669d8f..6871ad073 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java @@ -51,10 +51,6 @@ import java.util.StringTokenizer; * @version $Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $ */ public class MultilingualItemResolver extends AbstractItemResolver implements ItemResolver { - public static final String versionId = - "$Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $" + - "$Author: pboy $" + - "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger (MultilingualItemResolver.class); @@ -720,12 +716,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It // will have deal with 'foo' folder. String name = index > 0 ? url.substring(0, index) : ""; - parentFolder = - // really object identity? Don't think so - // name != "" ? (Folder) parentFolder.getItem(URLEncoder.encode(name), true) - // : parentFolder; - name.isEmpty() ? parentFolder - : (Folder) parentFolder.getItem(URLEncoder.encode(name), true); + parentFolder = "".equals(name) ? parentFolder + : (Folder) parentFolder.getItem(URLEncoder.encode(name), true); url = index + 1 < len ? url.substring(index + 1) : ""; return getItemFromLiveURL(url, parentFolder); diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java index ebb97bb20..b59e1a88e 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java @@ -206,7 +206,7 @@ public class Initializer implements com.arsdigita.initializer.Initializer { // start thread for monitoring queue int startupDelay = getInteger(QUEUE_POLL_STARTUP_DELAY).intValue(); int pollDelay = getInteger(QUEUE_POLL_DELAY).intValue(); - QueueManager.startWatchingQueue(startupDelay, pollDelay); + // QueueManager.startWatchingQueue(startupDelay, pollDelay); } // diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java index eed4656a4..5c0897c8f 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/QueueManager.java @@ -85,7 +85,7 @@ public class QueueManager implements Runnable { // 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. @@ -217,9 +217,9 @@ public class QueueManager implements Runnable { * @pre ! item instanceof ContainerItem ***/ public static void queuePublish(ContentItem item) { - Assert.truth( !(item instanceof ContentBundle), + Assert.isTrue( !(item instanceof ContentBundle), "Cannot queue content bundle " + item ); - Assert.truth(item.isLiveVersion(), "Item is not live"); + Assert.isTrue(item.isLiveVersion(), "Item is not live"); if (s_log.isInfoEnabled()) { s_log.info("Queue publish task for " + item.getID()); } @@ -330,11 +330,11 @@ public class QueueManager implements Runnable { s_log.info("Queue move task for " + liveItem.getID()); } - Assert.truth(liveItem != null && liveItem.isLiveVersion(), + Assert.isTrue(liveItem != null && liveItem.isLiveVersion(), "Item is not live"); - Assert.truth(source != null && source.isLiveVersion(), + Assert.isTrue(source != null && source.isLiveVersion(), "Source is not live"); - Assert.truth(destination != null && destination.isLiveVersion(), + Assert.isTrue(destination != null && destination.isLiveVersion(), "Destination is not live"); // for move put itemId as destination folder ID, for parent_id source @@ -346,9 +346,9 @@ public class QueueManager implements Runnable { } private static void queue(ContentItem item, String task) { - Assert.truth( !(item instanceof ContentBundle), + Assert.isTrue( !(item instanceof ContentBundle), "Cannot queue content bundle " + item ); - Assert.truth(item.isLiveVersion(), "Item is not live"); + Assert.isTrue(item.isLiveVersion(), "Item is not live"); ACSObject parent = item.getParent(); BigDecimal parentID = null; @@ -447,6 +447,9 @@ public class QueueManager implements Runnable { * middle of processing a block of entries. */ public static void stopWatchingQueue() { + if (s_log.isInfoEnabled()) { + s_log.info("Going to stop queue processing."); + } s_keepWatchingQueue = false; } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java b/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java index 1b0a68e3b..ab8ab81f4 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java @@ -76,13 +76,9 @@ import javax.servlet.ServletException; * separate item selection model is updated. * * @author David Lutterkort - * @version $Revision: #22 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: FolderBrowser.java 1540 2007-03-26 20:44:49Z apevec $ */ public class FolderBrowser extends Table { - public static final String versionId = - "$Id: FolderBrowser.java 1540 2007-03-26 20:44:49Z apevec $" + - "$Author: apevec $" + - "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger(FolderBrowser.class); diff --git a/ccm-core/src/com/arsdigita/kernel/permissions/PermissionManager.java b/ccm-core/src/com/arsdigita/kernel/permissions/PermissionManager.java index 64c9f3b94..1944331ec 100755 --- a/ccm-core/src/com/arsdigita/kernel/permissions/PermissionManager.java +++ b/ccm-core/src/com/arsdigita/kernel/permissions/PermissionManager.java @@ -139,7 +139,7 @@ public class PermissionManager { Filter f = query.addFilter(" exists ( com.arsdigita.kernel.permissions." + queryName + " and RAW[" - + permission.getPrivilegeDescriptor().getColumnName() + " = 1 ])"); + + permission.getPrivilegeDescriptor().getColumnName() + " = '1' ])"); f.set("objectID", permission.getACSObjectOID().get("id")); f.set("partyID", constructAccessList(permission.getPartyOID()));//.get("id")); @@ -541,7 +541,7 @@ public class PermissionManager { Filter f = factory.simple( " exists ( com.arsdigita.kernel.permissions.PartyPermissionFilterQuery" + " and RAW[dogc.pd_object_id] = " + propertyName - + " and RAW[" + privilege.getColumnName() + "] = 1)"); + + " and RAW[" + privilege.getColumnName() + "] = '1')"); f.set("partyID", constructAccessList(partyOID));//partyOID.get("id")); return f; } @@ -557,7 +557,7 @@ public class PermissionManager { Filter f = factory.simple( " exists ( com.arsdigita.kernel.permissions.ObjectPermissionFilterQuery" + " and RAW[dgm.pd_member_id] = " + propertyName - + " and RAW[" + privilege.getColumnName() + "] = 1)"); + + " and RAW[" + privilege.getColumnName() + "] = '1')"); f.set("objectID", objectOID.get("id")); return f; } diff --git a/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java b/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java index 702c96d03..be97fec76 100755 --- a/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java +++ b/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java @@ -34,7 +34,7 @@ import org.apache.log4j.Logger; * by all domain init methods, followed by all legacy init methods. * * @author Rafael H. Schloming <rhs@mit.edu> - * @version $Revision: #6 $ $Date: 2004/08/16 $ + * @version $Id: CompoundInitializer.java 287 2005-02-22 00:29:02Z sskracic $ **/ public class CompoundInitializer implements Initializer { @@ -42,8 +42,6 @@ public class CompoundInitializer implements Initializer { private static final Logger s_log = Logger.getLogger(CompoundInitializer.class); - public final static String versionId = "$Id: CompoundInitializer.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - private Logger m_log; private final List m_inits = new ArrayList(); diff --git a/ccm-core/src/com/arsdigita/runtime/Initializer.java b/ccm-core/src/com/arsdigita/runtime/Initializer.java index 26161393b..a616c5019 100755 --- a/ccm-core/src/com/arsdigita/runtime/Initializer.java +++ b/ccm-core/src/com/arsdigita/runtime/Initializer.java @@ -35,10 +35,6 @@ package com.arsdigita.runtime; * @version $Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $ */ public interface Initializer { - public final static String versionId = - "$Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; /** * Initializes the object-relational mapping metadata by loading diff --git a/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java b/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java index d4e5f3f36..764819619 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java @@ -103,15 +103,20 @@ public class ApplicationFileServlet extends BaseApplicationServlet { private String m_templatePath; private ApplicationFileResolver m_resolver; - public void init(ServletConfig config) + /** + * + * @param config + * @throws ServletException + */ + public void init(ServletConfig config) throws ServletException { super.init(config); m_templatePath = config.getInitParameter("template-path"); Assert.exists(m_templatePath, String.class); - Assert.truth(m_templatePath.startsWith("/"), + Assert.isTrue(m_templatePath.startsWith("/"), "template-path starts with '/'"); - Assert.truth(!m_templatePath.endsWith("/"), + Assert.isTrue(!m_templatePath.endsWith("/"), "template-path does not end with '/'"); diff --git a/ccm-core/src/com/arsdigita/web/BaseServlet.java b/ccm-core/src/com/arsdigita/web/BaseServlet.java index 43b40013c..e131dc5b4 100755 --- a/ccm-core/src/com/arsdigita/web/BaseServlet.java +++ b/ccm-core/src/com/arsdigita/web/BaseServlet.java @@ -60,10 +60,6 @@ import org.apache.log4j.Logger; * @version $Id: BaseServlet.java 738 2005-09-01 12:36:52Z sskracic $ */ public abstract class BaseServlet extends HttpServlet { - public static final String versionId = - "$Id: BaseServlet.java 738 2005-09-01 12:36:52Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static Logger s_log = Logger.getLogger(BaseServlet.class); diff --git a/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java b/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java index 6dc575f07..db338585c 100644 --- a/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java +++ b/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java @@ -17,10 +17,6 @@ * */ -/* - * !!! WORK IN PROGRESS !!! - * NOT READY for prime time yet - */ package com.arsdigita.web; import com.arsdigita.runtime.CCMResourceManager; @@ -33,6 +29,7 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.apache.log4j.Logger; +import org.apache.log4j.LogManager; import org.apache.log4j.PropertyConfigurator; /** @@ -137,7 +134,8 @@ public class CCMApplicationContextListener implements ServletContextListener { // do nothing at the moment - s_log.info("CCM Application shutdown."); + s_log.info("CCM Application shut down."); + LogManager.shutdown(); } } \ No newline at end of file diff --git a/ccm-core/src/com/arsdigita/web/Web.java b/ccm-core/src/com/arsdigita/web/Web.java index 3e4d265a8..3469d0939 100755 --- a/ccm-core/src/com/arsdigita/web/Web.java +++ b/ccm-core/src/com/arsdigita/web/Web.java @@ -42,12 +42,9 @@ import org.apache.log4j.Logger; * * @author Rafael Schloming <rhs@mit.edu> * @author Justin Ross <jross@redhat.com> + * @version $Id: Web.java 738 2005-09-01 12:36:52Z sskracic $ */ public class Web { - public static final String versionId = - "$Id: Web.java 738 2005-09-01 12:36:52Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; public static final String ROOT_WEBAPP = "ROOT"; @@ -137,8 +134,8 @@ public class Web { * @return the servlet context matching uri, or null */ public static final ServletContext getServletContext(String uri) { - Assert.truth(uri.startsWith("/"), "uri must start with /"); - Assert.truth(uri.endsWith("/"), "uri must end with /"); + Assert.isTrue(uri.startsWith("/"), "uri must start with /"); + Assert.isTrue(uri.endsWith("/"), "uri must end with /"); return (ServletContext)s_contexts.get(uri); } @@ -149,7 +146,7 @@ public class Web { static final void registerServletContext(String uri, ServletContext ctx) { s_log.debug("Mapping " + ctx + " to " + uri); - Assert.truth(s_contexts.get(uri) == null, + Assert.isTrue(s_contexts.get(uri) == null, "a context mapping exists at " + uri); s_contexts.put(uri, ctx); } diff --git a/ccm-core/web/packages/bebop/xsl/XinhaEditor.xsl b/ccm-core/web/packages/bebop/xsl/XinhaEditor.xsl index 7bfa834ed..2609c5bf9 100755 --- a/ccm-core/web/packages/bebop/xsl/XinhaEditor.xsl +++ b/ccm-core/web/packages/bebop/xsl/XinhaEditor.xsl @@ -48,7 +48,7 @@ - +