From e1cf71ad56650dd1a13d8ff7c201c255eb979648 Mon Sep 17 00:00:00 2001 From: pb Date: Fri, 15 Feb 2008 18:29:37 +0000 Subject: [PATCH] incoroirating APLAWS patches: r1655 | chrisg23 | 2007-09-18 13:16:54 +0200 (Di, 18 Sep 2007) Sourceforge patch 1793047 - prevent attempt to transform xml if we java code has put an error in the response before generating any xml ------------------------------------------------------------------------ r1656 | chrisg23 | 2007-09-18 14:40:39 +0200 (Di, 18 Sep 2007) Undo change in r1370 - BaseDocument doesn't need to implement comparable as it is implemented in SearchResult (part of ccm-ldn-search) to enable merged results to be sorted ------------------------------------------------------------------------ r1657 | chrisg23 | 2007-09-18 14:43:10 +0200 (Di, 18 Sep 2007) Make the static prepare utility method public ------------------------------------------------------------------------ r1658 | chrisg23 | 2007-09-18 14:46:04 +0200 (Di, 18 Sep 2007) Sourceforge patch 1793018 - utility to get stable urls programatically ------------------------------------------------------------------------ r1659 | chrisg23 | 2007-09-18 14:52:36 +0200 (Di, 18 Sep 2007) Make pdl attribute name constants public so they may be referenced elsewhere in persistence API calls ------------------------------------------------------------------------ r1660 | chrisg23 | 2007-09-18 15:05:43 +0200 (Di, 18 Sep 2007) Sourceforge patch 1793021 - output id attribute on bebop selects if it has been set in the java code ------------------------------------------------------------------------ git-svn-id: https://svn.libreccm.org/ccm/trunk@25 8810af33-2d31-482b-a856-94f89814c4df --- .../arsdigita/bebop/page/PageTransformer.java | 3 + .../com/arsdigita/search/BaseDocument.java | 32 +--------- .../src/com/arsdigita/ui/admin/Utilities.java | 2 +- ccm-core/src/com/arsdigita/web/Util.java | 59 +++++++++++++++++++ .../arsdigita/workflow/simple/UserTask.java | 12 ++-- ccm-core/web/packages/bebop/xsl/Select.xsl | 2 +- 6 files changed, 71 insertions(+), 39 deletions(-) create mode 100644 ccm-core/src/com/arsdigita/web/Util.java diff --git a/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java b/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java index 099d75dd9..7287779ba 100755 --- a/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java +++ b/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java @@ -278,6 +278,9 @@ public class PageTransformer implements PresentationManager { final HttpServletRequest req, final HttpServletResponse resp, final Map params) { + if (resp.isCommitted()) { + return; + } if (Assert.isEnabled()) { Assert.exists(doc, Document.class); Assert.exists(req, HttpServletRequest.class); diff --git a/ccm-core/src/com/arsdigita/search/BaseDocument.java b/ccm-core/src/com/arsdigita/search/BaseDocument.java index 924362ce4..bd652bcf9 100755 --- a/ccm-core/src/com/arsdigita/search/BaseDocument.java +++ b/ccm-core/src/com/arsdigita/search/BaseDocument.java @@ -32,8 +32,6 @@ import java.net.URL; import java.util.Date; import java.util.Locale; -import org.apache.log4j.Logger; - /** * A BaseDocument provides a base implementation of the * Document interface. Query engine implementations should @@ -43,7 +41,7 @@ import org.apache.log4j.Logger; * * @see com.arsdigita.search.Document */ -public class BaseDocument implements Document, Comparable { +public class BaseDocument implements Document { private URL m_url; private OID m_oid; @@ -59,8 +57,6 @@ public class BaseDocument implements Document, Comparable { private BigDecimal m_score; - static Logger s_log = Logger.getLogger(BaseDocument.class); - /** * Creates a new document; * @@ -308,30 +304,4 @@ public class BaseDocument implements Document, Comparable { return m_contentSection; } - /** - * Implements Comparable interface to allow ordering of search results - * by score descending where database ordering is not used - * (e.g. merged remote searches). - * - * @param obj - * @return int - * @throws java.lang.NullPointerException - * @throws java.lang.ClassCastException - */ - public int compareTo(Object obj) { - if (obj == null) { - throw new NullPointerException(); - } - - BaseDocument otherDocument = (BaseDocument) obj; - - s_log.debug("This score: " + getScore() + ", other score: " - + otherDocument.getScore() + ", result: " - + otherDocument.getScore().compareTo(getScore()) - + " (old result: " - + getScore().compareTo(otherDocument.getScore()) + ")"); - - - return otherDocument.getScore().compareTo(getScore()); - } } diff --git a/ccm-core/src/com/arsdigita/ui/admin/Utilities.java b/ccm-core/src/com/arsdigita/ui/admin/Utilities.java index 5a10a8046..d849628a2 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/Utilities.java +++ b/ccm-core/src/com/arsdigita/ui/admin/Utilities.java @@ -44,7 +44,7 @@ final class Utilities { * more general */ - static final String prepare(String input) { + public static final String prepare(String input) { Perl5Compiler compiler = new Perl5Compiler(); Perl5Matcher matcher = new Perl5Matcher(); diff --git a/ccm-core/src/com/arsdigita/web/Util.java b/ccm-core/src/com/arsdigita/web/Util.java new file mode 100644 index 000000000..6a27fb3de --- /dev/null +++ b/ccm-core/src/com/arsdigita/web/Util.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007 Chris Gilbert. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.web; + +import com.arsdigita.domain.DomainObject; +import com.arsdigita.util.Assert; + +public class Util { + + /** + * retrieve a fully qualified stable url for the specified + * domain object without any context + * + * Full qualification is required in order to avoid getting + * redirect urls within the context of ccm + */ + public static String getRedirectURL(DomainObject object) { + return getRedirectURL(object,null); + } + + + /** + * retrieve a fully qualified stable url for the specified + * domain object in the given context + * + * Full qualification is required in order to avoid getting + * redirect urls within the context of ccm + */ + public static String getRedirectURL(DomainObject object, String context) { + Assert.exists(object); + + ParameterMap params = new ParameterMap(); + params.setParameter("oid", object.getOID()); + if (context != null) { + params.setParameter("context", context); + } + URL url = URL.there("/redirect", params); + + return url.getServerURI() + url.getPathInfo() + "?" + url.getQueryString(); + + } + +} diff --git a/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java b/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java index 9caf400ed..7ca5084a9 100755 --- a/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java +++ b/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java @@ -73,12 +73,12 @@ public class UserTask extends Task implements Assignable { public static final String ASSIGNED_USERS = "assignedUsers"; public static final String ASSIGNED_GROUPS = "assignedGroups"; - private static final String LOCKING_USER_ID = "lockingUserId"; - private static final String IS_LOCKED = "isLocked"; - private static final String DUE_DATE = "dueDate"; - private static final String START_DATE = "startDate"; - private static final String DURATION_MINUTES = "durationMinutes"; - private static final String NOTIFICATION_SENDER_ID = "notificationSenderID"; + public static final String LOCKING_USER_ID = "lockingUserId"; + public static final String IS_LOCKED = "isLocked"; + public static final String DUE_DATE = "dueDate"; + public static final String START_DATE = "startDate"; + public static final String DURATION_MINUTES = "durationMinutes"; + public static final String NOTIFICATION_SENDER_ID = "notificationSenderID"; public static final int DEFAULT_DURATION = 1440; diff --git a/ccm-core/web/packages/bebop/xsl/Select.xsl b/ccm-core/web/packages/bebop/xsl/Select.xsl index 7db5e7603..1faef4d9e 100755 --- a/ccm-core/web/packages/bebop/xsl/Select.xsl +++ b/ccm-core/web/packages/bebop/xsl/Select.xsl @@ -35,7 +35,7 @@