You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(48) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(22) |
Feb
(68) |
Mar
(185) |
Apr
(11) |
May
(21) |
Jun
(23) |
Jul
(46) |
Aug
(69) |
Sep
(211) |
Oct
(26) |
Nov
(51) |
Dec
(52) |
2006 |
Jan
(13) |
Feb
(13) |
Mar
(8) |
Apr
(21) |
May
(17) |
Jun
(100) |
Jul
(34) |
Aug
(23) |
Sep
(26) |
Oct
(16) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(66) |
Oct
(10) |
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(8) |
Jun
(5) |
Jul
(31) |
Aug
(8) |
Sep
(11) |
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
(13) |
Feb
(2) |
Mar
(9) |
Apr
(6) |
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(120) |
2013 |
Jan
(6) |
Feb
(35) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ap...@vh...> - 2006-08-25 18:06:53
|
Author: apevec Date: 2006-08-25 19:59:39 +0200 (Fri, 25 Aug 2006) New Revision: 1292 Modified: trunk/ccm-core/src/com/arsdigita/categorization/Category.java Log: add getPreferredQualifiedName which resolves the synonym to their preferred category Modified: trunk/ccm-core/src/com/arsdigita/categorization/Category.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/categorization/Category.java 2006-08-25 17:57:34 UTC (rev 1291) +++ trunk/ccm-core/src/com/arsdigita/categorization/Category.java 2006-08-25 17:59:39 UTC (rev 1292) @@ -332,8 +332,8 @@ } setEnabled(true); setAbstract(false); - //by default do not ignore the parent index item - setIgnoreParentIndexItem(false); + //by default do not ignore the parent index item + setIgnoreParentIndexItem(false); } m_hierarchy = new HierarchyDenormalization @@ -368,7 +368,7 @@ * Events". </p> * * @see #getDefaultAscendants() - * @param delimeter The string to use to seperate the parents from the + * @param delimiter The string to use to seperate the parents from the * children. For example, to obtain the above-mentioned result, you need to * pass in <code>" >> "</code> as the delimiter. * @@ -379,7 +379,7 @@ * <code>null</code> this is the root category, and <code>includeRoot</code> * is false. */ - public String getQualifiedName(String delimeter, boolean includeRoot) { + public String getQualifiedName(String delimiter, boolean includeRoot) { // If the collection only contains the root and the root is not desired // then we return null if (!includeRoot && getDefaultAscendants().size() < 2) { @@ -399,21 +399,43 @@ names.add(ancestors.getCategory().getName()); } - return StringUtils.join(names, delimeter); + return StringUtils.join(names, delimiter); } /** - * Returns the url of the category along with its default ancestors + * Returns the name of the <b>preferred</b> category along with its default ancestors. + * Equivalent to #getQualifiedName(String,boolean) if this Category is not a synonym. + * Synonym name is appended in parentheses. + * + * @param delimiter string to separate category names + * @param includeRoot should root category be shown + * @return category path + */ + public String getPreferredQualifiedName(String delimiter, boolean includeRoot) { + // is this a synonym? + CategoryCollection cc = new CategoryCollection (getRelatedCategories(PREFERRED)); + if (cc.next()) { + Category preferred = cc.getCategory(); + cc.close(); + String preferredPath = preferred.getQualifiedName(delimiter, includeRoot); + return preferredPath + " (" + getName() + ")"; + } else { + return getQualifiedName(delimiter, includeRoot); + } + } + + /** + * Returns the url of the category along with its default ancestors * * @see #getDefaultAscendants() * - * @param delimeter The string to use to seperate the parents from + * @param delimiter The string to use to seperate the parents from * the children. * @param includeRoot This indicates whether or not the root category should * be included in the URL. */ - public String getQualifiedURL(String delimeter, boolean includeRoot) { + public String getQualifiedURL(String delimiter, boolean includeRoot) { // If the collection only contains the root and the root is not desired // then we return null if (!includeRoot && getDefaultAscendants().size() < 2) { @@ -432,7 +454,7 @@ names.add(ancestors.getCategory().getURL()); } - return StringUtils.join(names, delimeter); + return StringUtils.join(names, delimiter); } /** @@ -535,7 +557,7 @@ * <code>false</code> otherwise. */ public boolean ignoreParentIndexItem(){ - return ((Boolean) get(IGNORE_PARENT_INDEX_ITEM)).booleanValue(); + return ((Boolean) get(IGNORE_PARENT_INDEX_ITEM)).booleanValue(); } /** @@ -546,7 +568,7 @@ * <code>false</code> otherwise */ public void setIgnoreParentIndexItem(boolean ignoreParentIndexItem){ - set(IGNORE_PARENT_INDEX_ITEM, new Boolean(ignoreParentIndexItem)); + set(IGNORE_PARENT_INDEX_ITEM, new Boolean(ignoreParentIndexItem)); } @@ -1005,17 +1027,17 @@ ACSObject item = getDirectIndexObject(); if (item == null) { - if(!ignoreParentIndexItem()){ - try { - item = getDefaultParentCategory().getIndexObject(); - } catch (CategoryNotFoundException ex) { - // this will rarely happen and when it does we just want to - // return null which is done below. it would be much nicer if - // the Categorization API just returned null instead of throwing - // the exception - s_log.debug("not found", ex); + if (!ignoreParentIndexItem()) { + try { + item = getDefaultParentCategory().getIndexObject(); + } catch (CategoryNotFoundException ex) { + // this will rarely happen and when it does we just want to + // return null which is done below. it would be much nicer if + // the Categorization API just returned null instead of throwing + // the exception + s_log.debug("not found", ex); + } } - } } return item; @@ -1407,10 +1429,11 @@ * filter, if desired. * * @param relation The type of relation to retrieve. - * @pre relation == Category.CHILD || relation == Category.RELATED + * @pre relation == Category.CHILD || relation == Category.RELATED || relation == Category.PREFERRED */ public DataAssociationCursor getRelatedCategories(String relation) { - Assert.truth(relation.equals(CHILD) || relation.equals(RELATED), + Assert.truth(relation.equals(CHILD) || relation.equals(RELATED) + || relation.equals(PREFERRED), " invalid relation {" + relation + "}"); DataAssociationCursor cursor = ((DataAssociation) get(RELATED_CATEGORIES)).cursor(); |
From: <ap...@vh...> - 2006-08-25 18:05:45
|
Author: apevec Date: 2006-08-25 19:57:34 +0200 (Fri, 25 Aug 2006) New Revision: 1291 Modified: trunk/ccm-ldn-atoz/web/__ccm__/apps/atoz/xsl/index.xsl Log: removing dos CRLF Modified: trunk/ccm-ldn-atoz/web/__ccm__/apps/atoz/xsl/index.xsl =================================================================== --- trunk/ccm-ldn-atoz/web/__ccm__/apps/atoz/xsl/index.xsl 2006-08-25 17:55:03 UTC (rev 1290) +++ trunk/ccm-ldn-atoz/web/__ccm__/apps/atoz/xsl/index.xsl 2006-08-25 17:57:34 UTC (rev 1291) @@ -1,329 +1,329 @@ -<?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:bebop="http://www.arsdigita.com/bebop/1.0" - xmlns:atoz="http://xmlns.redhat.com/atoz/1.0" - version="1.0"> - - <xsl:import href="../../../../../ROOT/packages/bebop/xsl/bebop.xsl"/> - <xsl:import href="../../../../../ROOT/packages/ui/xsl/ui.xsl"/> - - <xsl:output method="html"/> - - <xsl:template name="bebop:pageCSS"> - <xsl:call-template name="bebop:pageCSSMain"/> - <xsl:call-template name="atoz:pageCSSMain"/> - </xsl:template> - - - <xsl:template name="atoz:pageCSSMain"> - <link href="/__ccm__/static/atoz/atoz.css" rel="stylesheet" type="text/css"/> - </xsl:template> - - <xsl:template match="atoz:atoz"> - <table class="data"> - <thead> - <tr> - <xsl:for-each select="atoz:letter"> - <th><a href="?letter={text()}"><xsl:value-of select="."/></a></th> - </xsl:for-each> - </tr> - </thead> - </table> - - <xsl:apply-templates select="atoz:provider"/> - </xsl:template> - - <xsl:template match="atoz:provider"> - <table class="data"> - <thead> - <tr> - <th title="{@description}"><xsl:value-of select="@title"/></th> - </tr> - </thead> - <tbody> - <xsl:for-each select="atoz:atomicEntry"> - <xsl:variable name="class"> - <xsl:choose> - <xsl:when test="position() mod 2"> - <xsl:text>odd</xsl:text> - </xsl:when> - <xsl:otherwise> - <xsl:text>even</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <tr class="{$class}"> - <td> - <a title="{@description}" href="{@url}"><xsl:value-of select="@title"/></a> - </td> - </tr> - </xsl:for-each> - </tbody> - <xsl:for-each select="atoz:compoundEntry"> - <thead> - <tr> - <th> - <xsl:value-of select="@title"/> - <br/> - <xsl:value-of select="@description"/> - </th> - </tr> - </thead> - <tbody> - <xsl:for-each select="atoz:atomicEntry"> - <xsl:variable name="class"> - <xsl:choose> - <xsl:when test="position() mod 2"> - <xsl:text>odd</xsl:text> - </xsl:when> - <xsl:otherwise> - <xsl:text>even</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <tr class="{$class}"> - <td> - <a href="{@url}"><xsl:value-of select="@title"/></a> - <br/> - <xsl:value-of select="@description"/> - </td> - </tr> - </xsl:for-each> - </tbody> - </xsl:for-each> - </table> - </xsl:template> - - <xsl:template match="atoz:adminPane"> - <div> - <xsl:apply-templates select="*"/> - </div> - </xsl:template> - - <xsl:template match="atoz:providerList"> - <h3>Provider List</h3> - <table class="data"> - <tr> - <th>Title</th> - <th>Description</th> - <th colspan="2">Actions</th> - </tr> - <xsl:if test="count(atoz:provider) = 0"> - <tr> - <td colspan="4"><em>No providers have been added yet</em></td> - </tr> - </xsl:if> - <xsl:for-each select="atoz:provider"> - <xsl:variable name="class"> - <xsl:choose> - <xsl:when test="position() mod 2"> - <xsl:text>odd</xsl:text> - </xsl:when> - <xsl:otherwise> - <xsl:text>even</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <tr class="{$class}"> - <td><xsl:value-of select="title"/></td> - <td><xsl:value-of select="description"/></td> - <td> - <xsl:call-template name="atoz:link"> - <xsl:with-param name="url" select="@editURL"/> - <xsl:with-param name="body" select="'Edit'"/> - </xsl:call-template> - </td> - <td> - <xsl:call-template name="atoz:link"> - <xsl:with-param name="url" select="@deleteURL"/> - <xsl:with-param name="body" select="'Delete'"/> - <xsl:with-param name="type" select="'delete'"/> - </xsl:call-template> - </td> - </tr> - </xsl:for-each> - </table> - </xsl:template> - - <xsl:template match="bebop:form[@name='providerCreate']"> - <form action="{@action}" name="{@name}"> - <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> - <xsl:apply-templates select="bebop:pageState"/> - <table class="property"> - <tr class="even"> - <th>Add a</th> - <td> - <xsl:apply-templates select="bebop:select[@name='providers']"/> - <xsl:apply-templates select="bebop:formErrors[@id='providers']"/> - </td> - <td><xsl:apply-templates select="bebop:formWidget[@name='create']"/></td> - </tr> - </table> - </form> - </xsl:template> - - <xsl:template match="bebop:form"> - <form action="{@action}" name="{@name}"> - <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> - <xsl:apply-templates select="bebop:pageState"/> - <table class="property"> - <thead> - <tr> - <th colspan="2"><xsl:value-of select="@metadata.title"/></th> - </tr> - </thead> - <tbody> - <xsl:for-each select="*[not(name() = 'bebop:pageState') and not(name() = 'bebop:formWidget' and (@type = 'hidden' or @type = 'submit')) and not(name() = 'bebop:formErrors')]"> - <xsl:variable name="class"> - <xsl:choose> - <xsl:when test="position() mod 2 = 0"> - <xsl:text>odd</xsl:text> - </xsl:when> - <xsl:otherwise> - <xsl:text>even</xsl:text> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <tr class="{$class}"> - <th><xsl:value-of select="@metadata.label"/></th> - <td> - <xsl:variable name="key"> - <xsl:value-of select="@name"/> - </xsl:variable> - <xsl:apply-templates select="."/> - <xsl:apply-templates select="../bebop:formErrors[@id=$key]"/> - </td> - </tr> - </xsl:for-each> - </tbody> - <tfoot> - <tr> - <td colspan="2"> - <xsl:apply-templates select="bebop:formWidget[@type='submit']"/> - </td> - </tr> - </tfoot> - </table> - </form> - </xsl:template> - - <xsl:template match="bebop:form" mode="atoz:categoryAliasForm"> - <form action="{@action}" name="{@name}"> - <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> - <xsl:apply-templates select="bebop:pageState"/> - <table class="property"> - <thead> - <tr> - <th colspan="2">Add category alias</th> - </tr> - </thead> - <tbody> - <tr class="odd"> - <th>Title:</th> - <td> - <xsl:apply-templates select="bebop:formWidget[@name='title']"/> - <xsl:apply-templates select="bebop:formErrors[@id='title']"/> - </td> - </tr> - <tr class="even"> - <th>Letter:</th> - <td> - <xsl:apply-templates select="bebop:select[@name='letter']"/> - <xsl:apply-templates select="bebop:formErrors[@id='letter']"/> - </td> - </tr> - <tr class="odd"> - <th>Category:</th> - <td> - <xsl:apply-templates select="bebop:select[@name='category']"/> - <xsl:apply-templates select="bebop:formErrors[@id='category']"/> - </td> - </tr> - </tbody> - <tfoot> - <tr class="odd"> - <td></td> - <td><xsl:apply-templates select="bebop:formWidget[@type='submit']"/></td> - </tr> - </tfoot> - </table> - </form> - </xsl:template> - - <xsl:template match="bebop:form" mode="atoz:itemAliasForm"> - <form action="{@action}" name="{@name}"> - <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> - <xsl:apply-templates select="bebop:pageState"/> - <table class="property"> - <thead> - <tr> - <th colspan="2">Add item alias</th> - </tr> - </thead> - <tbody> - <tr class="odd"> - <th>Title:</th> - <td> - <xsl:apply-templates select="bebop:formWidget[@name='title']"/> - <xsl:apply-templates select="bebop:formErrors[@id='title']"/> - </td> - </tr> - <tr class="even"> - <th>Letter:</th> - <td> - <xsl:apply-templates select="bebop:select[@name='letter']"/> - <xsl:apply-templates select="bebop:formErrors[@id='letter']"/> - </td> - </tr> - <tr class="odd"> - <th>Item:</th> - <td> - <xsl:apply-templates select="bebop:select[@name='item']"/> - <xsl:apply-templates select="bebop:formErrors[@id='item']"/> - </td> - </tr> - </tbody> - <tfoot> - <tr class="odd"> - <td></td> - <td><xsl:apply-templates select="bebop:formWidget[@type='submit']"/></td> - </tr> - </tfoot> - </table> - </form> - </xsl:template> - - <xsl:template match="bebop:form" mode="atoz:categoryBlockForm"> - <form action="{@action}" name="{@name}"> - <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> - <xsl:apply-templates select="bebop:pageState"/> - <table class="property"> - <thead> - <tr> - <th colspan="2">Block category</th> - </tr> - </thead> - <tbody> - <tr class="odd"> - <th>Category:</th> - <td> - <xsl:apply-templates select="bebop:select[@name='category']"/> - <xsl:apply-templates select="bebop:formErrors[@id='category']"/> - </td> - </tr> - </tbody> - <tfoot> - <tr class="odd"> - <td></td> - <td><xsl:apply-templates select="bebop:formWidget[@type='submit']"/></td> - </tr> - </tfoot> - </table> - </form> - </xsl:template> - +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:bebop="http://www.arsdigita.com/bebop/1.0" + xmlns:atoz="http://xmlns.redhat.com/atoz/1.0" + version="1.0"> + <xsl:import href="../../../../../ROOT/packages/bebop/xsl/bebop.xsl"/> + <xsl:import href="../../../../../ROOT/packages/ui/xsl/ui.xsl"/> + + <xsl:output method="html"/> + + <xsl:template name="bebop:pageCSS"> + <xsl:call-template name="bebop:pageCSSMain"/> + <xsl:call-template name="atoz:pageCSSMain"/> + </xsl:template> + + + <xsl:template name="atoz:pageCSSMain"> + <link href="/__ccm__/static/atoz/atoz.css" rel="stylesheet" type="text/css"/> + </xsl:template> + + <xsl:template match="atoz:atoz"> + <table class="data"> + <thead> + <tr> + <xsl:for-each select="atoz:letter"> + <th><a href="?letter={text()}"><xsl:value-of select="."/></a></th> + </xsl:for-each> + </tr> + </thead> + </table> + + <xsl:apply-templates select="atoz:provider"/> + </xsl:template> + + <xsl:template match="atoz:provider"> + <table class="data"> + <thead> + <tr> + <th title="{@description}"><xsl:value-of select="@title"/></th> + </tr> + </thead> + <tbody> + <xsl:for-each select="atoz:atomicEntry"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>odd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>even</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <tr class="{$class}"> + <td> + <a title="{@description}" href="{@url}"><xsl:value-of select="@title"/></a> + </td> + </tr> + </xsl:for-each> + </tbody> + <xsl:for-each select="atoz:compoundEntry"> + <thead> + <tr> + <th> + <xsl:value-of select="@title"/> + <br/> + <xsl:value-of select="@description"/> + </th> + </tr> + </thead> + <tbody> + <xsl:for-each select="atoz:atomicEntry"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>odd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>even</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <tr class="{$class}"> + <td> + <a href="{@url}"><xsl:value-of select="@title"/></a> + <br/> + <xsl:value-of select="@description"/> + </td> + </tr> + </xsl:for-each> + </tbody> + </xsl:for-each> + </table> + </xsl:template> + + <xsl:template match="atoz:adminPane"> + <div> + <xsl:apply-templates select="*"/> + </div> + </xsl:template> + + <xsl:template match="atoz:providerList"> + <h3>Provider List</h3> + <table class="data"> + <tr> + <th>Title</th> + <th>Description</th> + <th colspan="2">Actions</th> + </tr> + <xsl:if test="count(atoz:provider) = 0"> + <tr> + <td colspan="4"><em>No providers have been added yet</em></td> + </tr> + </xsl:if> + <xsl:for-each select="atoz:provider"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>odd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>even</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <tr class="{$class}"> + <td><xsl:value-of select="title"/></td> + <td><xsl:value-of select="description"/></td> + <td> + <xsl:call-template name="atoz:link"> + <xsl:with-param name="url" select="@editURL"/> + <xsl:with-param name="body" select="'Edit'"/> + </xsl:call-template> + </td> + <td> + <xsl:call-template name="atoz:link"> + <xsl:with-param name="url" select="@deleteURL"/> + <xsl:with-param name="body" select="'Delete'"/> + <xsl:with-param name="type" select="'delete'"/> + </xsl:call-template> + </td> + </tr> + </xsl:for-each> + </table> + </xsl:template> + + <xsl:template match="bebop:form[@name='providerCreate']"> + <form action="{@action}" name="{@name}"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> + <xsl:apply-templates select="bebop:pageState"/> + <table class="property"> + <tr class="even"> + <th>Add a</th> + <td> + <xsl:apply-templates select="bebop:select[@name='providers']"/> + <xsl:apply-templates select="bebop:formErrors[@id='providers']"/> + </td> + <td><xsl:apply-templates select="bebop:formWidget[@name='create']"/></td> + </tr> + </table> + </form> + </xsl:template> + + <xsl:template match="bebop:form"> + <form action="{@action}" name="{@name}"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> + <xsl:apply-templates select="bebop:pageState"/> + <table class="property"> + <thead> + <tr> + <th colspan="2"><xsl:value-of select="@metadata.title"/></th> + </tr> + </thead> + <tbody> + <xsl:for-each select="*[not(name() = 'bebop:pageState') and not(name() = 'bebop:formWidget' and (@type = 'hidden' or @type = 'submit')) and not(name() = 'bebop:formErrors')]"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2 = 0"> + <xsl:text>odd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>even</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <tr class="{$class}"> + <th><xsl:value-of select="@metadata.label"/></th> + <td> + <xsl:variable name="key"> + <xsl:value-of select="@name"/> + </xsl:variable> + <xsl:apply-templates select="."/> + <xsl:apply-templates select="../bebop:formErrors[@id=$key]"/> + </td> + </tr> + </xsl:for-each> + </tbody> + <tfoot> + <tr> + <td colspan="2"> + <xsl:apply-templates select="bebop:formWidget[@type='submit']"/> + </td> + </tr> + </tfoot> + </table> + </form> + </xsl:template> + + <xsl:template match="bebop:form" mode="atoz:categoryAliasForm"> + <form action="{@action}" name="{@name}"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> + <xsl:apply-templates select="bebop:pageState"/> + <table class="property"> + <thead> + <tr> + <th colspan="2">Add category alias</th> + </tr> + </thead> + <tbody> + <tr class="odd"> + <th>Title:</th> + <td> + <xsl:apply-templates select="bebop:formWidget[@name='title']"/> + <xsl:apply-templates select="bebop:formErrors[@id='title']"/> + </td> + </tr> + <tr class="even"> + <th>Letter:</th> + <td> + <xsl:apply-templates select="bebop:select[@name='letter']"/> + <xsl:apply-templates select="bebop:formErrors[@id='letter']"/> + </td> + </tr> + <tr class="odd"> + <th>Category:</th> + <td> + <xsl:apply-templates select="bebop:select[@name='category']"/> + <xsl:apply-templates select="bebop:formErrors[@id='category']"/> + </td> + </tr> + </tbody> + <tfoot> + <tr class="odd"> + <td></td> + <td><xsl:apply-templates select="bebop:formWidget[@type='submit']"/></td> + </tr> + </tfoot> + </table> + </form> + </xsl:template> + + <xsl:template match="bebop:form" mode="atoz:itemAliasForm"> + <form action="{@action}" name="{@name}"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> + <xsl:apply-templates select="bebop:pageState"/> + <table class="property"> + <thead> + <tr> + <th colspan="2">Add item alias</th> + </tr> + </thead> + <tbody> + <tr class="odd"> + <th>Title:</th> + <td> + <xsl:apply-templates select="bebop:formWidget[@name='title']"/> + <xsl:apply-templates select="bebop:formErrors[@id='title']"/> + </td> + </tr> + <tr class="even"> + <th>Letter:</th> + <td> + <xsl:apply-templates select="bebop:select[@name='letter']"/> + <xsl:apply-templates select="bebop:formErrors[@id='letter']"/> + </td> + </tr> + <tr class="odd"> + <th>Item:</th> + <td> + <xsl:apply-templates select="bebop:select[@name='item']"/> + <xsl:apply-templates select="bebop:formErrors[@id='item']"/> + </td> + </tr> + </tbody> + <tfoot> + <tr class="odd"> + <td></td> + <td><xsl:apply-templates select="bebop:formWidget[@type='submit']"/></td> + </tr> + </tfoot> + </table> + </form> + </xsl:template> + + <xsl:template match="bebop:form" mode="atoz:categoryBlockForm"> + <form action="{@action}" name="{@name}"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> + <xsl:apply-templates select="bebop:pageState"/> + <table class="property"> + <thead> + <tr> + <th colspan="2">Block category</th> + </tr> + </thead> + <tbody> + <tr class="odd"> + <th>Category:</th> + <td> + <xsl:apply-templates select="bebop:select[@name='category']"/> + <xsl:apply-templates select="bebop:formErrors[@id='category']"/> + </td> + </tr> + </tbody> + <tfoot> + <tr class="odd"> + <td></td> + <td><xsl:apply-templates select="bebop:formWidget[@type='submit']"/></td> + </tr> + </tfoot> + </table> + </form> + </xsl:template> + + <xsl:template match="bebop:form" mode="atoz:contentTypeBlockForm"> <form action="{@action}" name="{@name}"> <xsl:apply-templates select="bebop:formWidget[@type='hidden']"/> @@ -353,62 +353,62 @@ </form> </xsl:template> - <xsl:template match="atoz:categoryProviderAdmin"> - <xsl:apply-templates select="bebop:link[@id='return']"/> - - <xsl:apply-templates select="atoz:providerDetails"/> - <xsl:apply-templates select="bebop:form[@name='categoryProvider']"/> - <xsl:apply-templates select="bebop:form[@name='itemProvider']"/> - <xsl:apply-templates select="bebop:link[@id='edit']"/> - - <xsl:apply-templates select="atoz:itemProviderAliasList"/> - <xsl:apply-templates select="bebop:form[@name='itemAliasForm']" mode="atoz:itemAliasForm"/> - - <xsl:apply-templates select="atoz:categoryProviderAliasList"/> - <xsl:apply-templates select="bebop:form[@name='categoryAliasForm']" mode="atoz:categoryAliasForm"/> - - <xsl:apply-templates select="bebop:link[@id='addAlias']"/> - - <xsl:apply-templates select="atoz:categoryProviderBlackList"/> - <xsl:apply-templates select="bebop:form[@name='categoryBlockForm']" mode="atoz:categoryBlockForm"/> - <xsl:apply-templates select="bebop:link[@id='addBlock']"/> + <xsl:template match="atoz:categoryProviderAdmin"> + <xsl:apply-templates select="bebop:link[@id='return']"/> + <xsl:apply-templates select="atoz:providerDetails"/> + <xsl:apply-templates select="bebop:form[@name='categoryProvider']"/> + <xsl:apply-templates select="bebop:form[@name='itemProvider']"/> + <xsl:apply-templates select="bebop:link[@id='edit']"/> + + <xsl:apply-templates select="atoz:itemProviderAliasList"/> + <xsl:apply-templates select="bebop:form[@name='itemAliasForm']" mode="atoz:itemAliasForm"/> + + <xsl:apply-templates select="atoz:categoryProviderAliasList"/> + <xsl:apply-templates select="bebop:form[@name='categoryAliasForm']" mode="atoz:categoryAliasForm"/> + + <xsl:apply-templates select="bebop:link[@id='addAlias']"/> + + <xsl:apply-templates select="atoz:categoryProviderBlackList"/> + <xsl:apply-templates select="bebop:form[@name='categoryBlockForm']" mode="atoz:categoryBlockForm"/> + <xsl:apply-templates select="bebop:link[@id='addBlock']"/> + <xsl:apply-templates select="atoz:categoryProviderContentTypeBlackList"/> <xsl:apply-templates select="bebop:form[@name='contentTypeBlockForm']" mode="atoz:contentTypeBlockForm"/> <xsl:apply-templates select="bebop:link[@id='addContentTypeBlock']"/> - </xsl:template> - - <xsl:template match="atoz:categoryProviderBlackList"> - <h3>Black List</h3> - - <table class="data"> - <thead> - <tr> - <th>Category</th> - <th>Action</th> - </tr> - </thead> - <tbody> - - <xsl:if test="count(atoz:categoryProviderBlock) = 0"> - <tr><td colspan="2"><em>There are no blocked categories</em></td></tr> - </xsl:if> - <xsl:for-each select="atoz:categoryProviderBlock"> - <tr> - <td><xsl:value-of select="name"/></td> - <td> - <xsl:call-template name="atoz:link"> - <xsl:with-param name="url" select="@deleteURL"/> - <xsl:with-param name="body" select="'Delete'"/> - <xsl:with-param name="type" select="'delete'"/> - </xsl:call-template> - </td> - </tr> - </xsl:for-each> - </tbody> - </table> - </xsl:template> + </xsl:template> + <xsl:template match="atoz:categoryProviderBlackList"> + <h3>Black List</h3> + + <table class="data"> + <thead> + <tr> + <th>Category</th> + <th>Action</th> + </tr> + </thead> + <tbody> + + <xsl:if test="count(atoz:categoryProviderBlock) = 0"> + <tr><td colspan="2"><em>There are no blocked categories</em></td></tr> + </xsl:if> + <xsl:for-each select="atoz:categoryProviderBlock"> + <tr> + <td><xsl:value-of select="name"/></td> + <td> + <xsl:call-template name="atoz:link"> + <xsl:with-param name="url" select="@deleteURL"/> + <xsl:with-param name="body" select="'Delete'"/> + <xsl:with-param name="type" select="'delete'"/> + </xsl:call-template> + </td> + </tr> + </xsl:for-each> + </tbody> + </table> + </xsl:template> + <xsl:template match="atoz:categoryProviderContentTypeBlackList"> <h3>Content Types - Black List</h3> @@ -439,125 +439,125 @@ </tbody> </table> </xsl:template> - - <xsl:template match="atoz:categoryProviderAliasList"> - <h3>Category Aliases</h3> - - <table class="data"> - <thead> - <tr> - <th>Category</th> - <th>Letter</th> - <th>Alias</th> - <th>Action</th> - </tr> - </thead> - <tbody> - - <xsl:if test="count(atoz:categoryProviderAlias) = 0"> - <tr><td colspan="4"><em>There are no category aliases</em></td></tr> - </xsl:if> - <xsl:for-each select="atoz:categoryProviderAlias"> - <tr> - <td><xsl:value-of select="name"/></td> - <td><xsl:value-of select="@letter"/></td> - <td><xsl:value-of select="@title"/></td> - <td> - <xsl:call-template name="atoz:link"> - <xsl:with-param name="url" select="@deleteURL"/> - <xsl:with-param name="body" select="'Delete'"/> - <xsl:with-param name="type" select="'delete'"/> - </xsl:call-template> - </td> - </tr> - </xsl:for-each> - </tbody> - </table> - </xsl:template> - - <xsl:template match="atoz:itemProviderAliasList"> - <h3>Item Aliases</h3> - - <table class="data"> - <thead> - <tr> - <th>Item</th> - <th>Letter</th> - <th>Alias</th> - <th>Action</th> - </tr> - </thead> - <tbody> - - <xsl:if test="count(atoz:itemProviderAlias) = 0"> - <tr><td colspan="4"><em>There are no item aliases</em></td></tr> - </xsl:if> - <xsl:for-each select="atoz:itemProviderAlias"> - <tr> - <td><xsl:value-of select="@itemName"/></td> - <td><xsl:value-of select="@letter"/></td> - <td><xsl:value-of select="@title"/></td> - <td> - <xsl:call-template name="atoz:link"> - <xsl:with-param name="url" select="@deleteURL"/> - <xsl:with-param name="body" select="'Delete'"/> - <xsl:with-param name="type" select="'delete'"/> - </xsl:call-template> - </td> - </tr> - </xsl:for-each> - </tbody> - </table> - </xsl:template> - - <xsl:template match="atoz:providerDetails"> - <xsl:choose> - <xsl:when test="objectType = 'com.arsdigita.london.atoz.AtoZCategoryProvider'"> - <table class="property"> - <thead> - <th colspan="2">Category Provider Details</th> - </thead> - <tr class="odd"> - <th>Title:</th> - <td><xsl:value-of select="title"/></td> - </tr> - <tr class="even"> - <th>Description:</th> - <td><xsl:value-of select="description"/></td> - </tr> - <tr class="odd"> - <th>Show items:</th> - <td><xsl:value-of select="isCompound"/></td> - </tr> - <tr class="even"> - <th>Root category:</th> - <td><xsl:value-of select="rootUseContext/rootCategory/name"/></td> - </tr> - </table> - </xsl:when> - <xsl:when test="objectType = 'com.arsdigita.london.atoz.AtoZItemProvider'"> - <table class="property"> - <thead> - <th colspan="2">Item Provider Details</th> - </thead> - <tr class="odd"> - <th>Title:</th> - <td><xsl:value-of select="title"/></td> - </tr> - <tr class="even"> - <th>Description:</th> - <td><xsl:value-of select="description"/></td> - </tr> - <tr class="odd"> - <th>Attributes to retrieve:</th> - <td><xsl:value-of select="loadPaths"/></td> - </tr> - <tr class="even"> - <th>Category filter:</th> - <td><xsl:value-of select="category/name"/></td> - </tr> - </table> - </xsl:when> + + <xsl:template match="atoz:categoryProviderAliasList"> + <h3>Category Aliases</h3> + + <table class="data"> + <thead> + <tr> + <th>Category</th> + <th>Letter</th> + <th>Alias</th> + <th>Action</th> + </tr> + </thead> + <tbody> + + <xsl:if test="count(atoz:categoryProviderAlias) = 0"> + <tr><td colspan="4"><em>There are no category aliases</em></td></tr> + </xsl:if> + <xsl:for-each select="atoz:categoryProviderAlias"> + <tr> + <td><xsl:value-of select="name"/></td> + <td><xsl:value-of select="@letter"/></td> + <td><xsl:value-of select="@title"/></td> + <td> + <xsl:call-template name="atoz:link"> + <xsl:with-param name="url" select="@deleteURL"/> + <xsl:with-param name="body" select="'Delete'"/> + <xsl:with-param name="type" select="'delete'"/> + </xsl:call-template> + </td> + </tr> + </xsl:for-each> + </tbody> + </table> + </xsl:template> + + <xsl:template match="atoz:itemProviderAliasList"> + <h3>Item Aliases</h3> + + <table class="data"> + <thead> + <tr> + <th>Item</th> + <th>Letter</th> + <th>Alias</th> + <th>Action</th> + </tr> + </thead> + <tbody> + + <xsl:if test="count(atoz:itemProviderAlias) = 0"> + <tr><td colspan="4"><em>There are no item aliases</em></td></tr> + </xsl:if> + <xsl:for-each select="atoz:itemProviderAlias"> + <tr> + <td><xsl:value-of select="@itemName"/></td> + <td><xsl:value-of select="@letter"/></td> + <td><xsl:value-of select="@title"/></td> + <td> + <xsl:call-template name="atoz:link"> + <xsl:with-param name="url" select="@deleteURL"/> + <xsl:with-param name="body" select="'Delete'"/> + <xsl:with-param name="type" select="'delete'"/> + </xsl:call-template> + </td> + </tr> + </xsl:for-each> + </tbody> + </table> + </xsl:template> + + <xsl:template match="atoz:providerDetails"> + <xsl:choose> + <xsl:when test="objectType = 'com.arsdigita.london.atoz.AtoZCategoryProvider'"> + <table class="property"> + <thead> + <th colspan="2">Category Provider Details</th> + </thead> + <tr class="odd"> + <th>Title:</th> + <td><xsl:value-of select="title"/></td> + </tr> + <tr class="even"> + <th>Description:</th> + <td><xsl:value-of select="description"/></td> + </tr> + <tr class="odd"> + <th>Show items:</th> + <td><xsl:value-of select="isCompound"/></td> + </tr> + <tr class="even"> + <th>Root category:</th> + <td><xsl:value-of select="rootUseContext/rootCategory/name"/></td> + </tr> + </table> + </xsl:when> + <xsl:when test="objectType = 'com.arsdigita.london.atoz.AtoZItemProvider'"> + <table class="property"> + <thead> + <th colspan="2">Item Provider Details</th> + </thead> + <tr class="odd"> + <th>Title:</th> + <td><xsl:value-of select="title"/></td> .. |
From: <ap...@vh...> - 2006-08-25 18:02:55
|
Author: apevec Date: 2006-08-25 19:55:03 +0200 (Fri, 25 Aug 2006) New Revision: 1290 Modified: trunk/ccm-cms/src/com/arsdigita/cms/lifecycle/Initializer.java Log: option disable LC timer thread XXX to be moved to a config parameter Modified: trunk/ccm-cms/src/com/arsdigita/cms/lifecycle/Initializer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/lifecycle/Initializer.java 2006-08-18 13:39:37 UTC (rev 1289) +++ trunk/ccm-cms/src/com/arsdigita/cms/lifecycle/Initializer.java 2006-08-25 17:55:03 UTC (rev 1290) @@ -46,8 +46,9 @@ private Scheduler scheduler; public Initializer() throws InitializationException { + // XXX move to ccm registry m_conf.initParameter("delay", - "The delay of the scheduler in seconds", + "The delay of the scheduler in seconds, 0 to disable LC background thread", Integer.class); m_conf.initParameter("frequency", "The frequency of the scheduler in seconds", @@ -67,12 +68,14 @@ **/ public void startup() { - Integer delay = (Integer) m_conf.getParameter("delay"); - Integer frequency = (Integer) m_conf.getParameter("frequency"); + long delay = ((Integer) m_conf.getParameter("delay")).longValue(); + long frequency = ((Integer) m_conf.getParameter("frequency")).longValue(); - Scheduler.s_timerDelay = delay.longValue() * (long) 1000; - Scheduler.s_timerFrequency = frequency.longValue() * (long) 1000; - Scheduler.startTimer(); + if (delay > 0) { + Scheduler.s_timerDelay = delay * (long) 1000; + Scheduler.s_timerFrequency = frequency * (long) 1000; + Scheduler.startTimer(); + } } /** |
From: <ssk...@vh...> - 2006-08-18 13:46:39
|
Author: sskracic Date: 2006-08-18 15:39:37 +0200 (Fri, 18 Aug 2006) New Revision: 1289 Modified: trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql Log: Fixed errors in postgres upgrade script. Modified: trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql 2006-08-18 10:10:02 UTC (rev 1288) +++ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql 2006-08-18 13:39:37 UTC (rev 1289) @@ -14,8 +14,7 @@ -- $Id: add_task_type_privileges.sql,v 1.1 2006/06/08 14:28:12 awux7820 Exp $ -- $DateTime: 2004/04/07 16:07:11 $ -alter table cms_task_types -ADD (privilege VARCHAR(200)); +alter table cms_task_types add privilege VARCHAR(200); update cms_task_types set privilege = 'cms_edit_item' @@ -27,4 +26,4 @@ update cms_task_types set privilege = 'cms_publish' -where name = 'Deploy'; \ No newline at end of file +where name = 'Deploy'; Modified: trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql 2006-08-18 10:10:02 UTC (rev 1288) +++ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql 2006-08-18 13:39:37 UTC (rev 1289) @@ -15,10 +15,10 @@ -- $DateTime: 2004/04/07 16:07:11 $ create table cms_task_url_generators - (generator_id NUMBER NOT NULL, - task_type_id NUMBER, + (generator_id integer NOT NULL, + task_type_id integer, event VARCHAR(100), classname VARCHAR (128), CONSTRAINT cms_task_url_generator_pk PRIMARY KEY (generator_id), CONSTRAINT cms_url_gen_task_type_fk FOREIGN KEY (task_type_id) REFERENCES cms_task_types (task_type_id)); - \ No newline at end of file + |
From: <ssk...@vh...> - 2006-08-18 10:17:01
|
Author: sskracic Date: 2006-08-18 12:10:02 +0200 (Fri, 18 Aug 2006) New Revision: 1288 Removed: trunk/ccm-cms/sql/ccm-cms/default/content-section/cms-privileges.sql Modified: trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-privileges.sql trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql trunk/ccm-cms/sql/ccm-cms/postgres-create.sql Log: New privilege should be available to a freshly loaded instance. Deleted: trunk/ccm-cms/sql/ccm-cms/default/content-section/cms-privileges.sql Modified: trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-privileges.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-privileges.sql 2006-08-18 09:51:50 UTC (rev 1287) +++ trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-privileges.sql 2006-08-18 10:10:02 UTC (rev 1288) @@ -21,6 +21,12 @@ insert into cms_privileges ( privilege, pretty_name, sort_order, scope ) values ( + 'cms_staff_admin', 'Administer Roles', 10, 'section' +); + +insert into cms_privileges ( + privilege, pretty_name, sort_order, scope +) values ( 'cms_workflow_admin', 'Administer Workflow', 20, 'section' ); insert into cms_privileges ( @@ -83,3 +89,13 @@ ) values ( 'cms_preview_item', 'Preview Items', 100, 'folder', '1' ); + +insert into acs_privileges (privilege) values ('cms_approve_item'); + +insert into cms_privileges ( + privilege, pretty_name, sort_order, scope +) values ( + 'cms_approve_item', 'Approve Items', 69, 'item' +); + + Modified: trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql 2006-08-18 09:51:50 UTC (rev 1287) +++ trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql 2006-08-18 10:10:02 UTC (rev 1288) @@ -21,7 +21,6 @@ @@ ddl/oracle-se/create.sql @@ default/content-section/table-cms_privileges.sql -@@ default/content-section/cms-privileges.sql @@ default/content-section/insert-privileges.sql @@ default/content-section/index-phase_def_cycle_definition_idx.sql @@ default/content-section/index-lifecycles_definition_id_idx.sql Modified: trunk/ccm-cms/sql/ccm-cms/postgres-create.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres-create.sql 2006-08-18 09:51:50 UTC (rev 1287) +++ trunk/ccm-cms/sql/ccm-cms/postgres-create.sql 2006-08-18 10:10:02 UTC (rev 1288) @@ -21,7 +21,6 @@ \i ddl/postgres/create.sql \i default/content-section/table-cms_privileges.sql -\i default/content-section/cms-privileges.sql \i default/content-section/insert-privileges.sql \i default/content-section/index-phase_def_cycle_definition_idx.sql \i default/content-section/index-lifecycles_definition_id_idx.sql |
From: <ssk...@vh...> - 2006-08-18 09:58:49
|
Author: sskracic Date: 2006-08-18 11:51:50 +0200 (Fri, 18 Aug 2006) New Revision: 1287 Modified: trunk/ccm-core/src/com/arsdigita/caching/CacheTable.java Log: More verbose logging. Modified: trunk/ccm-core/src/com/arsdigita/caching/CacheTable.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/caching/CacheTable.java 2006-08-18 09:39:56 UTC (rev 1286) +++ trunk/ccm-core/src/com/arsdigita/caching/CacheTable.java 2006-08-18 09:51:50 UTC (rev 1287) @@ -52,7 +52,7 @@ private static final Logger s_log = Logger.getLogger(CacheTable.class); // this was 20, which was too high for small setups - // cached Templates were eating 4megs each, so there you go + // cached Templates were eating 4megs each, so there you go public static final int MIN_CACHE_SIZE = 2; public static final int MAX_CACHE_SIZE = 1000000; @@ -69,7 +69,7 @@ /** For debugging only. */ public static final Browser BROWSER = new BrowserImpl(s_caches); - + /** * <p>Creates cache storage tagged with the passed in identificator. This * tag must be unique in the sense that no other cache table loaded by this @@ -135,7 +135,7 @@ int size = ((Integer) SystemProperties.get(sizeParam)).intValue(); if (size < MIN_CACHE_SIZE || size > MAX_CACHE_SIZE) { - s_log.warn("Cache size " + size + " was outside allowed range " + + s_log.warn("Cache size " + size + " was outside allowed range " + MIN_CACHE_SIZE + "-" + MAX_CACHE_SIZE); size = DEFAULT_CACHE_SIZE; } @@ -153,26 +153,26 @@ } /** - * add a listener that will be notified when entries are removed from - * this CacheTable (removal includes specific invalidation and + * add a listener that will be notified when entries are removed from + * this CacheTable (removal includes specific invalidation and * attempts to retrieve an entry that is stale) * @param listener */ public void addEntryRemovalListener(CacheEntryRemovalListener listener) { - m_list.addTableEntryRemovalListener(listener); + m_list.addTableEntryRemovalListener(listener); } - + /** * add a listener that will be notified when entries are removed from any - * CacheTable (removal includes specific invalidation and + * CacheTable (removal includes specific invalidation and * attempts to retrieve an entry that is stale) * @param listener */ public void addAllTableEntryRemovalListener(CacheEntryRemovalListener listener) { DynamicList.addAllTableEntryRemovalListener(listener); } - + private static void register(String id, CacheTable cache) { if ( s_caches.containsKey(id) ) { throw new IllegalArgumentException @@ -204,7 +204,7 @@ private int saneMaxAge(int age) { if (age < MIN_CACHE_AGE || age > MAX_CACHE_AGE) { - s_log.warn("Cache age " + age + " was outside allowed range " + + s_log.warn("Cache age " + age + " was outside allowed range " + MIN_CACHE_AGE + "-" + MAX_CACHE_AGE); return DEFAULT_CACHE_AGE; } else { @@ -311,8 +311,9 @@ if (s_log.isDebugEnabled()) { List trace = StringUtils.getStackList(new Throwable()); final String caller = (String) trace.get(2); - s_log.debug("Put key " + key + " in cache called at " + - caller + ", object is of type " + value.getClass() + + s_log.debug("Put key " + key + " in cache table " + m_cacheID + + " called at " + + caller + ", object is of type " + value.getClass() + " with hash code: " + hashCode); } // If peer webservers don't contain the latest value, @@ -323,7 +324,9 @@ } public synchronized void removeAll() { - s_log.debug("removeAll"); + if (s_log.isDebugEnabled()) { + s_log.debug("removeAll from cache table " + m_cacheID); + } m_list.clear(); } @@ -387,7 +390,7 @@ synchronized void removeLocally(final String key) { m_list.remove(key); if (s_log.isDebugEnabled()) { - s_log.debug("Removed key " + key); + s_log.debug("Removed key " + key + " from cache table " + m_cacheID); } } |
From: <ssk...@vh...> - 2006-08-18 09:47:56
|
Author: sskracic Date: 2006-08-18 11:39:56 +0200 (Fri, 18 Aug 2006) New Revision: 1286 Removed: trunk/ccm-cms/sql/ccm-cms/default/content-section/default-task_types.sql trunk/ccm-cms/sql/ccm-cms/default/content-section/table-cms_task_types.sql Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-task-types.sql trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql trunk/ccm-cms/sql/ccm-cms/postgres-create.sql Log: cms_task_types table (and all others) should be autogenerated. Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl =================================================================== --- trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl 2006-08-17 11:49:24 UTC (rev 1285) +++ trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl 2006-08-18 09:39:56 UTC (rev 1286) @@ -1,61 +1,60 @@ // // Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. // -// The contents of this file are subject to the CCM Public -// License (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the -// License at http://www.redhat.com/licenses/ccmpl.html. +// The contents of this file are subject to the CCM Public +// License (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the +// License at http://www.redhat.com/licenses/ccmpl.html. // -// Software distributed under the License is distributed on an -// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express -// or implied. See the License for the specific language governing -// rights and limitations under the License. +// Software distributed under the License is distributed on an +// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +// or implied. See the License for the specific language governing +// rights and limitations under the License. // -// $Id$ -// $DateTime: 2004/04/07 16:07:11 $ +// $Id$ model com.arsdigita.cms.workflow; import com.arsdigita.workflow.simple.*; import com.arsdigita.kernel.ACSObject; object type CMSTask extends UserTask { - composite CMSTaskType [1..1] taskType = join cms_tasks.task_type_id to cms_task_types.task_type_id; + composite CMSTaskType [1..1] taskType = join cms_tasks.task_type_id to cms_task_types.task_type_id; reference key (cms_tasks.task_id); } -object type CMSTaskType { - Integer [1..1] taskTypeID = cms_task_types.task_type_id INTEGER; - String [1..1] name = cms_task_types.name VARCHAR(64); - String [1..1] defaultUrlGeneratorClass = cms_task_types.classname VARCHAR(128); - String [1..1] privilege = cms_task_types.privilege VARCHAR(200); - - object key (taskTypeID); -} - - -object type TaskEventURLGenerator { - Integer [1..1] generatorID = cms_task_url_generators.generator_id INTEGER; - String [1..1] event = cms_task_url_generators.event VARCHAR(100); - String [1..1] urlGeneratorClass = cms_task_url_generators.classname VARCHAR(128); - - object key (generatorID); - -} - -association { - - TaskEventURLGenerator [0..n] generators = join cms_task_types.task_type_id to cms_task_url_generators.task_type_id; - CMSTaskType [1..1] taskType = join cms_task_url_generators.task_type_id to cms_task_types.task_type_id; -} - +object type CMSTaskType { + Integer[1..1] taskTypeID = cms_task_types.task_type_id INTEGER; + String [1..1] name = cms_task_types.name VARCHAR(64); + String [1..1] defaultUrlGeneratorClass = cms_task_types.classname VARCHAR(128); + String [1..1] privilege = cms_task_types.privilege VARCHAR(200); + + object key (taskTypeID); +} + + +object type TaskEventURLGenerator { + Integer [1..1] generatorID = cms_task_url_generators.generator_id INTEGER; + String [1..1] event = cms_task_url_generators.event VARCHAR(100); + String [1..1] urlGeneratorClass = cms_task_url_generators.classname VARCHAR(128); + + object key (generatorID); + +} + +association { + + TaskEventURLGenerator [0..n] generators = join cms_task_types.task_type_id to cms_task_url_generators.task_type_id; + CMSTaskType [1..1] taskType = join cms_task_url_generators.task_type_id to cms_task_types.task_type_id; +} + query getItemFromTask { ACSObject obj; do { - select a.object_id, + select a.object_id, a.default_domain_class, - a.display_name, + a.display_name, a.object_type from acs_objects a, cw_tasks t, Deleted: trunk/ccm-cms/sql/ccm-cms/default/content-section/default-task_types.sql Modified: trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-task-types.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-task-types.sql 2006-08-17 11:49:24 UTC (rev 1285) +++ trunk/ccm-cms/sql/ccm-cms/default/content-section/insert-task-types.sql 2006-08-18 09:39:56 UTC (rev 1286) @@ -18,5 +18,9 @@ -- $Id$ -- $DateTime: 2004/08/17 23:15:09 $ -insert into cms_task_types values (2, 'Edit', 'com.arsdigita.cms.workflow.EditingTaskURLGenerator'); -insert into cms_task_types values (3, 'Deploy', 'com.arsdigita.cms.workflow.DeployTaskURLGenerator'); +insert into cms_task_types (task_type_id, name, classname, privilege) + values (1, 'Author', 'com.arsdigita.cms.workflow.AuthoringTaskURLGenerator', 'cms_edit_item'); +insert into cms_task_types (task_type_id, name, classname, privilege) + values (2, 'Edit', 'com.arsdigita.cms.workflow.EditingTaskURLGenerator', 'cms_approve_item'); +insert into cms_task_types (task_type_id, name, classname, privilege) + values (3, 'Deploy', 'com.arsdigita.cms.workflow.DeployTaskURLGenerator', 'cms_publish'); Deleted: trunk/ccm-cms/sql/ccm-cms/default/content-section/table-cms_task_types.sql Modified: trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql 2006-08-17 11:49:24 UTC (rev 1285) +++ trunk/ccm-cms/sql/ccm-cms/oracle-se-create.sql 2006-08-18 09:39:56 UTC (rev 1286) @@ -72,11 +72,9 @@ @@ default/content-section/table-cms_resource_map.sql @@ default/content-section/index-cms_resource_map_resource_idx.sql @@ default/content-section/comment-cms_resource_map.sql -@@ default/content-section/table-cms_task_types.sql @@ default/content-section/table-cms_tasks.sql @@ default/content-section/index-cms_tasks_task_type_id_idx.sql @@ default/content-section/table-cms_wf_notifications.sql -@@ default/content-section/default-task_types.sql @@ default/content-section/insert-task-types.sql @@ default/content-section/table-cw_process_definitions.sql @@ default/content-section/sequence-convert_format_seq.sql Modified: trunk/ccm-cms/sql/ccm-cms/postgres-create.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres-create.sql 2006-08-17 11:49:24 UTC (rev 1285) +++ trunk/ccm-cms/sql/ccm-cms/postgres-create.sql 2006-08-18 09:39:56 UTC (rev 1286) @@ -72,11 +72,9 @@ \i default/content-section/table-cms_resource_map.sql \i default/content-section/index-cms_resource_map_resource_idx.sql \i default/content-section/comment-cms_resource_map.sql -\i default/content-section/table-cms_task_types.sql \i default/content-section/table-cms_tasks.sql \i default/content-section/index-cms_tasks_task_type_id_idx.sql \i default/content-section/table-cms_wf_notifications.sql -\i default/content-section/default-task_types.sql \i default/content-section/insert-task-types.sql \i default/content-section/table-cw_process_definitions.sql \i default/content-section/table-cms_templates.sql |
From: <ssk...@vh...> - 2006-08-17 11:56:22
|
Author: sskracic Date: 2006-08-17 13:49:24 +0200 (Thu, 17 Aug 2006) New Revision: 1285 Modified: trunk/ccm-core/src/com/arsdigita/kernel/permissions/PrivilegeDescriptor.java Log: What on Earth are CMS privileges doing here? Modified: trunk/ccm-core/src/com/arsdigita/kernel/permissions/PrivilegeDescriptor.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/kernel/permissions/PrivilegeDescriptor.java 2006-08-10 19:59:07 UTC (rev 1284) +++ trunk/ccm-core/src/com/arsdigita/kernel/permissions/PrivilegeDescriptor.java 2006-08-17 11:49:24 UTC (rev 1285) @@ -48,17 +48,6 @@ private static final String CREATE_NAME = "create"; private static final String DELETE_NAME = "delete"; - // CMS Privileges...this is part of the hack for the s_implications below - private final static String CMS_STAFF_ADMIN = "cms_staff_admin"; - private final static String CMS_CATEGORY_ADMIN = "cms_category_admin"; - private final static String CMS_PUBLISH = "cms_publish"; - private final static String CMS_NEW_ITEM = "cms_new_item"; - private final static String CMS_EDIT_ITEM = "cms_edit_item"; - private final static String CMS_DELETE_ITEM = "cms_delete_item"; - private final static String CMS_READ_ITEM = "cms_read_item"; - private final static String CMS_PREVIEW_ITEM = "cms_preview_item"; - private final static String CMS_CATEGORIZE_ITEMS = "cms_categorize_items"; - /** * The PrivilegeDescriptor corresponding to the primitive admin privilege */ @@ -99,7 +88,7 @@ private static Map s_privs = Collections.synchronizedMap(new HashMap()); private String m_name; - + private String m_columnName; @@ -145,7 +134,7 @@ } } - + /** * * Given a privilege name, returns a privilege descriptor or null @@ -234,8 +223,8 @@ public String getColumnName() { return m_columnName; } - - + + /** * Determines whether this PrivilegeDescriptor is equal to some other * PrivilegeDescriptor. Equality is based on privilege name. @@ -267,19 +256,18 @@ **/ public PrivilegeDescriptor(String name) { m_name = name; - - DataQuery query = SessionManager.getSession() + + DataQuery query = SessionManager.getSession() .retrieveQuery("com.arsdigita.kernel.permissions.PrivilegeColumnNameMap"); query.setParameter("privilege", name); if (!query.next()) { query.close(); - throw new + throw new RuntimeException("Couldn't find column name for privilege - " + name ); } else { m_columnName = (String)query.get("columnName"); } query.close(); - } /** @@ -346,7 +334,6 @@ put(desc); } privs.close(); - } } |
From: <ap...@vh...> - 2006-08-10 20:05:47
|
Author: apevec Date: 2006-08-10 21:59:07 +0200 (Thu, 10 Aug 2006) New Revision: 1284 Modified: trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java Log: make classes deprecated in r1277 extend new classes to avoid future copy'n'paste syndroms Modified: trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java =================================================================== --- trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java 2006-08-10 14:40:05 UTC (rev 1283) +++ trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java 2006-08-10 19:59:07 UTC (rev 1284) @@ -33,259 +33,21 @@ /** * * @deprecated - use {@link com.arsdigita.packaging.Program} - * * - * <p> - * Provides base framework for writing command line - * programs that require the CCM context to be be - * initialized. It also integrates the Apache Commons - * CLI package for simple command line argument handling. - * </p> - * <p> - * As an example usage scenario for this class, - * consider a tool that prints out the current - * sitemap. This would be implemented as follows: - * </p> - * - * <pre> - *public class SiteMapList extends Program { - * - * public SiteMapList() { - * super("Site Map Listing" - * "1.0.0", - * ""); - * } - * - * protected void doRun(CommandLine cmdLine) { - * ApplicationCollection apps = - * Application.retrieveAllApplications(); - * apps.addOrder("primaryURL"); - * - * while (apps.next()) { - * Application app = apps.getApplication(); - * - * System.out.println(app.getPath() + " -> " + - * app.getApplicationType().getTitle()); - * - * if (isVerbose()) { - * System.out.println(" Description: " + - * app.getApplicationType().getDescription()); - * } - * if (isDebug()) { - * System.out.println(" Class: " + - * app.getClass()); - * } - * } - * } - * - * public static void main(String[] args) { - * new SiteMapList().run(args); - * } - *} - * </pre> - * */ -public abstract class Program { +public abstract class Program extends com.arsdigita.packaging.Program { - private String m_name; - private String m_version; - private String m_usage; - private boolean m_verbose = false; - private boolean m_debug = false; - private boolean m_startup = true; - - private Options m_options; - - /** - * Creates a new program. The conventions for the - * usage parameter follow the GNU style guidelines. - * For example, if there are multiple source files - * and one destination, it would be "SOURCE... DEST". - * Standard WAF startup procedures will be performed - * before the doRun method is executed. - * @param name the program name - * @param version the version string - * @param usage for any non-option command line arguments - */ public Program(String name, String version, String usage) { - this(name, version, usage, true); + super(name, version, usage, true); } - /** - * Creates a new program. The conventions for the - * usage parameter follow the GNU style guidelines. - * For example, if there are multiple source files - * and one destination, it would be "SOURCE... DEST" - * @param name the program name - * @param version the version string - * @param usage for any non-option command line arguments - * @param startup true to perform standard WAF startup - */ public Program(String name, String version, String usage, boolean startup) { - m_name = name; - m_version = version; - m_usage = usage; - m_startup = startup; - m_options = new Options(); - - m_options.addOption - (OptionBuilder - .hasArg(false) - .withLongOpt("help") - .withDescription("Print this message") - .create('?')); - m_options.addOption - (OptionBuilder - .hasArg(false) - .withLongOpt("version") - .withDescription("Print version information") - .create('V')); - m_options.addOption - (OptionBuilder - .hasArg(false) - .withLongOpt("verbose") - .withDescription("Generate verbose output") - .create('v')); - m_options.addOption - (OptionBuilder - .hasArg(false) - .withLongOpt("debug") - .withDescription("Generate debugging output") - .create('D')); + super(name, version, usage, startup); } - /** - * Retrieves the version for this program - * @return the version string - */ - public String getVersion() { - return m_version; - } - - /** - * Retrieves the program name - * @return the program name - */ - public String getName() { - return m_name; - } - - /** - * Retrieves the usage for non-option command - * line arguments - * @return the command usage - */ - public String getUsage() { - return m_usage; - } - - /** - * Retrieves the command line options configuration - * @return the command line options - */ - public Options getOptions() { - return m_options; - } - - /** - * Determines if the program should generate verbose - * output. Verbose output is information that is - * useful to end users of the program. - * @return true if verbose output is required - */ - public boolean isVerbose() { - return m_verbose; - } - - /** - * Determines if the program should generate debug - * output. Debug output is information that is useful - * to programmers or system administrators. - * @return true if debug output is required - */ - public boolean isDebug() { - return m_debug; - } - - /** - * Runs the program. First off all the command line - * arguments are first parsed. If the --help or - * --version arguments were specified then this - * information is output and execution stops. - * Otherwise, the CCM startup process is invoked - * and then finally the doRun method is run. - * @param args the command line arguments to parse - */ - public final void run(String[] args) { - CommandLine cmdLine = null; - try { - cmdLine = new GnuParser().parse(m_options, - args); - } catch (ParseException ex) { - help(System.err); - System.exit(1); - } - - if (cmdLine.hasOption("?")) { - help(System.out); - System.exit(0); - } else if (cmdLine.hasOption("V")) { - System.out.println(m_version); - System.exit(0); - } - - m_verbose = cmdLine.hasOption("v"); - m_debug = cmdLine.hasOption("D"); - - try { - if (m_startup) { - Startup startup = new Startup(); - startup.run(); - } - - doRun(cmdLine); - - System.exit(0); - } catch (Throwable t) { - System.err.println("Error: " + t.getClass() + - ":" + t.getMessage()); - if (isDebug()) { - ProgramErrorReport report = - new ProgramErrorReport(t, args); - report.logit(); - } else if (isVerbose()) { - t.printStackTrace(System.err); - } - System.exit(1); - } - } - - /** - * This method should be implemented by subclasses - * to do whatever processing they require. - * @param cmdLine the parsed command line - */ - protected abstract void doRun(CommandLine cmdLine); - - /** - * Sends a command line help usage message to the - * output stream - * @param os the destination stream - */ - public void help(OutputStream os) { - HelpFormatter fmt = new HelpFormatter(); - PrintWriter w = new PrintWriter(os); - fmt.printHelp(w, 80, - "ccm-run " + getClass().getName() + - " [OPTION]... " + getUsage(), - "\nOptions:", - getOptions(), - 2, 4, null, false); - w.flush(); - } } Modified: trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java =================================================================== --- trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java 2006-08-10 14:40:05 UTC (rev 1283) +++ trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java 2006-08-10 19:59:07 UTC (rev 1284) @@ -25,21 +25,11 @@ * @deprecated - use {@link com.arsdigita.packaging.ProgramErrorReport} * */ -public class ProgramErrorReport extends ErrorReport { +public class ProgramErrorReport extends com.arsdigita.packaging.ProgramErrorReport { public ProgramErrorReport(Throwable throwable, String[] args) { - super(throwable); - - try { - addArgs(args); - } catch (Exception ex) { - ex.printStackTrace(); - } + super(throwable, args); } - - private void addArgs(String[] args) { - addSection("Command line arguments", - args); - } + } |
From: <ap...@vh...> - 2006-08-10 14:46:59
|
Author: apevec Date: 2006-08-10 16:40:05 +0200 (Thu, 10 Aug 2006) New Revision: 1283 Added: trunk/ccm-core/web/WEB-INF/jboss-web.xml Log: context root specification for JBoss Added: trunk/ccm-core/web/WEB-INF/jboss-web.xml =================================================================== --- trunk/ccm-core/web/WEB-INF/jboss-web.xml 2006-08-08 09:51:32 UTC (rev 1282) +++ trunk/ccm-core/web/WEB-INF/jboss-web.xml 2006-08-10 14:40:05 UTC (rev 1283) @@ -0,0 +1,3 @@ +<jboss-web> + <context-root>/</context-root> +</jboss-web> |
From: <ap...@vh...> - 2006-08-08 09:58:08
|
Author: apevec Date: 2006-08-08 11:51:32 +0200 (Tue, 08 Aug 2006) New Revision: 1282 Modified: trunk/tools/misc/build-all.sh Log: virtual root reorg Modified: trunk/tools/misc/build-all.sh =================================================================== --- trunk/tools/misc/build-all.sh 2006-08-08 09:49:00 UTC (rev 1281) +++ trunk/tools/misc/build-all.sh 2006-08-08 09:51:32 UTC (rev 1282) @@ -335,7 +335,7 @@ HOMESRPMDIR="$HOMETOPDIR/SRPMS" HOMEBUILDDIR="$HOMETOPDIR/BUILD" -PATH=$VIRTUAL_ROOT/bin:$PATH +PATH=$VIRTUAL_ROOT/usr/bin:$PATH RUNTIME_DOCS="core/developer-guide" RUNTIME_DOCS="$RUNTIME_DOCS core/install-guide" @@ -401,12 +401,12 @@ # (20041108 Seb) # This directory must exist because 'rpm -i' of httpunit and friends will fail. # In a real world, this dir would have been already created by the packages httpunit at ali depend on. - mkdir -p $VIRTUAL_ROOT/share/java + mkdir -p $VIRTUAL_ROOT/usr/share/java mkdir -p $VIRTUAL_ROOT/etc/ccm mkdir -p $VIRTUAL_ROOT/etc/profile.d - mkdir -p $VIRTUAL_ROOT/share/ccm-tools - mkdir -p $VIRTUAL_ROOT/share/doc - mkdir -p $VIRTUAL_ROOT/bin + mkdir -p $VIRTUAL_ROOT/usr/share/ccm-tools + mkdir -p $VIRTUAL_ROOT/usr/share/doc + mkdir -p $VIRTUAL_ROOT/usr/bin mkdir -p $VIRTUAL_ROOT/var/cache mkdir -p $VIRTUAL_ROOT/var/lib/ccm mkdir -p $VIRTUAL_ROOT/var/lib/ccm-devel @@ -498,7 +498,7 @@ set -e cd tools/devel check_svn_tagged - CCM_TOOLS_HOME=$VIRTUAL_ROOT/share/ccm-tools ./rollingbuild.sh + CCM_TOOLS_HOME=$VIRTUAL_ROOT/usr/share/ccm-tools ./rollingbuild.sh DEVEL_VERSION=`grep 'VERSION=' configure.in | sed -e 's/VERSION=//'` DEVEL_RELEASE="`grep 'RELEASE=' configure.in | sed -e 's/RELEASE=//'`${SVN_REVISION}" $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc --relocate /var=$VIRTUAL_ROOT/var $HOMERPMDIR/ccm-devel-$DEVEL_VERSION-$DEVEL_RELEASE.noarch.rpm @@ -509,7 +509,7 @@ set -e cd tools/scripts check_svn_tagged - CCM_TOOLS_HOME=$VIRTUAL_ROOT/share/ccm-tools ./rollingbuild.sh + CCM_TOOLS_HOME=$VIRTUAL_ROOT/usr/share/ccm-tools ./rollingbuild.sh SCRIPTS_VERSION=`grep 'VERSION=' configure.in | sed -e 's/VERSION=//'` SCRIPTS_RELEASE="`grep 'RELEASE=' configure.in | sed -e 's/RELEASE=//'`${SVN_REVISION}" $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc $HOMERPMDIR/ccm-scripts-$SCRIPTS_VERSION-$SCRIPTS_RELEASE.noarch.rpm @@ -546,8 +546,7 @@ else for file in $(rpm -ql ant-contrib) do - relfile=${file#/usr} - dir=$VIRTUAL_ROOT${relfile%/*} + dir=$VIRTUAL_ROOT${file%/*} mkdir -p $dir cp -f $file $dir done @@ -581,7 +580,7 @@ export CCM_BUILD_COUNTER fi - CCM_SHARED_LIB_DIST_DIR=$VIRTUAL_ROOT/share/java CCM_CONFIG_LIB_DIR=$VIRTUAL_ROOT/share/java CCM_TOOLS_HOME=$VIRTUAL_ROOT/share/ccm-tools CCM_SCRIPTS_HOME=$VIRTUAL_ROOT/share/ccm-scripts CCM_CONFIG_HOME=$VIRTUAL_ROOT/share/ccm-devel $VIRTUAL_ROOT/share/ccm-scripts/bin/build.sh + CCM_SHARED_LIB_DIST_DIR=$VIRTUAL_ROOT/usr/share/java CCM_CONFIG_LIB_DIR=$VIRTUAL_ROOT/usr/share/java CCM_TOOLS_HOME=$VIRTUAL_ROOT/usr/share/ccm-tools CCM_SCRIPTS_HOME=$VIRTUAL_ROOT/usr/share/ccm-scripts CCM_CONFIG_HOME=$VIRTUAL_ROOT/usr/share/ccm-devel $VIRTUAL_ROOT/usr/share/ccm-scripts/bin/build.sh ) || exit $? ( |
From: <ap...@vh...> - 2006-08-08 09:55:38
|
Author: apevec Date: 2006-08-08 11:49:00 +0200 (Tue, 08 Aug 2006) New Revision: 1281 Modified: trunk/tools/tools/ Log: ignore autogenerated stuff Property changes on: trunk/tools/tools ___________________________________________________________________ Name: svn:ignore - configure configure.in.tmp Makefile.in config.log ccm-tools-*.zip ccm-tools-*.tar.gz Makefile config.status ccm-tools.spec autom4te.cache pm_to_blib blib missing aclocal.m4 Makefile.perl install-sh + configure configure.in.tmp Makefile.in config.log ccm-tools-*.zip ccm-tools-*.tar.gz Makefile config.status ccm-tools.spec autom4te.cache pm_to_blib blib missing aclocal.m4 Makefile.perl install-sh mkinstalldirs |
From: <ap...@vh...> - 2006-08-08 08:57:58
|
Author: apevec Date: 2006-08-08 10:51:11 +0200 (Tue, 08 Aug 2006) New Revision: 1280 Modified: trunk/tools/devel/ccm-devel.spec.in trunk/tools/devel/configure.in trunk/tools/misc/build-all.sh trunk/tools/scripts/ccm-scripts.spec.in trunk/tools/scripts/configure.in trunk/tools/scripts/pkg/dist/rpm.spec.in trunk/tools/scripts/pkg/dist/rpm.spec.java-standalone.in Log: make installation prefixes order uniform across all RPM specs Modified: trunk/tools/devel/ccm-devel.spec.in =================================================================== --- trunk/tools/devel/ccm-devel.spec.in 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/devel/ccm-devel.spec.in 2006-08-08 08:51:11 UTC (rev 1280) @@ -16,8 +16,8 @@ Obsoletes: ccm-config Provides: ccm-config 1.1.0 BuildArchitectures: noarch +Prefix: /usr Prefix: /etc -Prefix: /usr Prefix: /var %package cvs @@ -63,8 +63,8 @@ grep "^ccm-devel" /etc/group > /dev/null || groupadd ccm-devel %post -ETC_DIR=$RPM_INSTALL_PREFIX0 -USR_DIR=$RPM_INSTALL_PREFIX1 +USR_DIR=$RPM_INSTALL_PREFIX0 +ETC_DIR=$RPM_INSTALL_PREFIX1 VAR_DIR=$RPM_INSTALL_PREFIX2 # RPM bug workaround if [ "x$ETC_DIR" = "x" ]; then ETC_DIR=/etc ; fi @@ -86,7 +86,7 @@ ln -sf jakarta-oro-2.0.4.jar jakarta-oro.jar %post cvs -ETC_DIR=$RPM_INSTALL_PREFIX0 +ETC_DIR=$RPM_INSTALL_PREFIX1 VAR_DIR=$RPM_INSTALL_PREFIX2 # RPM bug workaround if [ "x$ETC_DIR" = "x" ]; then ETC_DIR=/etc ; fi Modified: trunk/tools/devel/configure.in =================================================================== --- trunk/tools/devel/configure.in 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/devel/configure.in 2006-08-08 08:51:11 UTC (rev 1280) @@ -4,7 +4,7 @@ AC_INIT(ccm-devel.spec.in) VERSION=6.3.0 -RELEASE=2 +RELEASE=3 AM_INIT_AUTOMAKE(ccm-devel, $VERSION) AC_SUBST(RELEASE) Modified: trunk/tools/misc/build-all.sh =================================================================== --- trunk/tools/misc/build-all.sh 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/misc/build-all.sh 2006-08-08 08:51:11 UTC (rev 1280) @@ -478,7 +478,7 @@ TOOLS_NAME=`grep 'Name:' *.spec | sed -e 's/Name://' | sed -e 's/ //g'` TOOLS_VERSION=`grep 'Version:' *.spec | sed -e 's/Version://' | sed -e 's/ //g'` TOOLS_RELEASE=`grep 'Release:' *.spec | sed -e 's/Release://' | sed -e 's/ //g'` - $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT --relocate /etc=$VIRTUAL_ROOT/etc $HOMERPMDIR/$TOOLS_NAME-$TOOLS_VERSION-$TOOLS_RELEASE.noarch.rpm + $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc $HOMERPMDIR/$TOOLS_NAME-$TOOLS_VERSION-$TOOLS_RELEASE.noarch.rpm ) || exit $? done @@ -490,8 +490,7 @@ TOOLS_RELEASE="`grep 'RELEASE=' configure.in | sed -e 's/RELEASE=//'`${SVN_REVISION}" ccm_tools_home="$HOMEBUILDDIR/ccm-tools-$TOOLS_VERSION" CCM_TOOLS_HOME="$ccm_tools_home" ./rollingbuild.sh - $RPM $RPM_ARGS -ivh --noscripts --relocate /etc=$VIRTUAL_ROOT/etc --relocate /usr=$VIRTUAL_ROOT --relocate /var=$VIRTUAL_ROOT/var $HOMERPMDIR/ccm-tools-$TOOLS_VERSION-$TOOLS_RELEASE.noarch.rpm -# $BUILD_HOME/rpm -ivh --relocate /etc=$VIRTUAL_ROOT/etc --relocate /usr=$VIRTUAL_ROOT --relocate /var=$VIRTUAL_ROOT/var --define "_dbpath $VIRTUAL_ROOT/rpmdb" $HOMERPMDIR/ccm-tools-$TOOLS_VERSION-$TOOL_RELEASE.noarch.rpm $HOMERPMDIR/ccm-tools-servlet-tomcat-$TOOLS_VERSION-$TOOL_RELEASE.noarch.rpm $HOMERPMDIR/ccm-tools-servlet-resin-$TOOLS_VERSION-$TOOL_RELEASE.noarch.rpm + $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc --relocate /var=$VIRTUAL_ROOT/var $HOMERPMDIR/ccm-tools-$TOOLS_VERSION-$TOOLS_RELEASE.noarch.rpm ) || exit $? . $VIRTUAL_ROOT/etc/profile.d/ccm-tools.sh @@ -502,7 +501,7 @@ CCM_TOOLS_HOME=$VIRTUAL_ROOT/share/ccm-tools ./rollingbuild.sh DEVEL_VERSION=`grep 'VERSION=' configure.in | sed -e 's/VERSION=//'` DEVEL_RELEASE="`grep 'RELEASE=' configure.in | sed -e 's/RELEASE=//'`${SVN_REVISION}" - $RPM $RPM_ARGS -ivh --noscripts --relocate /etc=$VIRTUAL_ROOT/etc --relocate /usr=$VIRTUAL_ROOT --relocate /var=$VIRTUAL_ROOT/var $HOMERPMDIR/ccm-devel-$DEVEL_VERSION-$DEVEL_RELEASE.noarch.rpm + $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc --relocate /var=$VIRTUAL_ROOT/var $HOMERPMDIR/ccm-devel-$DEVEL_VERSION-$DEVEL_RELEASE.noarch.rpm ) || exit $? . $VIRTUAL_ROOT/etc/profile.d/ccm-devel.sh @@ -513,7 +512,7 @@ CCM_TOOLS_HOME=$VIRTUAL_ROOT/share/ccm-tools ./rollingbuild.sh SCRIPTS_VERSION=`grep 'VERSION=' configure.in | sed -e 's/VERSION=//'` SCRIPTS_RELEASE="`grep 'RELEASE=' configure.in | sed -e 's/RELEASE=//'`${SVN_REVISION}" - $RPM $RPM_ARGS -ivh --noscripts --relocate /etc=$VIRTUAL_ROOT/etc --relocate /usr=$VIRTUAL_ROOT $HOMERPMDIR/ccm-scripts-$SCRIPTS_VERSION-$SCRIPTS_RELEASE.noarch.rpm + $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc $HOMERPMDIR/ccm-scripts-$SCRIPTS_VERSION-$SCRIPTS_RELEASE.noarch.rpm ) || exit $? . $VIRTUAL_ROOT/etc/profile.d/ccm-scripts.sh @@ -524,7 +523,7 @@ ./rollingbuild.sh BUNDLE_VERSION=`grep 'VERSION=' configure.in | sed -e 's/VERSION=//'` BUNDLE_RELEASE="`grep 'RELEASE=' configure.in | sed -e 's/RELEASE=//'`${SVN_REVISION}" - $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT $HOMERPMDIR/ccm-tools-bundle-$BUNDLE_VERSION-$BUNDLE_RELEASE.noarch.rpm + $RPM $RPM_ARGS -ivh --noscripts --relocate /usr=$VIRTUAL_ROOT/usr $HOMERPMDIR/ccm-tools-bundle-$BUNDLE_VERSION-$BUNDLE_RELEASE.noarch.rpm ) || exit $? fi @@ -557,7 +556,7 @@ export CCM_RPM_DIR=$HOMETOPDIR export CCM_RPMBUILD_FLAGS="$RPM_ARGS" -export CLASSPATH="$CLASSPATH:$VIRTUAL_ROOT/share/java/servlet-2.3.jar" +export CLASSPATH="$CLASSPATH:$VIRTUAL_ROOT/usr/share/java/servlet-2.3.jar" for i in $BUILD_APPS @@ -588,7 +587,7 @@ ( set -e set_application_properties $i - $RPM $RPM_ARGS --force --noscripts --relocate /usr=$VIRTUAL_ROOT --relocate /etc=$VIRTUAL_ROOT/etc -Uvh $HOMERPMDIR/$APP_NAME-$APP_VERSION-$RELEASE.noarch.rpm + $RPM $RPM_ARGS --replacefiles --replacepkgs --relocate /usr=$VIRTUAL_ROOT/usr --relocate /etc=$VIRTUAL_ROOT/etc -Uvh $HOMERPMDIR/$APP_NAME-$APP_VERSION-$RELEASE.noarch.rpm ) || exit $? done Modified: trunk/tools/scripts/ccm-scripts.spec.in =================================================================== --- trunk/tools/scripts/ccm-scripts.spec.in 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/scripts/ccm-scripts.spec.in 2006-08-08 08:51:11 UTC (rev 1280) @@ -19,8 +19,8 @@ Provides: acs-scripts Obsoletes: acs-scripts +Prefix: /usr Prefix: /etc -Prefix: /usr %description The CCM build scripts package provides support for building @@ -43,8 +43,8 @@ %post -ETC_DIR=$RPM_INSTALL_PREFIX0 -USR_DIR=$RPM_INSTALL_PREFIX1 +USR_DIR=$RPM_INSTALL_PREFIX0 +ETC_DIR=$RPM_INSTALL_PREFIX1 # RPM bug workaround if [ "x$ETC_DIR" = "x" ]; then ETC_DIR=/etc ; fi if [ "x$USR_DIR" = "x" ]; then USR_DIR=/usr ; fi Modified: trunk/tools/scripts/configure.in =================================================================== --- trunk/tools/scripts/configure.in 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/scripts/configure.in 2006-08-08 08:51:11 UTC (rev 1280) @@ -4,7 +4,7 @@ AC_INIT(ccm-scripts.spec.in) VERSION=6.3.0 -RELEASE=1 +RELEASE=2 AM_INIT_AUTOMAKE(ccm-scripts, $VERSION) AC_SUBST(RELEASE) Modified: trunk/tools/scripts/pkg/dist/rpm.spec.in =================================================================== --- trunk/tools/scripts/pkg/dist/rpm.spec.in 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/scripts/pkg/dist/rpm.spec.in 2006-08-08 08:51:11 UTC (rev 1280) @@ -16,8 +16,8 @@ BuildRequires: ccm-scripts BuildRequires: perl Requires: ccm-tools +Prefix: /usr Prefix: /etc -Prefix: /usr ::CCM_RPM_DEPENDENCIES:: @@ -119,16 +119,16 @@ sed "s!$RPM_BUILD_ROOT!!" >> "$RPM_BUILD_DIR/%{name}-%{appversion}/filelist.rpm" %post -if [ -z "$RPM_INSTALL_PREFIX0" ]; then RPM_INSTALL_PREFIX0=/etc; fi -if [ -z "$RPM_INSTALL_PREFIX1" ]; then RPM_INSTALL_PREFIX1=/usr; fi +if [ -z "$RPM_INSTALL_PREFIX0" ]; then RPM_INSTALL_PREFIX0=/usr; fi +if [ -z "$RPM_INSTALL_PREFIX1" ]; then RPM_INSTALL_PREFIX1=/etc; fi -mkdir -p "${RPM_INSTALL_PREFIX0}/ccm" +mkdir -p "${RPM_INSTALL_PREFIX1}/ccm" -CCM_WEBAPP_FILE="${RPM_INSTALL_PREFIX0}/%{ccmwebappfile}" -CCM_CLASSPATH_FILE="${RPM_INSTALL_PREFIX0}/%{ccmclasspathfile}" -CCM_APP_JAR="${RPM_INSTALL_PREFIX1}/share/java/%{name}-%{version}.jar" -CCM_APP_LIBDIR="${RPM_INSTALL_PREFIX1}/share/java/%{name}-%{version}/" -CCM_APP_WEBDIR="${RPM_INSTALL_PREFIX1}/share/java/webapps/%{name}-%{version}/" +CCM_WEBAPP_FILE="${RPM_INSTALL_PREFIX1}/%{ccmwebappfile}" +CCM_CLASSPATH_FILE="${RPM_INSTALL_PREFIX1}/%{ccmclasspathfile}" +CCM_APP_JAR="${RPM_INSTALL_PREFIX0}/share/java/%{name}-%{version}.jar" +CCM_APP_LIBDIR="${RPM_INSTALL_PREFIX0}/share/java/%{name}-%{version}/" +CCM_APP_WEBDIR="${RPM_INSTALL_PREFIX0}/share/java/webapps/%{name}-%{version}/" export CCM_WEBAPP_FILE export CCM_CLASSPATH_FILE export CCM_APP_JAR @@ -163,7 +163,7 @@ [ -d "$CCM_APP_WEBDIR" ] && echo "$CCM_APP_WEBDIR" >> "$CCM_WEBAPP_FILE" if [ "%{version}" != "%{appversion}" ]; then - cd "${RPM_INSTALL_PREFIX1}/share/java" + cd "${RPM_INSTALL_PREFIX0}/share/java" for extension in .jar -sql.jar -pdl.jar -system.jar ""; do if [ -e "%{name}-%{version}$extension" ]; then if [ ! -e "%{name}-%{appversion}$extension" ] || [ -h "%{name}-%{appversion}$extension" ]; then @@ -176,14 +176,14 @@ exit 0 %postun -if [ -z "$RPM_INSTALL_PREFIX0" ]; then RPM_INSTALL_PREFIX0=/etc; fi -if [ -z "$RPM_INSTALL_PREFIX1" ]; then RPM_INSTALL_PREFIX1=/usr; fi +if [ -z "$RPM_INSTALL_PREFIX0" ]; then RPM_INSTALL_PREFIX0=/usr; fi +if [ -z "$RPM_INSTALL_PREFIX1" ]; then RPM_INSTALL_PREFIX1=/etc; fi -CCM_WEBAPP_FILE="${RPM_INSTALL_PREFIX0}/%{ccmwebappfile}" -CCM_CLASSPATH_FILE="${RPM_INSTALL_PREFIX0}/%{ccmclasspathfile}" -CCM_APP_JAR="${RPM_INSTALL_PREFIX1}/share/java/%{name}-%{version}.jar" -CCM_APP_LIBDIR="${RPM_INSTALL_PREFIX1}/share/java/%{name}-%{version}/" -CCM_APP_WEBDIR="${RPM_INSTALL_PREFIX1}/share/java/webapps/%{name}-%{version}/" +CCM_WEBAPP_FILE="${RPM_INSTALL_PREFIX1}/%{ccmwebappfile}" +CCM_CLASSPATH_FILE="${RPM_INSTALL_PREFIX1}/%{ccmclasspathfile}" +CCM_APP_JAR="${RPM_INSTALL_PREFIX0}/share/java/%{name}-%{version}.jar" +CCM_APP_LIBDIR="${RPM_INSTALL_PREFIX0}/share/java/%{name}-%{version}/" +CCM_APP_WEBDIR="${RPM_INSTALL_PREFIX0}/share/java/webapps/%{name}-%{version}/" export CCM_WEBAPP_FILE export CCM_CLASSPATH_FILE export CCM_APP_JAR Modified: trunk/tools/scripts/pkg/dist/rpm.spec.java-standalone.in =================================================================== --- trunk/tools/scripts/pkg/dist/rpm.spec.java-standalone.in 2006-07-28 07:29:18 UTC (rev 1279) +++ trunk/tools/scripts/pkg/dist/rpm.spec.java-standalone.in 2006-08-08 08:51:11 UTC (rev 1280) @@ -13,8 +13,8 @@ BuildRequires: ccm-scripts BuildRequires: perl Requires: ccm-tools +Prefix: /usr Prefix: /etc -Prefix: /usr ::CCM_RPM_DEPENDENCIES:: |
From: <cgy...@vh...> - 2006-07-28 07:35:28
|
Author: cgyg9330 Date: 2006-07-28 09:29:18 +0200 (Fri, 28 Jul 2006) New Revision: 1279 Modified: trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig_parameter.properties Log: Integrated SF Patch [1466391] option to disable background tasks (NB - currently code that uses timers doesn't refer to this parameter, but should be upgraded. This can prevent contention on multiple server implementations when background tasks try to carry out the same action at the same time Modified: trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java 2006-07-27 09:12:09 UTC (rev 1278) +++ trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java 2006-07-28 07:29:18 UTC (rev 1279) @@ -62,6 +62,7 @@ private final Parameter m_queryCacheSize; private final Parameter m_threadTagging; private final Parameter m_resultSetWindowSize; + private final Parameter m_runBackgroundTasks; /** * Constructs an empty RuntimeConfig object. @@ -85,6 +86,10 @@ m_resultSetWindowSize = new IntegerParameter ("waf.runtime.jdbc_resultset_windowsize", Parameter.REQUIRED, new Integer(1)); + m_runBackgroundTasks = new BooleanParameter + ("waf.runtime.run_background_tasks", + Parameter.REQUIRED, + Boolean.TRUE); register(m_url); register(m_poolSize); @@ -92,6 +97,7 @@ register(m_queryCacheSize); register(m_threadTagging); register(m_resultSetWindowSize); + register(m_runBackgroundTasks); loadInfo(); } @@ -136,5 +142,7 @@ public final boolean isThreadTaggingEnabled() { return ((Boolean)get(m_threadTagging)).booleanValue(); } - + public final boolean runBackGroundTasks() { + return ((Boolean)get(m_runBackgroundTasks)).booleanValue(); + } } Modified: trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig_parameter.properties =================================================================== --- trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig_parameter.properties 2006-07-27 09:12:09 UTC (rev 1278) +++ trunk/ccm-core/src/com/arsdigita/runtime/RuntimeConfig_parameter.properties 2006-07-28 07:29:18 UTC (rev 1279) @@ -14,3 +14,7 @@ waf.runtime.jdbc_resultset_windowsize.purpose=Number of result set rows kept in memory, 0=keep all rows in memory waf.runtime.jdbc_resultset_windowsize.example=1 waf.runtime.jdbc_resultset_windowsize.format=[number] +waf.runtime.run_background_tasks.title=Run scheduled background tasks +waf.runtime.run_background_tasks.purpose=Specify whether scheduled tasks should run on this server +waf.runtime.run_background_tasks.example=true|false +waf.runtime.run_background_tasks.format=[boolean] |
From: <cgy...@vh...> - 2006-07-27 11:24:04
|
Author: cgyg9330 Date: 2006-07-27 11:07:46 +0200 (Thu, 27 Jul 2006) New Revision: 1275 Modified: trunk/ccm-core/pdl/com/arsdigita/workflow/Workflow.pdl Log: Integrated SF patch [ 1528409 ] Make workflow-task association 2-way Modified: trunk/ccm-core/pdl/com/arsdigita/workflow/Workflow.pdl =================================================================== --- trunk/ccm-core/pdl/com/arsdigita/workflow/Workflow.pdl 2006-07-25 13:18:02 UTC (rev 1274) +++ trunk/ccm-core/pdl/com/arsdigita/workflow/Workflow.pdl 2006-07-27 09:07:46 UTC (rev 1275) @@ -26,10 +26,17 @@ BigDecimal[0..1] processDefinitionID = cw_processes.process_def_id INTEGER; String[0..1] processState = cw_processes.process_state VARCHAR(16); composite ACSObject[0..1] object = join cw_processes.object_id to acs_objects.object_id; + + reference key (cw_processes.process_id); +} + +association { component Task[0..n] wfTasks = join cw_processes.process_id to cw_tasks.parent_task_id; + composite Workflow [0..1] taskWf = join cw_tasks.parent_task_id + to cw_processes.process_id; - reference key (cw_processes.process_id); + } |
From: <cgy...@vh...> - 2006-07-27 11:21:40
|
Author: cgyg9330 Date: 2006-07-27 11:09:51 +0200 (Thu, 27 Jul 2006) New Revision: 1276 Added: trunk/ccm-core/src/com/arsdigita/packaging/Program.java trunk/ccm-core/src/com/arsdigita/packaging/ProgramErrorReport.java Modified: trunk/ccm-core/src/com/arsdigita/workflow/simple/Engine.java trunk/ccm-core/src/com/arsdigita/workflow/simple/Task.java trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java trunk/ccm-core/src/com/arsdigita/workflow/simple/Workflow.java Log: Integrated SF patch [ 1528409 ] Allow other packages to implement task engines Added: trunk/ccm-core/src/com/arsdigita/packaging/Program.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/packaging/Program.java 2006-07-27 09:07:46 UTC (rev 1275) +++ trunk/ccm-core/src/com/arsdigita/packaging/Program.java 2006-07-27 09:09:51 UTC (rev 1276) @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of + * the License at http://www.redhat.com/licenses/ccmpl.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + */ + +package com.arsdigita.packaging; + +import com.arsdigita.runtime.Startup; + +import org.apache.commons.cli.Options; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.ParseException; +import org.apache.commons.cli.CommandLine; + +import java.io.OutputStream; +import java.io.PrintWriter; + +/** + * <p> + * Provides base framework for writing command line + * programs that require the CCM context to be be + * initialized. It also integrates the Apache Commons + * CLI package for simple command line argument handling. + * </p> + * <p> + * As an example usage scenario for this class, + * consider a tool that prints out the current + * sitemap. This would be implemented as follows: + * </p> + * + * <pre> + *public class SiteMapList extends Program { + * + * public SiteMapList() { + * super("Site Map Listing" + * "1.0.0", + * ""); + * } + * + * protected void doRun(CommandLine cmdLine) { + * ApplicationCollection apps = + * Application.retrieveAllApplications(); + * apps.addOrder("primaryURL"); + * + * while (apps.next()) { + * Application app = apps.getApplication(); + * + * System.out.println(app.getPath() + " -> " + + * app.getApplicationType().getTitle()); + * + * if (isVerbose()) { + * System.out.println(" Description: " + + * app.getApplicationType().getDescription()); + * } + * if (isDebug()) { + * System.out.println(" Class: " + + * app.getClass()); + * } + * } + * } + * + * public static void main(String[] args) { + * new SiteMapList().run(args); + * } + *} + * </pre> + * + */ +public abstract class Program { + + private String m_name; + private String m_version; + private String m_usage; + private boolean m_verbose = false; + private boolean m_debug = false; + private boolean m_startup = true; + + private Options m_options; + + /** + * Creates a new program. The conventions for the + * usage parameter follow the GNU style guidelines. + * For example, if there are multiple source files + * and one destination, it would be "SOURCE... DEST". + * Standard WAF startup procedures will be performed + * before the doRun method is executed. + * @param name the program name + * @param version the version string + * @param usage for any non-option command line arguments + */ + public Program(String name, + String version, + String usage) { + this(name, version, usage, true); + } + + /** + * Creates a new program. The conventions for the + * usage parameter follow the GNU style guidelines. + * For example, if there are multiple source files + * and one destination, it would be "SOURCE... DEST" + * @param name the program name + * @param version the version string + * @param usage for any non-option command line arguments + * @param startup true to perform standard WAF startup + */ + public Program(String name, + String version, + String usage, + boolean startup) { + m_name = name; + m_version = version; + m_usage = usage; + m_startup = startup; + m_options = new Options(); + + m_options.addOption + (OptionBuilder + .hasArg(false) + .withLongOpt("help") + .withDescription("Print this message") + .create('?')); + m_options.addOption + (OptionBuilder + .hasArg(false) + .withLongOpt("version") + .withDescription("Print version information") + .create('V')); + m_options.addOption + (OptionBuilder + .hasArg(false) + .withLongOpt("verbose") + .withDescription("Generate verbose output") + .create('v')); + m_options.addOption + (OptionBuilder + .hasArg(false) + .withLongOpt("debug") + .withDescription("Generate debugging output") + .create('D')); + } + + /** + * Retrieves the version for this program + * @return the version string + */ + public String getVersion() { + return m_version; + } + + /** + * Retrieves the program name + * @return the program name + */ + public String getName() { + return m_name; + } + + /** + * Retrieves the usage for non-option command + * line arguments + * @return the command usage + */ + public String getUsage() { + return m_usage; + } + + /** + * Retrieves the command line options configuration + * @return the command line options + */ + public Options getOptions() { + return m_options; + } + + /** + * Determines if the program should generate verbose + * output. Verbose output is information that is + * useful to end users of the program. + * @return true if verbose output is required + */ + public boolean isVerbose() { + return m_verbose; + } + + /** + * Determines if the program should generate debug + * output. Debug output is information that is useful + * to programmers or system administrators. + * @return true if debug output is required + */ + public boolean isDebug() { + return m_debug; + } + + /** + * Runs the program. First off all the command line + * arguments are first parsed. If the --help or + * --version arguments were specified then this + * information is output and execution stops. + * Otherwise, the CCM startup process is invoked + * and then finally the doRun method is run. + * @param args the command line arguments to parse + */ + public final void run(String[] args) { + CommandLine cmdLine = null; + try { + cmdLine = new GnuParser().parse(m_options, + args); + } catch (ParseException ex) { + help(System.err); + System.exit(1); + } + + if (cmdLine.hasOption("?")) { + help(System.out); + System.exit(0); + } else if (cmdLine.hasOption("V")) { + System.out.println(m_version); + System.exit(0); + } + + m_verbose = cmdLine.hasOption("v"); + m_debug = cmdLine.hasOption("D"); + + try { + if (m_startup) { + Startup startup = new Startup(); + startup.run(); + } + + doRun(cmdLine); + + System.exit(0); + } catch (Throwable t) { + System.err.println("Error: " + t.getClass() + + ":" + t.getMessage()); + if (isDebug()) { + ProgramErrorReport report = + new ProgramErrorReport(t, args); + report.logit(); + } else if (isVerbose()) { + t.printStackTrace(System.err); + } + System.exit(1); + } + } + + /** + * This method should be implemented by subclasses + * to do whatever processing they require. + * @param cmdLine the parsed command line + */ + protected abstract void doRun(CommandLine cmdLine); + + /** + * Sends a command line help usage message to the + * output stream + * @param os the destination stream + */ + public void help(OutputStream os) { + HelpFormatter fmt = new HelpFormatter(); + PrintWriter w = new PrintWriter(os); + fmt.printHelp(w, 80, + "ccm-run " + getClass().getName() + + " [OPTION]... " + getUsage(), + "\nOptions:", + getOptions(), + 2, 4, null, false); + w.flush(); + } +} Added: trunk/ccm-core/src/com/arsdigita/packaging/ProgramErrorReport.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/packaging/ProgramErrorReport.java 2006-07-27 09:07:46 UTC (rev 1275) +++ trunk/ccm-core/src/com/arsdigita/packaging/ProgramErrorReport.java 2006-07-27 09:09:51 UTC (rev 1276) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of + * the License at http://www.redhat.com/licenses/ccmpl.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + */ + +package com.arsdigita.packaging; + +import com.arsdigita.logging.ErrorReport; + +public class ProgramErrorReport extends ErrorReport { + + public ProgramErrorReport(Throwable throwable, + String[] args) { + super(throwable); + + try { + addArgs(args); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + private void addArgs(String[] args) { + addSection("Command line arguments", + args); + } +} Modified: trunk/ccm-core/src/com/arsdigita/workflow/simple/Engine.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/workflow/simple/Engine.java 2006-07-27 09:07:46 UTC (rev 1275) +++ trunk/ccm-core/src/com/arsdigita/workflow/simple/Engine.java 2006-07-27 09:09:51 UTC (rev 1276) @@ -19,25 +19,32 @@ package com.arsdigita.workflow.simple; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.math.BigDecimal; import java.util.Date; import com.arsdigita.kernel.User; import com.arsdigita.kernel.Group; import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectInstantiator; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObject; +import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.Session; import com.arsdigita.persistence.Filter; import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; +import com.arsdigita.util.Assert; import com.arsdigita.util.UncheckedWrapperException; // Support for Logging. @@ -46,33 +53,85 @@ /** * Class representing the workflow engine. * + * Also implements an engine factory. The factory functionality was implemented here rather in a separate class + * to enable existing clients to retrieve a simple engine using the same static call + * * @version $Revision: #13 $ $DateTime: 2004/08/16 18:10:38 $ */ public class Engine { public static final String versionId = "$Id$ by $Author$, $DateTime: 2004/08/16 18:10:38 $"; + private static final Logger s_log = Logger.getLogger(Engine.class); + public static final String SIMPLE_ENGINE_TYPE = "simple"; + + +/* + * *************************************************** + * + * FACTORY IMPLEMENTATION + * + * *************************************************** + */ + + private static Map s_engines = new HashMap(); - private static Engine s_engine = null; /** - * Gets an instance of the workflow engine. - * @return an instance of the workflow engine. + * gets an instance of Engine or subtypes according to the passed in string. Subtypes must + * be registered before attempting to get an instance using registerEngine + * @param type + * @return */ + public static Engine getInstance(String type) { + Engine engine = (Engine)s_engines.get(type); + // lazy initialization for the simple engine + // 2 threads might enter this if block and instantiate new + // engines, but a check is made within synchronised method + // when attempting to register engine. Didn't want to + // synchronise in this method because of potential bottleneck + if (engine == null && type.equals(SIMPLE_ENGINE_TYPE)) { + engine = new Engine(); + Engine.registerEngine(SIMPLE_ENGINE_TYPE, engine); + } + // if null, then no engine registered for the type + Assert.exists(engine); + return engine; + + } + + // synchronized to prevent 2 threads invoking registerInstantiators and hence attempting double registration + // by the time any blocked thread gets into method, s_engines won't be empty + public static synchronized void registerEngine(String engineType, Engine engine){ + s_log.debug("registering task engine for " + engineType); + if (s_engines.isEmpty()){ + s_log.debug("First Engine registered - registering task domainObjectInstantiators"); + registerInstantiators(); + } + if (s_engines.get(engineType) == null) { + s_engines.put(engineType, engine); + } + } - public static synchronized Engine getInstance() { - if (s_engine == null) - s_engine = new Engine(); + /** + * Gets an instance of the simple workflow engine. + * @return an instance of the simple workflow engine. + */ + // legacy method of retrieving a simple Engine + public static Engine getInstance() { + return getInstance(SIMPLE_ENGINE_TYPE); - return s_engine; } + + + /** * Constructor: Set up the instantiators for subclasses of task */ - Engine() { + private static void registerInstantiators() { DomainObjectInstantiator instTask = new ACSObjectInstantiator() { public DomainObject doNewInstance(DataObject dataObject) { return new Task(dataObject); @@ -118,6 +177,13 @@ } +/* + * ************************************************************ + * + * SIMPLE ENGINE FUNCTIONS + * + * ************************************************************ + */ /** * From the query put the assigned list into assignedTask Array List * The result set from query needs to have taskID. @@ -193,6 +259,8 @@ } } + + /** * Returns an ArrayList containing the set of enabled tasks in all * processes to which the specified user is assigned. @@ -201,7 +269,7 @@ * @return the iterator * **/ - public ArrayList getEnabledTasks(User user) { + public List getEnabledTasks(User user) { Session session = SessionManager.getSession(); @@ -227,12 +295,16 @@ return usersTask; } - public ArrayList getEnabledTasks(User user, BigDecimal workflowId) { + public List getEnabledTasks(User user, BigDecimal workflowId) { Session session = SessionManager.getSession(); // Retrieve all tasks directly assigned to // user + + + + DataQuery query = session.retrieveQuery ("com.arsdigita.workflow.simple.getTaskAssignedUsers"); query.addFilter("userID = :user_id"); @@ -267,10 +339,10 @@ * @return the array list * **/ - public ArrayList getOverdueTasks(User user) { + public List getOverdueTasks(User user) { ArrayList overdueTasks = new ArrayList(); - ArrayList enabledTasks = getEnabledTasks(user); + List enabledTasks = getEnabledTasks(user); Iterator itr = enabledTasks.iterator(); UserTask tempTask = null; @@ -295,7 +367,7 @@ * @return the iterator * **/ - public ArrayList getFinishedTasks(User user, Date start, Date end) { + public List getFinishedTasks(User user, Date start, Date end) { Session session = SessionManager.getSession(); DataQuery query = session.retrieveQuery ("com.arsdigita.workflow.simple.getTaskAssignedUsers"); @@ -333,7 +405,7 @@ * @return the iterator * **/ - public ArrayList getOverdueProcesses() { + public List getOverdueProcesses() { Session session = SessionManager.getSession(); DataQuery query = session.retrieveQuery ("com.arsdigita.workflow.simple.getOverDueProcesses"); @@ -364,7 +436,7 @@ * * @return the iterator **/ - public ArrayList getActiveProcesses() { + public List getActiveProcesses() { Session session = SessionManager.getSession(); DataQuery query = session.retrieveQuery ("com.arsdigita.workflow.simple.getActiveProcesses"); Modified: trunk/ccm-core/src/com/arsdigita/workflow/simple/Task.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/workflow/simple/Task.java 2006-07-27 09:07:46 UTC (rev 1275) +++ trunk/ccm-core/src/com/arsdigita/workflow/simple/Task.java 2006-07-27 09:09:51 UTC (rev 1276) @@ -82,14 +82,14 @@ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.workflow.simple.Task"; - static final String LABEL = "label"; - static final String DESCRIPTION = "description"; - static final String IS_ACTIVE = "isActive"; - static final String DEPENDENCY_LIST = "dependsOn"; - static final String PARENT_TASK_ID = "parentTaskID"; - static final String COMMENTS = "comments"; - static final String TASK_STATE = "taskState"; - static final String FINISHED_LISTENERS = "taskFinishedListeners"; + public static final String LABEL = "label"; + public static final String DESCRIPTION = "description"; + public static final String IS_ACTIVE = "isActive"; + public static final String DEPENDENCY_LIST = "dependsOn"; + public static final String PARENT_TASK_ID = "parentTaskID"; + public static final String COMMENTS = "comments"; + public static final String TASK_STATE = "taskState"; + public static final String FINISHED_LISTENERS = "taskFinishedListeners"; static final String DEFAULT_DESCRIPTION = "none"; static final String DEFAULT_LABEL = "none"; Modified: trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java 2006-07-27 09:07:46 UTC (rev 1275) +++ trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java 2006-07-27 09:09:51 UTC (rev 1276) @@ -71,8 +71,8 @@ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.workflow.simple.UserTask"; - private static final String ASSIGNED_USERS = "assignedUsers"; - private static final String ASSIGNED_GROUPS = "assignedGroups"; + 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"; Modified: trunk/ccm-core/src/com/arsdigita/workflow/simple/Workflow.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/workflow/simple/Workflow.java 2006-07-27 09:07:46 UTC (rev 1275) +++ trunk/ccm-core/src/com/arsdigita/workflow/simple/Workflow.java 2006-07-27 09:09:51 UTC (rev 1276) @@ -65,9 +65,11 @@ private static final Logger s_log = Logger.getLogger(Workflow.class); private OID m_ACSObjectOID = null; - private static final String ACS_OBJECT = "object"; + public static final String ACS_OBJECT = "object"; private static final String PROCESS_STATE = "processState"; private static final String WF_TASKS = "wfTasks"; + public static final String TASK_WORKFLOW = "taskWf"; + private static final String PROCESS_DEF_ID = "processDefinitionID"; // class variables, enums of constants @@ -110,6 +112,10 @@ **/ public Workflow(DataObject workflowDataObject) { super(workflowDataObject); + DataObject object = (DataObject)get(ACS_OBJECT); + if (object != null) { + m_ACSObjectOID = object.getOID(); + } } /** |
From: <cgy...@vh...> - 2006-07-27 11:20:57
|
Author: cgyg9330 Date: 2006-07-27 11:11:04 +0200 (Thu, 27 Jul 2006) New Revision: 1277 Modified: trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java Log: Integrated SF patch [ 1528409 ] Deprecate Program - moved to ccm-core Modified: trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java =================================================================== --- trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java 2006-07-27 09:09:51 UTC (rev 1276) +++ trunk/ccm-ldn-util/src/com/arsdigita/london/util/Program.java 2006-07-27 09:11:04 UTC (rev 1277) @@ -31,6 +31,10 @@ import java.io.PrintWriter; /** + * + * @deprecated - use {@link com.arsdigita.packaging.Program} + * + * * <p> * Provides base framework for writing command line * programs that require the CCM context to be be Modified: trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java =================================================================== --- trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java 2006-07-27 09:09:51 UTC (rev 1276) +++ trunk/ccm-ldn-util/src/com/arsdigita/london/util/ProgramErrorReport.java 2006-07-27 09:11:04 UTC (rev 1277) @@ -20,6 +20,11 @@ import com.arsdigita.logging.ErrorReport; +/** + * + * @deprecated - use {@link com.arsdigita.packaging.ProgramErrorReport} + * + */ public class ProgramErrorReport extends ErrorReport { public ProgramErrorReport(Throwable throwable, |
Author: cgyg9330 Date: 2006-07-27 11:12:09 +0200 (Thu, 27 Jul 2006) New Revision: 1278 Added: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.3.3-6.3.4/ trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.3.3-6.3.4/add_approve_item_privilege.sql trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/ trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_url_generator_table.sql trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.3-6.3.4.sql trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.3-6.3.4.sql trunk/ccm-cms/src/com/arsdigita/cms/ui/DataCollectionOptionPrintListener.java trunk/ccm-cms/src/com/arsdigita/cms/workflow/AddApprovePermission.java trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSEngine.java trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSTaskType.java trunk/ccm-cms/src/com/arsdigita/cms/workflow/PublishedItemURLGenerator.java trunk/ccm-cms/src/com/arsdigita/cms/workflow/TaskEventURLGenerator.java Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl trunk/ccm-cms/src/ccm-cms.upgrade trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java trunk/ccm-cms/src/com/arsdigita/cms/SecurityManager.java trunk/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java trunk/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/ApplyWorkflowFormSection.java trunk/ccm-cms/src/com/arsdigita/cms/ui/item/Summary.java trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleItemPane.java trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/TaskPortletRenderer.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskSection.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/BaseTaskForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskAddForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskEditForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskFinishForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskItemPane.java trunk/ccm-cms/src/com/arsdigita/cms/util/SecurityConstants.java trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java Log: Integrated SF patch [ 1528409 ] Associate task types with specific privileges Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl =================================================================== --- trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/pdl/com/arsdigita/content-section/CMSTask.pdl 2006-07-27 09:12:09 UTC (rev 1278) @@ -1,33 +1,54 @@ // // Copyright (C) 2001-2004 Red Hat Inc. 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. +// The contents of this file are subject to the CCM Public +// License (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the +// License at http://www.redhat.com/licenses/ccmpl.html. // -// 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. +// Software distributed under the License is distributed on an +// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +// or implied. See the License for the specific language governing +// rights and limitations under the License. // -// 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 -// -// $Id$ -// $DateTime: 2004/08/17 23:15:09 $ +// $Id$ +// $DateTime: 2004/04/07 16:07:11 $ model com.arsdigita.cms.workflow; import com.arsdigita.workflow.simple.*; import com.arsdigita.kernel.ACSObject; object type CMSTask extends UserTask { - BigDecimal taskType = cms_tasks.task_type_id INTEGER; + composite CMSTaskType [1..1] taskType = join cms_tasks.task_type_id to cms_task_types.task_type_id; reference key (cms_tasks.task_id); } +object type CMSTaskType { + Integer [1..1] taskTypeID = cms_task_types.task_type_id INTEGER; + String [1..1] name = cms_task_types.name VARCHAR(64); + String [1..1] defaultUrlGeneratorClass = cms_task_types.classname VARCHAR(128); + String [1..1] privilege = cms_task_types.privilege VARCHAR(200); + + object key (taskTypeID); +} + + +object type TaskEventURLGenerator { + Integer [1..1] generatorID = cms_task_url_generators.generator_id INTEGER; + String [1..1] event = cms_task_url_generators.event VARCHAR(100); + String [1..1] urlGeneratorClass = cms_task_url_generators.classname VARCHAR(128); + + object key (generatorID); + +} + +association { + + TaskEventURLGenerator [0..n] generators = join cms_task_types.task_type_id to cms_task_url_generators.task_type_id; + CMSTaskType [1..1] taskType = join cms_task_url_generators.task_type_id to cms_task_types.task_type_id; +} + query getItemFromTask { ACSObject obj; Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl =================================================================== --- trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl 2006-07-27 09:12:09 UTC (rev 1278) @@ -43,6 +43,7 @@ cw_tasks.label, cw_tasks.description, cms_task_types.classname, + cms_tasks.task_type_id as typeID, cms_task_types.name as taskname, CASE WHEN (cw_user_tasks.is_locked is not null) THEN ( cw_user_tasks.is_locked ) @@ -100,7 +101,7 @@ pageName = cms_pages.name; pageTitle = cms_pages.title; lockingUserID = cw_user_tasks.locking_user_id; - taskType = taskname; + taskType = typeID; taskTypeClass = cms_task_types.classname; status = status; processLabel = processLabel; Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl =================================================================== --- trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl 2006-07-27 09:12:09 UTC (rev 1278) @@ -43,6 +43,7 @@ cw_tasks.label, cw_tasks.description, cms_task_types.classname, + cms_tasks.task_type_id as typeID, cms_task_types.name as taskname, CASE WHEN (cw_user_tasks.is_locked is not null) THEN ( cw_user_tasks.is_locked ) @@ -100,7 +101,7 @@ pageName = cms_pages.name; pageTitle = cms_pages.title; lockingUserID = cw_user_tasks.locking_user_id; - taskType = taskname; + taskType = typeID; taskTypeClass = cms_task_types.classname; status = status; processLabel = processLabel; Added: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.3.3-6.3.4/add_approve_item_privilege.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.3.3-6.3.4/add_approve_item_privilege.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.3.3-6.3.4/add_approve_item_privilege.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,23 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: add_approve_item_privilege.sql,v 1.1 2006/06/08 14:28:12 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +insert into acs_privileges (privilege) +values ('cms_approve_item'); + + + +insert into cms_privileges (privilege, pretty_name, sort_order, scope) + values ('cms_approve_item', 'Approve Items', 69, 'item'); \ No newline at end of file Added: trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,30 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: add_task_type_privileges.sql,v 1.1 2006/06/08 14:28:12 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +alter table cms_task_types +ADD (privilege VARCHAR2(200)); + +update cms_task_types +set privilege = 'cms_edit_item' +where name = 'Author'; + +update cms_task_types +set privilege = 'cms_approve_item' +where name = 'Edit'; + +update cms_task_types +set privilege = 'cms_publish' +where name = 'Deploy'; \ No newline at end of file Added: trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_url_generator_table.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_url_generator_table.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.3-6.3.4/add_url_generator_table.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,24 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: add_url_generator_table.sql,v 1.1 2006/06/08 14:28:12 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +create table cms_task_url_generators + (generator_id NUMBER NOT NULL, + task_type_id NUMBER, + event VARCHAR2(100), + classname VARCHAR2 (128), + CONSTRAINT cms_task_url_generator_pk PRIMARY KEY (generator_id), + CONSTRAINT cms_url_gen_task_type_fk FOREIGN KEY (task_type_id) REFERENCES cms_task_types (task_type_id)); + \ No newline at end of file Added: trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,30 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: add_task_type_privileges.sql,v 1.1 2006/06/08 14:28:12 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +alter table cms_task_types +ADD (privilege VARCHAR(200)); + +update cms_task_types +set privilege = 'cms_edit_item' +where name = 'Author'; + +update cms_task_types +set privilege = 'cms_approve_item' +where name = 'Edit'; + +update cms_task_types +set privilege = 'cms_publish' +where name = 'Deploy'; \ No newline at end of file Added: trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,24 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: add_url_generator_table.sql,v 1.1 2006/06/08 14:28:12 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +create table cms_task_url_generators + (generator_id NUMBER NOT NULL, + task_type_id NUMBER, + event VARCHAR(100), + classname VARCHAR (128), + CONSTRAINT cms_task_url_generator_pk PRIMARY KEY (generator_id), + CONSTRAINT cms_url_gen_task_type_fk FOREIGN KEY (task_type_id) REFERENCES cms_task_types (task_type_id)); + \ No newline at end of file Added: trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.3-6.3.4.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.3-6.3.4.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.3-6.3.4.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,23 @@ +-- +-- Copyright (C) 2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: oracle-se-6.0.1-6.1.0.sql,v 1.1 2004/12/15 14:28:03 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +PROMPT Red Hat Enterprise CMS 6.3.3 -> 6.3.4 Upgrade Script (Oracle) + +@@ ../default/upgrade/6.3.3-6.3.4/add_approve_item_privilege.sql +@@ ../oracle-se/upgrade/6.3.3-6.3.4/add_url_generator_table.sql +@@ ../oracle-se/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql + +commit; \ No newline at end of file Added: trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.3-6.3.4.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.3-6.3.4.sql 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.3-6.3.4.sql 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,26 @@ +-- +-- Copyright (C) 2004 Red Hat Inc. All Rights Reserved. +-- +-- The contents of this file are subject to the CCM Public +-- License (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the +-- License at http://www.redhat.com/licenses/ccmpl.html. +-- +-- Software distributed under the License is distributed on an +-- "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express +-- or implied. See the License for the specific language governing +-- rights and limitations under the License. +-- +-- $Id: postgres-6.0.1-6.1.0.sql,v 1.1 2004/12/15 14:28:03 awux7820 Exp $ +-- $DateTime: 2004/04/07 16:07:11 $ + +\echo Red Hat Enterprise CMS 6.3.3 -> 6.3.4 Upgrade Script (PostgreSQL) + +begin; + +\i ../default/upgrade/6.3.3-6.3.4/add_approve_item_privilege.sql +\i ../postgres/upgrade/6.3.3-6.3.4/add_url_generator_table.sql +\i ../postgres/upgrade/6.3.3-6.3.4/add_task_type_privileges.sql + + +commit; Modified: trunk/ccm-cms/src/ccm-cms.upgrade =================================================================== --- trunk/ccm-cms/src/ccm-cms.upgrade 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/ccm-cms.upgrade 2006-07-27 09:12:09 UTC (rev 1278) @@ -20,5 +20,9 @@ <version from="6.3.1" to="6.3.2"> <script sql="ccm-cms/upgrade/::database::-6.3.1-6.3.2.sql"/> </version> - + <!-- 6.3.2 to 6.3.3 to be merged - support for oracle xml path + search - chris gilbert --> + <version from="6.3.3" to="6.3.4"> + <script sql="ccm-cms/upgrade/::database::-6.3.3-6.3.4.sql"/> + </version> </upgrade> Modified: trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -35,7 +35,10 @@ import com.arsdigita.cms.search.LaunchDateFilterType; import com.arsdigita.cms.search.LuceneQueryEngine; import com.arsdigita.cms.search.VersionFilterType; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; +import com.arsdigita.cms.workflow.TaskEventURLGenerator; import com.arsdigita.domain.xml.TraversalHandler; import com.arsdigita.db.DbHelper; import com.arsdigita.domain.DataObjectNotFoundException; @@ -64,6 +67,7 @@ import com.arsdigita.search.filters.PermissionFilterType; import com.arsdigita.search.filters.CategoryFilterType; import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.workflow.simple.Engine; import com.arsdigita.workflow.simple.Workflow; import com.arsdigita.workflow.simple.WorkflowTemplate; import com.arsdigita.search.filters.ContentSectionFilterType; @@ -158,6 +162,10 @@ registerLuceneEngine(); registerIntermediaEngine(); registerPatternGenerators(); + + // cg - register Task Retrieval engine + + Engine.registerEngine(CMSEngine.CMS_ENGINE_TYPE, new CMSEngine()); // register item adapters XML.parse(ContentSection.getConfig().getItemAdapters(), @@ -211,6 +219,23 @@ } }); f.registerInstantiator + (CMSTaskType.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new CMSTaskType(dataObject); + } + }); + f.registerInstantiator + (TaskEventURLGenerator.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new TaskEventURLGenerator(dataObject); + } + }); + + + + f.registerInstantiator (Workflow.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() { public DomainObject doNewInstance(DataObject dataObject) { Modified: trunk/ccm-cms/src/com/arsdigita/cms/SecurityManager.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/SecurityManager.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/SecurityManager.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -21,7 +21,9 @@ import com.arsdigita.cms.dispatcher.SimpleCache; import com.arsdigita.cms.publishToFile.LocalRequestPassword; import com.arsdigita.cms.util.SecurityConstants; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Party; @@ -349,7 +351,7 @@ return hasPermission(user, CMS_ITEM_ADMIN, item); } - Engine engine = Engine.getInstance(); + Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator(); while (i.hasNext()) { @@ -388,12 +390,12 @@ wf.isFinished()) { return true; } else { - Engine engine = Engine.getInstance(); + Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator(); int j =0; while (i.hasNext()) { CMSTask t = (CMSTask) i.next(); - if (t.getTaskType().equals(CMSTask.DEPLOY)) { + if (t.getTaskType().getID().equals(CMSTaskType.DEPLOY)) { return true; } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -31,6 +31,7 @@ import com.arsdigita.cms.lifecycle.PhaseDefinition; import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.cms.workflow.UnfinishedTaskNotifier; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObject; @@ -228,7 +229,7 @@ if (author != null) authoring.assignGroup(author.getGroup()); - authoring.setTaskType(CMSTask.AUTHOR); + authoring.setTaskType(CMSTaskType.retrieve(CMSTaskType.AUTHOR)); authoring.save(); CMSTask approval = new CMSTask(); @@ -242,7 +243,7 @@ if (approver != null) approval.assignGroup(approver.getGroup()); - approval.setTaskType(CMSTask.EDIT); + approval.setTaskType(CMSTaskType.retrieve(CMSTaskType.EDIT)); approval.save(); @@ -257,7 +258,7 @@ if (publisher != null) deploy.assignGroup(publisher.getGroup()); - deploy.setTaskType(CMSTask.DEPLOY); + deploy.setTaskType(CMSTaskType.retrieve(CMSTaskType.DEPLOY)); deploy.save(); wf.addTask(authoring); Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/DataCollectionOptionPrintListener.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/DataCollectionOptionPrintListener.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/DataCollectionOptionPrintListener.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. + * + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the + * License at http://www.redhat.com/licenses/ccmpl.html. + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language + * governing rights and limitations under the License. + * + */ +package com.arsdigita.cms.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.OptionGroup; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataQuery; + +public abstract class DataCollectionOptionPrintListener implements PrintListener { + + public static final String versionId = "$Id: DataQueryOptionPrintListener.java,v 1.1 2004/12/15 14:27:54 awux7820 Exp $ by $Author: awux7820 $, $DateTime: 2004/04/07 16:07:11 $"; + + public DataCollectionOptionPrintListener() { + } + + protected abstract DataCollection getDataCollection (PageState s); + + public void prepare(PrintEvent e) { + PageState s = e.getPageState(); + OptionGroup w = (OptionGroup) e.getTarget(); + DataCollection collection = getDataCollection(s); + while (collection.next()) { + DomainObject object = DomainObjectFactory.newInstance(collection.getDataObject()); + w.addOption(new Option(getKey(object), + getValue(object))); + } + } + + public abstract String getKey(DomainObject d); + + public String getValue(DomainObject d) { + return getKey(d); + } +} Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/TasksPanel.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -19,8 +19,19 @@ package com.arsdigita.cms.ui; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Iterator; + +import javax.servlet.ServletException; + +import org.apache.log4j.Logger; + import com.arsdigita.bebop.ActionLink; import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Image; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; @@ -28,6 +39,7 @@ import com.arsdigita.bebop.Paginator; import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.SimpleComponent; +import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionListener; import com.arsdigita.bebop.event.ChangeEvent; @@ -35,10 +47,6 @@ import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.parameters.StringParameter; -import com.arsdigita.bebop.ControlLink; -import com.arsdigita.bebop.ControlLink; -import com.arsdigita.bebop.SimpleContainer; -import com.arsdigita.bebop.Image; import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentSection; @@ -46,8 +54,10 @@ import com.arsdigita.cms.Folder; import com.arsdigita.cms.ui.authoring.CreationSelector; import com.arsdigita.cms.ui.folder.FolderSelectionModel; -import com.arsdigita.cms.util.SecurityConstants; +import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.kernel.Kernel; @@ -69,16 +79,7 @@ import com.arsdigita.workflow.simple.Engine; import com.arsdigita.workflow.simple.Workflow; import com.arsdigita.xml.Element; -import com.arsdigita.cms.util.GlobalizationUtil; -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.Iterator; -import javax.servlet.ServletException; - -import org.apache.log4j.Logger; - public class TasksPanel extends CMSContainer { public static final String versionId = "$Id$ by $Author$, $DateTime: 2004/08/17 23:15:09 $"; @@ -374,17 +375,19 @@ FilterFactory ff = query.getFilterFactory(); // TODO: remove this hard coding of "Author", "Edit", and "Deploy" + // TODO: remove this hard coding of "Author", "Edit", and "Deploy" CompoundFilter authorFilter = ff.and(); - authorFilter.addFilter(ff.equals("taskType","Author")); - authorFilter.addFilter(getTaskFilter("Author", party, ff)); + //cg query changed to refer to task type id + authorFilter.addFilter(ff.equals("taskType",CMSTaskType.AUTHOR)); + authorFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.AUTHOR), party, ff)); CompoundFilter approveFilter = ff.and(); - approveFilter.addFilter(ff.equals("taskType","Edit")); - approveFilter.addFilter(getTaskFilter("Edit", party, ff)); + approveFilter.addFilter(ff.equals("taskType",CMSTaskType.EDIT)); + approveFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.EDIT), party, ff)); CompoundFilter deployFilter = ff.and(); - deployFilter.addFilter(ff.equals("taskType","Deploy")); - deployFilter.addFilter(getTaskFilter("Deploy", party, ff)); + deployFilter.addFilter(ff.equals("taskType",CMSTaskType.DEPLOY)); + deployFilter.addFilter(getTaskFilter(CMSTaskType.retrieve(CMSTaskType.DEPLOY), party, ff)); CompoundFilter permissionFilter = ff.or(); permissionFilter.addFilter(authorFilter); @@ -644,13 +647,13 @@ if ( wf != null ) { User user = Web.getContext().getUser(); - Engine engine = Engine.getInstance(); + Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator(); if (i.hasNext()) { CMSTask task = (CMSTask) i.next(); - BigDecimal taskType = task.getTaskType(); + Integer taskType = task.getTaskType().getID(); - if ( taskType.equals(CMSTask.DEPLOY) ) { + if (taskType.equals(CMSTaskType.DEPLOY) ) { tabNumber = ContentItemPage.PUBLISHING_TAB; } else { // see if item is locked; if not, lock @@ -679,18 +682,12 @@ } } - private static Filter getTaskFilter(String taskType, Party party, FilterFactory factory) { + private static Filter getTaskFilter(CMSTaskType taskType, Party party, FilterFactory factory) { PrivilegeDescriptor privilege; String queryName; String queryType; OID partyOID = party.getOID(); - if ( taskType.equals("Deploy") ) { - queryType = "deploy"; - privilege = new PrivilegeDescriptor(SecurityConstants.CMS_PUBLISH); - } else { - queryType = "edit"; - privilege = new PrivilegeDescriptor(SecurityConstants.CMS_EDIT_ITEM); - } + privilege = taskType.getPrivilege(); return PermissionService.getFilterQuery(factory,"itemID",privilege,partyOID); } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/ApplyWorkflowFormSection.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/ApplyWorkflowFormSection.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/ApplyWorkflowFormSection.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -41,6 +41,7 @@ import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.SecurityConstants; import com.arsdigita.cms.ui.workflow.WorkflowsOptionPrintListener; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; import com.arsdigita.kernel.User; import com.arsdigita.persistence.Filter; @@ -211,8 +212,8 @@ workflow.setObjectID(item.getID()); workflow.start(user); - final Engine engine = Engine.getInstance(); - Assert.exists(engine, Engine.class); + final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); + Assert.exists(engine, CMSEngine.class); Iterator iter = engine.getEnabledTasks (user, workflow.getID()).iterator(); while (iter.hasNext()) { Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/item/Summary.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/item/Summary.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/item/Summary.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -31,6 +31,7 @@ import com.arsdigita.cms.lifecycle.Lifecycle; import com.arsdigita.cms.ui.CMSContainer; import com.arsdigita.cms.util.SecurityConstants; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainServiceInterfaceExposer; @@ -360,7 +361,7 @@ } // lock the next task - Engine engine = Engine.getInstance(); + Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); Iterator i = engine.getEnabledTasks(user, w.getID()).iterator(); if (i.hasNext()) { CMSTask task = (CMSTask) i.next(); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleItemPane.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleItemPane.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleItemPane.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -48,7 +48,9 @@ import com.arsdigita.cms.ui.BaseItemPane; import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.item.ContentItemRequestLocal; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import org.apache.log4j.Logger; @@ -214,7 +216,7 @@ Workflow workflow = Workflow.getObjectWorkflow( item ); if( null != workflow ) { - final Engine engine = Engine.getInstance(); + final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); final User user = Web.getContext().getUser(); final Iterator iter = engine.getEnabledTasks @@ -222,9 +224,8 @@ while (iter.hasNext()) { final CMSTask task = (CMSTask) iter.next(); - - if (task.getTaskType().equals(CMSTask.DEPLOY)) { - s_log.debug("Found DEPLOY task, ID=" + CMSTask.DEPLOY); + if (task.getTaskType().getID().equals(CMSTaskType.DEPLOY)) { + s_log.debug("Found DEPLOY task, ID=" + CMSTaskType.DEPLOY); try { task.finish(user); } catch (TaskException te) { Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -54,7 +54,9 @@ import com.arsdigita.cms.ui.item.ItemWorkflowRequestLocal; import com.arsdigita.cms.ui.workflow.WorkflowRequestLocal; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.kernel.User; import com.arsdigita.util.Assert; import com.arsdigita.util.UncheckedWrapperException; @@ -507,7 +509,7 @@ final Workflow workflow = m_workflow.getWorkflow(state); if (workflow != null) { - final Engine engine = Engine.getInstance(); + final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); final User user = Web.getContext().getUser(); final Iterator iter = engine.getEnabledTasks @@ -517,9 +519,8 @@ final CMSTask task = (CMSTask) iter.next(); if( s_log.isDebugEnabled() ) s_log.debug( "Task is " + task.getOID().toString() ); - - if (task.getTaskType().equals(CMSTask.DEPLOY)) { - s_log.debug("Found DEPLOY task, ID=" + CMSTask.DEPLOY); + if (task.getTaskType().getID().equals(CMSTaskType.DEPLOY)) { + s_log.debug("Found DEPLOY task, ID=" + CMSTaskType.DEPLOY); try { task.finish(user); } catch (TaskException te) { Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/TaskPortletRenderer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/TaskPortletRenderer.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/TaskPortletRenderer.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -1,20 +1,16 @@ /* * Copyright (C) 2003-2004 Red Hat Inc. 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. + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the + * License at http://www.redhat.com/licenses/ccmpl.html. + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language + * governing rights and limitations under the License. * - * 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.cms.ui.portlet; @@ -31,6 +27,7 @@ import com.arsdigita.cms.portlet.TaskPortlet; import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; import com.arsdigita.kernel.User; import com.arsdigita.web.URL; @@ -42,6 +39,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.Iterator; +import java.util.List; /** * @@ -49,13 +47,13 @@ * * @author Richard Li * @author Jim Parsons - * @version $Id$ + * @version $Id$ */ public class TaskPortletRenderer extends AbstractPortletRenderer { public static final String versionId = - "$Id$" + - "$Author$" + - "$DateTime: 2004/08/17 23:15:09 $"; + "$Id$" + + "$Author$" + + "$DateTime: 2004/04/07 16:07:11 $"; private static final Logger s_log = Logger.getLogger (TaskPortletRenderer.class); @@ -102,7 +100,7 @@ return; } - ArrayList alist = Engine.getInstance().getEnabledTasks(currentUser); + List alist = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE).getEnabledTasks(currentUser); Iterator it = alist.iterator(); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskSection.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskSection.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskSection.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -26,7 +26,9 @@ import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionListener; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.toolbox.ui.ActionGroup; import com.arsdigita.toolbox.ui.Section; @@ -117,7 +119,7 @@ private class TaskListRequestLocal extends RequestLocal { protected final Object initialValue(final PageState state) { final Workflow workflow = m_flow.getWorkflow(state); - final Engine engine = Engine.getInstance(); + final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); return engine.getEnabledTasks (Web.getContext().getUser(), workflow.getID()); } @@ -172,8 +174,8 @@ } private boolean relevant(final CMSTask task) { - return task.getTaskType().equals(CMSTask.AUTHOR) - || task.getTaskType().equals(CMSTask.EDIT); + return task.getTaskType().getID().equals(CMSTaskType.AUTHOR) + || task.getTaskType().getID().equals(CMSTaskType.EDIT); } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java 2006-07-27 09:11:04 UTC (rev 1277) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/AssignedTaskTableModelBuilder.java 2006-07-27 09:12:09 UTC (rev 1278) @@ -1,20 +1,16 @@ /* * Copyright (C) 2003-2004 Red Hat Inc. 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. + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the + * License at http://www.redhat.com/licenses/ccmpl.html. * - * 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. + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language + * governing rights and limitations under the License. * - * 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.cms.ui.workflow; @@ -24,7 +20,9 @@ import com.arsdigita.bebop.table.AbstractTableModelBuilder; import com.arsdigita.bebop.table.TableModel; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSTask; +import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.util.Assert; import com.arsdigita.web.Web; @@ -36,9 +34,9 @@ class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder { public static final String versionId = - "$Id$" + - "$Author$" + - "$DateTime: 2004/08/17 23:15:09 $"; + "$Id$" + + "$Author$" + + "$DateTime: 2004/04/07 16:07:11 $"; private static final Logger s_log = Logger.getLogger (AssignedTaskTableModelBuilder.class); @@ -60,7 +58,7 @@ Model(final Workflow workflow) { Assert.exists(workflow, Workflow.class); - final Engine engine = Engine.getInstance(); + final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); Assert.exists(engine, Engine.class); @@ -93,7 +91,7 @@ case 1: return m_task.isLocked() ? Boolean.TRUE : Boolean.FALSE; case 2: - return m_task.getTaskType().equals(CMSTask.DEPLOY) ? + return m_task.getTaskType().getID().equals(CMSTaskType.DEPLOY) ? (Object) new Label("") : (Object) lz("cms.ui.workflow.task.finish"); .. |
From: <ssk...@vh...> - 2006-07-25 13:24:18
|
Author: sskracic Date: 2006-07-25 15:18:02 +0200 (Tue, 25 Jul 2006) New Revision: 1274 Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSNavigationModel.java Log: Integrated SF patch [ 1339671 ] Correct category selection. Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSNavigationModel.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSNavigationModel.java 2006-07-25 09:27:50 UTC (rev 1273) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSNavigationModel.java 2006-07-25 13:18:02 UTC (rev 1274) @@ -109,7 +109,7 @@ DataAssociation assoc = (DataAssociation)DomainServiceInterfaceExposer .get(bundle, "categories"); DataAssociationCursor categories = assoc.cursor(); - categories.addOrder("link.isDefault desc"); + categories.addOrder("assoc.isEnabled desc, link.isDefault desc"); Filter f = categories.addInSubqueryFilter( "id", "com.arsdigita.categorization.categoryIDsInSubtree" |
From: <ssk...@vh...> - 2006-07-25 09:34:01
|
Author: sskracic Date: 2006-07-25 11:27:50 +0200 (Tue, 25 Jul 2006) New Revision: 1273 Modified: trunk/ccm-core/web/packages/bebop/xsl/Link.xsl Log: Integrated SF patch [ 1376197 ] Error in aplaws 1.0.3 link picker. Modified: trunk/ccm-core/web/packages/bebop/xsl/Link.xsl =================================================================== --- trunk/ccm-core/web/packages/bebop/xsl/Link.xsl 2006-07-20 08:59:11 UTC (rev 1272) +++ trunk/ccm-core/web/packages/bebop/xsl/Link.xsl 2006-07-25 09:27:50 UTC (rev 1273) @@ -60,6 +60,29 @@ </xsl:choose> </xsl:template> + <xsl:template match="bebop:link[@class = 'title']"> + <xsl:choose> + <xsl:when test="@confirm"> + <xsl:call-template name="bebop:actionLink"/> + </xsl:when> + + <xsl:otherwise> + <a href="{@href_no_javascript}"> + <img src="{$root-context-prefix}/assets/action-generic.png" border="0" width="14" height="14"> + <xsl:attribute name="alt"> + <xsl:apply-templates/> + </xsl:attribute> + </img> + </a> + <xsl:text> </xsl:text> + <a onclick="{@onclick}"> + <xsl:copy-of select="@*[name() != 'href_no_javascript' and name() != 'onclick']"/> + <xsl:apply-templates/> + </a> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="bebop:link" xmlns:bebop="http://www.arsdigita.com/bebop/1.0"> <script LANGUAGE="JavaScript"> |
From: <ssk...@vh...> - 2006-07-20 09:05:00
|
Author: sskracic Date: 2006-07-20 10:59:11 +0200 (Thu, 20 Jul 2006) New Revision: 1272 Removed: contrib/ccm-wsx-error/test Log: Test -- ignore. Deleted: contrib/ccm-wsx-error/test |
From: <se...@vh...> - 2006-07-20 08:59:43
|
Author: sebtest Date: 2006-07-20 10:53:38 +0200 (Thu, 20 Jul 2006) New Revision: 1271 Added: contrib/ccm-wsx-error/test Log: Test. Added: contrib/ccm-wsx-error/test =================================================================== |
From: <ssk...@vh...> - 2006-07-20 08:54:11
|
Author: sskracic Date: 2006-07-20 10:48:12 +0200 (Thu, 20 Jul 2006) New Revision: 1270 Added: contrib/ccm-wsx-atomwide/ contrib/ccm-wsx-authentication/ contrib/ccm-wsx-error/ contrib/ccm-wsx-image-link-portlet/ contrib/ccm-wsx-image-link-step/ contrib/ccm-wsx-ldap-lookup/ contrib/ccm-wsx-ldap/ contrib/ccm-wsx-message-of-the-day/ contrib/ccm-wsx-news-portlet/ Log: Code contributed from West Sussex County Council. |
From: <cgy...@vh...> - 2006-07-18 13:42:31
|
Author: cgyg9330 Date: 2006-07-18 15:36:43 +0200 (Tue, 18 Jul 2006) New Revision: 1269 Added: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRendererFactory.java Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortal.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortalModelBuilder.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortlet.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRenderer.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/ApplicationSelector.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/PersistentPortal.java trunk/ccm-ldn-portal/web/packages/workspace/xsl/lib.xsl Log: Merge SF Patch 1178621 - support for stateful portlets Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortal.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortal.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortal.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -15,9 +15,12 @@ package com.arsdigita.london.portal; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.log4j.Logger; @@ -27,149 +30,160 @@ import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.bebop.portal.Portal; +import com.arsdigita.bebop.portal.PortalModel; +import com.arsdigita.bebop.portal.PortalModelBuilder; +import com.arsdigita.bebop.portal.PortletRenderer; +import com.arsdigita.london.portal.ui.PortalConstants; import com.arsdigita.london.portal.ui.PortalSelectionModel; import com.arsdigita.london.portal.ui.PortletSelectionModel; import com.arsdigita.london.portal.ui.PortletTypeSelectionModel; import com.arsdigita.london.portal.ui.WorkspaceSelectionModel; import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.metadata.ObjectType; import com.arsdigita.portal.Portlet; import com.arsdigita.portal.PortletType; import com.arsdigita.portal.PortletTypeCollection; import com.arsdigita.xml.Element; - +/** + * + * @author cgyg9330 <chr...@we...> + * @version $Id$ + * + * Dynamically render the portlets for the current portal. If any + * portlets are stateful, retrieve a renderer from cache so that the page can + * manage the state of the portlet. + * + * ONLY VALID FOR BROWSE MODE, use com.arsdigita.portal.ui.PersistentPortal for edit mode + * + * + */ public class StatefulPersistentPortal extends SimpleContainer { - private static final Logger s_log = Logger - .getLogger(StatefulPersistentPortal.class); + private static final Logger s_log = + Logger.getLogger(StatefulPersistentPortal.class); private WorkspaceSelectionModel m_workspace; - - private PortalSelectionModel m_portal; - - private PortletTypeSelectionModel m_portletType; - private PortletSelectionModel m_portlet; +private PortalModelBuilder m_portalModelBuilder; +private PortalSelectionModel m_portal; - // static to enable access from Page and PersistantPortal, and also, page is - // dirty if any instance of Portal exceeds - // current max number of stateful portlets - // public static boolean pageDirty = false; - private int m_columns; - - // make life easier - if no state allowed in edit mode then this class can - // get rid of all the editor/adder stuff - // need to make sure that default state of stateful portlets is reasonable - // added cg - /** * maps portlet type to list of empty renderers */ - private HashMap m_stateful; +private static Map m_stateful; - /** - * static map of portlet types to the number of renderers that is contained - * by any Portal - */ - public static HashMap portletTypeCount; - private Portal m_portalDisplay; - private SingleSelectionModel m_column; - public StatefulPersistentPortal(PortalSelectionModel portal) { - this(portal, "portal", 1); + this(portal, "portal"); } - - public StatefulPersistentPortal(PortalSelectionModel portal, int ncolumns) { - this(portal, "portal", ncolumns); - } - - public StatefulPersistentPortal(PortalSelectionModel portal, String name) { - this(portal, name, 1); - } - - public StatefulPersistentPortal(PortalSelectionModel portal, String name, - int columns) { - s_log.debug("IN constructor" + name + " " + columns); + /** + * Constructor is invoked when the page component hierarchy is recreated. This occurs + * a) when the first person goes to the homepage after a server restart + * b) when someone adds a stateful portlet to one of the homepage portals, which increases the + * maximum number of that portlet type that appears on any portal + * @param portal the portalSelectionModel used by the Dynamic PortalModelBuilder + * @param name + */ + public StatefulPersistentPortal( + PortalSelectionModel portal, + String name) { + s_log.debug("IN constructor" + name ); m_portal = portal; + setTag("portal:portal"); + setNamespace(PortalConstants.PORTAL_XML_NS); - m_column = new ParameterSingleSelectionModel(new IntegerParameter( - "column")); - - // retrieve empty renderers for any stateful portlets and add them to - // the component hierarchy - + // retrieve empty renderers for any stateful portlets and add them to the component hierarchy PortletTypeCollection types = PortletType.retrieveAllPortletTypes(); m_stateful = new HashMap(); - // refresh the type counts if we are recreating the page - portletTypeCount = new HashMap(); while (types.next()) { PortletType type = types.getPortletType(); s_log.debug("checking portlet type " + type.getDescription()); - Portlet portlet = Portlet.createPortlet(type, null); - if (portlet instanceof StatefulPortlet) { - StatefulPortlet statefulPortlet = (StatefulPortlet) portlet; - DataQuery findMaxInstances = SessionManager - .getSession() - .retrieveQuery( - "com.arsdigita.london.portal.MaxPortletInstances"); + String portletObjectType = type.getResourceObjectType(); + StatefulPortletRendererFactory factory = StatefulPortlet.getRendererFactory(portletObjectType); + if (null != factory ) { + DataQuery findMaxInstances = SessionManager.getSession().retrieveQuery("com.arsdigita.london.portal.MaxPortletInstances"); findMaxInstances.setParameter("portletType", type.getID()); + int requiredRenderers = 0; while (findMaxInstances.next()) { - requiredRenderers = ((Integer) findMaxInstances - .get("maxCount")).intValue(); + requiredRenderers = ((Integer)findMaxInstances.get("maxCount")).intValue(); } - s_log.debug("stateful portlet - I am going to instantiate " - + requiredRenderers + " renderers"); + s_log.debug("stateful portlet - I am going to instantiate " + requiredRenderers + " renderers"); List renderers = new ArrayList(); for (int i = 0; i < requiredRenderers; i++) { - StatefulPortletRenderer renderer = (StatefulPortletRenderer) statefulPortlet - .getEmptyPortletRenderer(); + StatefulPortletRenderer renderer = factory.getRenderer(); renderers.add(renderer); // and add it to the page add(renderer); s_log.debug("renderer added to page"); } - - portletTypeCount.put(type.getResourceObjectType(), new Integer( - requiredRenderers)); m_stateful.put(type.getResourceObjectType(), renderers); } } - m_portalDisplay = new Portal(new StatefulPersistentPortalModelBuilder( - portal, m_stateful)); + m_portalModelBuilder = + new StatefulPersistentPortalModelBuilder(portal, m_stateful); - add(m_portalDisplay); + } + // copied almost directly from PersistentPortal + public void generateXML(PageState state, + Element parent) { + Element content = generateParent(parent); + WorkspacePage page = m_portal.getSelectedPortal(state); + content.addAttribute("layout", page.getLayout().getFormat()); + content.addAttribute("title", page.getTitle()); + content.addAttribute("description", page.getDescription()); + + PortalModel pm = m_portalModelBuilder.buildModel(state); + Iterator portlets = pm.getPortletRenderers(); + + while (portlets.hasNext()) { + Object entry = portlets.next(); + if (entry instanceof Object[]) { + PortletRenderer renderer = (PortletRenderer)((Object[])entry)[0]; + BigDecimal portlet = (BigDecimal)((Object[])entry)[1]; + + // We want the root element created by the portlet + // but the crap generateXML signature doesn't let + // us get at it :-( And the bebop portlet isn't + // any more helpful either :-( + Element hack = new Element("hack"); + + renderer.generateXML(state, hack); + + Iterator elements = hack.getChildren().iterator(); + while (elements.hasNext()) { + Element child = (Element)elements.next(); + + content.addContent(child); } + } else { - /* - * public void register(Page page) { super.register(page); - * - * if (m_portlet != null) { page.addComponentStateParam(this, - * m_portlet.getStateParameter()); } if (m_portletType != null) { - * page.addComponentStateParam( this, m_portletType.getStateParameter()); } - * - * page.addComponentStateParam(this, m_column.getStateParameter()); } - */ - public void generateXML(PageState state, Element parent) { - // generateXML overridden to prevent generateXML being invoked - // on renderers that are only added to the component model here - // so that they are registered on the page - s_log.debug("start - generateXML"); - m_portalDisplay.generateXML(state, parent); - s_log.debug("FINISH - generateXML"); + PortletRenderer renderer = (PortletRenderer)entry; + renderer.generateXML(state, content); + } } + } - public static Integer getCurrentPortletRendererInstances(String portletType) { - - return (Integer) portletTypeCount.get(portletType); + /** + * return the number of renderers for the given portlet type currently registered on the page + * @param portletType + * @return + */ + public static int getCurrentPortletRendererInstances (String portletType) { + int count = 0; + List renderers = (List)m_stateful.get(portletType); + if (renderers != null) { + count = renderers.size(); + } + return count; } } Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortalModelBuilder.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortalModelBuilder.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPersistentPortalModelBuilder.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -20,14 +20,17 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.log4j.Logger; +import com.arsdigita.bebop.Component; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.portal.PortalModel; import com.arsdigita.bebop.portal.PortalModelBuilder; import com.arsdigita.bebop.portal.PortletRenderer; import com.arsdigita.london.portal.ui.PortalSelectionModel; +import com.arsdigita.london.portal.ui.SimplePortlet; import com.arsdigita.portal.Portal; import com.arsdigita.portal.PortletCollection; import com.arsdigita.util.LockableImpl; @@ -35,66 +38,59 @@ /** * @author cgyg9330 * - * portal model builder that should only be applied to portal in browse mode, as - * it does not allow for editing. portal in browse mode should have a - * com.arsdigita.london.portal.ui.PersistentPortalModelBuilder. + * portal model builder that should only be applied to portal in browse mode, as it does not allow for editing. + * portal in edit mode should have a com.arsdigita.london.portal.ui.PersistentPortalModelBuilder. * - * For stateless portlets, this builder creates a renderer with a reference to - * its portlet data object. For stateful portlets the builder retrieves one of - * the empty renderers registered to the page and puts the portlet data object - * in a requestlocal. + * For stateless portlets, this builder creates a renderer with a reference to its portlet data object. For stateful portlets + * the builder retrieves one of the empty renderers registered to the page and puts the portlet data object in + * a requestlocal. */ -public class StatefulPersistentPortalModelBuilder extends LockableImpl +public class StatefulPersistentPortalModelBuilder + extends LockableImpl implements PortalModelBuilder { - private Logger s_log = Logger - .getLogger(StatefulPersistentPortalModelBuilder.class); + private Logger s_log = Logger.getLogger(StatefulPersistentPortalModelBuilder.class); /** - * hashmap that maps portlet types to a list of empty renderers that have - * been registered on the page + * hashmap that maps portlet types to a list of empty renderers that have been registered on the page */ - private HashMap statefulCollections; - + private Map statefulCollections; private PortalSelectionModel portalModel; - public StatefulPersistentPortalModelBuilder(PortalSelectionModel portal, - HashMap stateful) { + public StatefulPersistentPortalModelBuilder( + PortalSelectionModel portal, + Map stateful) { this.portalModel = portal; this.statefulCollections = stateful; } public PortalModel buildModel(PageState state) { - // aim of this method is to get hold of a list of renderers for this - // particular portal + // aim of this method is to get hold of a list of renderers for this particular portal // and use them to make a PortalModel s_log.debug("START - buildModel"); List portletRenderers = new ArrayList(); HashMap statefulIterators = new HashMap(); - // get iterators for all the renderer lists (this means that each - // instance of the portlet has it's own renderer) - // getting iterators in the buildmodel method means that each time model - // is built, we start at the beginning of the list - Iterator it = statefulCollections.keySet().iterator(); + + // get iterators for all the renderer lists (this means that each instance of the portlet has it's own renderer) + // getting iterators in the buildmodel method means that each time model is built, we start at the beginning of the list + Iterator it = statefulCollections.entrySet().iterator(); while (it.hasNext()) { - String resourceType = (String) it.next(); - Iterator renderersIterator = ((List) statefulCollections - .get(resourceType)).iterator(); + Map.Entry entry = (Map.Entry)it.next(); + String resourceType = (String)entry.getKey(); + Iterator renderersIterator = ((List)entry.getValue()).iterator(); statefulIterators.put(resourceType, renderersIterator); } Portal portal = portalModel.getSelectedPortal(state); PortletCollection portlets = portal.getPortlets(); while (portlets.next()) { com.arsdigita.portal.Portlet portlet = portlets.getPortlet(); - s_log.debug("portlet " + portlet.getPortletType().getDescription() - + " " + portlet.getTitle()); + s_log.debug("portlet " + portlet.getPortletType().getDescription() + " " + portlet.getTitle()); if (portlet instanceof StatefulPortlet) { - StatefulPortletRenderer statefulRenderer = (StatefulPortletRenderer) ((Iterator) statefulIterators - .get(portlet.getPortletType().getResourceObjectType())) - .next(); + StatefulPortletRenderer statefulRenderer = (StatefulPortletRenderer)((Iterator) statefulIterators.get( + portlet.getPortletType().getResourceObjectType())).next(); statefulRenderer.setPortlet(portlet, state); portletRenderers.add(statefulRenderer); @@ -105,17 +101,18 @@ s_log.debug("stateless renderer added to model"); } + + } s_log.debug("FINISH - buildModel " + portal.getTitle()); - return new StatefulPersistentPortalModel(portletRenderers.iterator(), + return new StatefulPersistentPortalModel( + portletRenderers.iterator(), portal.getTitle()); } - private class StatefulPersistentPortalModel implements PortalModel { private Iterator portlets; - private String title; public StatefulPersistentPortalModel(Iterator portlets, String title) { Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortlet.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortlet.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortlet.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -16,6 +16,9 @@ package com.arsdigita.london.portal; +import java.util.HashMap; +import java.util.Map; + import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.portal.AbstractPortletRenderer; import com.arsdigita.london.portal.ui.PortalConstants; @@ -24,33 +27,168 @@ import com.arsdigita.xml.Element; /** - * @author cgyg9330 + * @author cgyg9330 <chr...@we...> + * @version $Id$ * - * In order to register stateful components with the page, this class provides a - * method declaration for retreiving a portletrenderer that is not tied to any - * particular portlet. This is neccessary because components need to be added to - * the page before the PortalModelBuilder retrieves the portlets for a specific - * portal. + * In order to register stateful components with the page, stateful portlets must have the ability + * to supply renderers that are not tied to any particular portlet data object. + * + * This abstract class provides a means of registering a StatefulPortletRendererFactory that is used + * when the page is being built, and provides a final implementation of doGetPortletRenderer that + * is used by a portal page in edit mode. + * + * The framework allows the empty renderers that are registered to a page to be populated via + * RequestLocals with actual Portlet data objects ready for rendering + * + * To create a stateful portlet:- + * + * implement a StatefulPortletRendererFactory + * + * eg + * + * <pre> + * + * public class StatefulExamplePortletRendererFactory implements StatefulPortletRendererFactory { + * + * public StatefulPortletRenderer getRenderer() { + * return new StatefulExamplePortletRenderer(); + * } + * * + * </pre> + * + * register this during initialisation + * + * <pre> + * + * public void init(DomainInitEvent e) { + * super.init(e); + * + * StatefulPortlet.registerRendererFactory(StatefulExamplePortlet.BASE_DATA_OBJECT_TYPE, new StatefulExamplePortletRendererFactory()); + * + * + * + * + * ensure that your portlet class extends StatefulPortlet, but apart from that treat is as any other domain object + * <pre> + * + * + * + * public class StatefulExamplePortlet extends StatefulPortlet { + * + * + * public String getLabel1 () { + * return (String) get ("label1"); + * } + * + * public String getLabel2 () { + * return (String) get ("label2); + * } + * </pre> + * + * + * In your statefulPortletRenderer, you can create any hierarchy of stateful + * components (bebop or otherwise) and pass then a reference to the + * requestLocal called portlet defined in StatefulPortletRenderer + * + * During rendering, this requestLocal holds a portlet data object + * which can be interrogated as normal once cast to your + * StatefulPortlet type + * + * + * + * <pre> + * public class StatefulExamplePortletRenderer + * extends StatefulPortletRenderer { + * + * private Label label1; + * private Label label2; + * private ActionLink link; + * + * public StatefulExamplePortletRenderer() { + * + * label1 = new Label("label 1"); + * label1.addPrintListener (new PrintListener() { + * public void prepare(PrintEvent event) { + * PageState state = event.getState(); + * StatefulExamplePortlet thisPortlet = (StatefulExamplePortlet)portlet.get(state); + * Label label = event.getTarget(); + * label.setLabel(thisPortlet.getLabel1()); + * } + * + * }); + * + * + * label2 = new Label("label 2"); + * label2.addPrintListener (new PrintListener() { + * public void prepare(PrintEvent event) { + * PageState state = event.getState(); + * StatefulExamplePortlet thisPortlet = (StatefulExamplePortlet)portlet.get(state); + * Label label = event.getTarget(); + * label.setLabel(thisPortlet.getLabel2()); + * } + * + * }); + * action = new ActionLink("press me"); + * action.addActionListener(new ActionListener() { + * + * public void actionPerformed(ActionEvent event) { + * PageState state = event.getPageState(); + * if (label1.isVisible(state)) { + * label1.setVisible(state, false); + * label2.setVisible(state, true); + * } else { + * label1.setVisible(state, true); + * label2.setVisible(state, false); + * } + * } + * }); + * + * add(label1); + * add(label2); + * add(action); + * } + * + * public void register(Page p) { + * super.register(p); + * p.setVisibleDefault(label1, true); + * p.setVisibleDefault(label2, false); + * + * } + * + * } + *</pre> + * + * + * */ public abstract class StatefulPortlet extends Portlet { + private static Map rendererFactories = new HashMap(); + protected StatefulPortlet(DataObject dataObject) { super(dataObject); } - public abstract StatefulPortletRenderer getEmptyPortletRenderer(); + public static void registerRendererFactory(String portletType, StatefulPortletRendererFactory factory) { + rendererFactories.put(portletType, factory); + } + + public static StatefulPortletRendererFactory getRendererFactory(String portletType) { + return (StatefulPortletRendererFactory)rendererFactories.get(portletType); + } + /** * - * stateful portlets cannot be displayed when the portal is in customise - * mode, as the portletrenderer is contained within a SimplePortlet which is - * not stateful + * stateful portlets cannot be displayed when the portal is in customise mode, as + * the portletrenderer is contained within a SimplePortlet which is not stateful * */ protected final AbstractPortletRenderer doGetPortletRenderer() { return new AbstractPortletRenderer() { protected void generateBodyXML(PageState state, Element document) { - document.newChildElement("portlet:stateful-portlet-in-edit", + document.newChildElement( + "portlet:stateful-portlet-in-edit-mode", PortalConstants.PORTLET_XML_NS); } }; Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRenderer.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRenderer.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRenderer.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -16,30 +16,35 @@ package com.arsdigita.london.portal; + +import org.apache.log4j.Logger; + import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.portal.AbstractPortletRenderer; import com.arsdigita.portal.Portlet; +import com.arsdigita.xml.Element; /** * @author chris gilbert * * Renderer that stores reference to portlet data object in a request local. - * When the page is built, enough StatefulPortletRenderers are added to the page - * as might be needed by any one portal. Hence all portals share the same - * stateful portlets and so portlet data object cannot be stored as an instane - * variable. + * When the page is built, enough StatefulPortletRenderers are added to the page as might + * be needed by any one portal. Hence all portals share the same stateful portlets and so + * portlet data object cannot be stored as an instane variable. * - * StatefulPortletModelBuilder sets value of requestlocal when the portlet model - * is built. + * StatefulPortletModelBuilder sets value of requestlocal when the portlet model is built. */ public abstract class StatefulPortletRenderer extends AbstractPortletRenderer { + private static Logger s_log = Logger.getLogger(StatefulPortletRenderer.class); + /** * holds the portlet data object for a particular request */ protected RequestLocal portlet = new RequestLocal(); + public void setPortlet(Portlet portlet, PageState state) { setTitle(portlet.getTitle()); setCellNumber(portlet.getCellNumber()); @@ -48,4 +53,21 @@ this.portlet.set(state, portlet); } + /** + * implementation of abstract method that does nothing. Any components that have been added to the container + * will be rendered by AbstractPortletRenderer within the bebop:portlet element + * + * if you want to include other information within bebop:portlet, override this method + * otherwise leave it + */ + protected void generateBodyXML( + PageState pageState, + Element parentElement) { + // do nothing + + } + + + + } Added: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRendererFactory.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRendererFactory.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/StatefulPortletRendererFactory.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -0,0 +1,20 @@ +/* + * Created on 06-Apr-05 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.london.portal; + +/** + * @author cgyg9330 + * + *Implementers of Stateful Portlets must implement a factory to retrieve the correct renderer. + */ +public interface StatefulPortletRendererFactory { + + + + public StatefulPortletRenderer getRenderer(); + +} Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/ApplicationSelector.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/ApplicationSelector.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/ApplicationSelector.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -18,47 +18,58 @@ package com.arsdigita.london.portal.ui; -import java.util.TooManyListenersException; - -import org.apache.log4j.Logger; - import com.arsdigita.bebop.Form; -import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.SaveCancelSection; -import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormProcessListener; -import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.parameters.NotNullValidationListener; +import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.Option; -import com.arsdigita.bebop.form.SingleSelect; -import com.arsdigita.bebop.parameters.NotNullValidationListener; -import com.arsdigita.london.util.ui.parameters.DomainObjectParameter; -import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.SaveCancelSection; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.web.ApplicationType; import com.arsdigita.web.Application; import com.arsdigita.web.ApplicationCollection; -import com.arsdigita.web.ApplicationType; +import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.london.util.ui.parameters.DomainObjectParameter; +import java.util.TooManyListenersException; +import org.apache.log4j.Logger; + public class ApplicationSelector extends Form { - private static final Logger s_log = Logger - .getLogger(ApplicationSelector.class); + private static final Logger s_log = Logger.getLogger(ApplicationSelector.class); private ApplicationType m_type; - private SingleSelect m_apps; - private DomainObjectParameter m_app; - private SaveCancelSection m_buttons; - public ApplicationSelector(ApplicationType type, DomainObjectParameter app) { + private PrivilegeDescriptor m_privilege; + + public ApplicationSelector(ApplicationType type, + DomainObjectParameter app) { + this(type, app, null); + } + + public ApplicationSelector(ApplicationType type, + DomainObjectParameter app, + PrivilegeDescriptor privilege) { super("applicationSelector"); m_type = type; m_app = app; + m_privilege = privilege; + + s_log.debug("displayed applications will be filtered by privilege " + m_privilege); m_apps = new SingleSelect(new DomainObjectParameter("apps")); m_apps.addValidationListener(new NotNullValidationListener()); @@ -77,7 +88,8 @@ } private class AppSubmissionListener implements FormSubmissionListener { - public void submitted(FormSectionEvent e) throws FormProcessException { + public void submitted(FormSectionEvent e) + throws FormProcessException { if (m_buttons.getCancelButton().isSelected(e.getPageState())) { s_log.debug("Firing event for cancel"); fireCompletionEvent(e.getPageState()); @@ -86,9 +98,9 @@ s_log.debug("Falling through for process"); } } - private class AppProcessListener implements FormProcessListener { - public void process(FormSectionEvent e) throws FormProcessException { + public void process(FormSectionEvent e) + throws FormProcessException { s_log.debug("Firing event for process"); PageState state = e.getPageState(); @@ -97,19 +109,27 @@ fireCompletionEvent(e.getPageState()); } } - private class AppPrintListener implements PrintListener { public void prepare(PrintEvent e) { ApplicationCollection apps = Application.retrieveAllApplications(); - apps.addEqualsFilter("resourceType.id", m_type.getID()); + apps.addEqualsFilter("resourceType.id", + m_type.getID()); + if (m_privilege != null) { + Party user = Kernel.getContext().getParty(); + if (user == null) { + user = Kernel.getPublicUser(); + } + PermissionService.filterObjects(apps,m_privilege, user.getOID()); + } apps.addOrder("primaryURL"); SingleSelect t = (SingleSelect) e.getTarget(); - t.addOption(new Option(null, "--select one--")); + t.addOption(new Option(null, + "--select one--")); while (apps.next()) { Application app = apps.getApplication(); - t.addOption(new Option(app.getOID().toString(), app.getTitle() - + " (" + app.getPath() + ")")); + t.addOption(new Option(app.getOID().toString(), + app.getTitle() + " (" + app.getPath() + ")")); } } } Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/PersistentPortal.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/PersistentPortal.java 2006-07-18 13:34:55 UTC (rev 1268) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/PersistentPortal.java 2006-07-18 13:36:43 UTC (rev 1269) @@ -15,99 +15,98 @@ package com.arsdigita.london.portal.ui; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.Iterator; +import com.arsdigita.london.portal.StatefulPersistentPortal; +import com.arsdigita.london.portal.StatefulPortlet; +import com.arsdigita.london.portal.Workspace; +import com.arsdigita.london.portal.WorkspacePage; -import org.apache.log4j.Logger; - +import com.arsdigita.bebop.ParameterSingleSelectionModel; +import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.Page; -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.ParameterSingleSelectionModel; +import com.arsdigita.bebop.Component; import com.arsdigita.bebop.RequestLocal; -import com.arsdigita.bebop.SimpleContainer; -import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.event.ActionEvent; -import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.event.ChangeEvent; -import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.event.ActionEvent; +import com.arsdigita.bebop.event.ActionListener; import com.arsdigita.bebop.jsp.DefinePage; +import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.parameters.BooleanParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter; -import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.portal.PortletRenderer; import com.arsdigita.bebop.portal.PortalModel; import com.arsdigita.bebop.portal.PortalModelBuilder; -import com.arsdigita.bebop.portal.PortletRenderer; + +import com.arsdigita.portal.PortletType; +import com.arsdigita.portal.Portlet; +import com.arsdigita.portal.PortletCollection; +import com.arsdigita.portal.PortletTypeCollection; + +import com.arsdigita.kernel.Resource; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.kernel.ui.ResourceConfigComponent; + import com.arsdigita.dispatcher.AccessDeniedException; import com.arsdigita.dispatcher.DispatcherHelper; -import com.arsdigita.kernel.Kernel; -import com.arsdigita.kernel.Party; -import com.arsdigita.kernel.Resource; -import com.arsdigita.kernel.ui.ResourceConfigComponent; -import com.arsdigita.london.portal.StatefulPersistentPortal; -import com.arsdigita.london.portal.StatefulPortlet; -import com.arsdigita.london.portal.Workspace; -import com.arsdigita.london.portal.WorkspacePage; -import com.arsdigita.london.util.ui.parameters.DomainObjectParameter; +import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.SessionManager; -import com.arsdigita.portal.Portlet; -import com.arsdigita.portal.PortletType; -import com.arsdigita.portal.PortletTypeCollection; import com.arsdigita.util.Assert; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.ApplicationType; import com.arsdigita.xml.Element; +import com.arsdigita.london.util.ui.parameters.DomainObjectParameter; + +import java.math.BigDecimal; + +import com.arsdigita.formbuilder.util.FormBuilderUtil; +import java.util.HashMap; +import java.util.Iterator; + +import java.io.IOException; + +import org.apache.log4j.Logger; + // XXX this class is disgusting public class PersistentPortal extends SimpleContainer { public static final String ACTION_CUSTOMIZE = "customize"; - public static final String ACTION_MOVE_UP = "moveUp"; - public static final String ACTION_MOVE_DOWN = "moveDown"; - public static final String ACTION_MOVE_LEFT = "moveLeft"; - public static final String ACTION_MOVE_RIGHT = "moveRight"; + public static final String ACTION_DELETE = "delete"; - private static final Logger s_log = Logger - .getLogger(PersistentPortal.class); + private static final Logger s_log = Logger.getLogger(PersistentPortal.class); private WorkspaceSelectionModel m_workspace; - private PortalSelectionModel m_portal; - private PortletTypeSelectionModel m_portletType; - private PortletSelectionModel m_portlet; private String m_mode; - private int m_columns; private PortletTypeForm m_adders[]; - private HashMap m_create; - private HashMap m_modify; - private HashMap m_createApp; private RequestLocal m_parentResource; - private RequestLocal m_currentResource; - private RequestLocal m_currentApp; - private PortalModelBuilder m_portalModelBuilder; - private DomainObjectParameter m_parentApp; private SingleSelectionModel m_column; @@ -116,11 +115,13 @@ // pixels wide... public static final int MAX_COLUMNS = 10; - public PersistentPortal(PortalSelectionModel portal, String mode) { + public PersistentPortal(PortalSelectionModel portal, + String mode) { this(portal, "portal", mode); } - public PersistentPortal(PortalSelectionModel portal, String name, + public PersistentPortal(PortalSelectionModel portal, + String name, String mode) { setTag("portal:portal"); setNamespace(PortalConstants.PORTAL_XML_NS); @@ -130,8 +131,8 @@ m_mode = mode; m_portal = portal; - m_column = new ParameterSingleSelectionModel(new IntegerParameter( - "column")); + m_column = new ParameterSingleSelectionModel(new IntegerParameter("column")); .. |
From: <cgy...@vh...> - 2006-07-18 13:40:47
|
Author: cgyg9330 Date: 2006-07-18 15:34:55 +0200 (Tue, 18 Jul 2006) New Revision: 1268 Added: trunk/ccm-core/src/com/arsdigita/bebop/jsp/CachedPage.java Modified: trunk/ccm-core/src/com/arsdigita/bebop/Page.java trunk/ccm-core/src/com/arsdigita/bebop/jsp/DefinePage.java trunk/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java Log: Store Page XML in cachetable to enable invalidation of page (support for stateful portlets). Also Merge Patch 1459849 - access control on ResourceTypeConfig form Modified: trunk/ccm-core/src/com/arsdigita/bebop/Page.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/bebop/Page.java 2006-07-18 13:14:45 UTC (rev 1267) +++ trunk/ccm-core/src/com/arsdigita/bebop/Page.java 2006-07-18 13:34:55 UTC (rev 1268) @@ -37,11 +37,15 @@ import java.util.BitSet; import java.util.Collection; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -124,8 +128,11 @@ /** * Map of stateful components (id --> Component) + * SortedMap used because component based hash for page is based on concatenation of + * component ids, and so need to guarantee that they are returned in the same order + * for the same page - cg. */ - private Map m_componentMap; + private SortedMap m_componentMap; private List m_components; /** @@ -259,7 +266,7 @@ m_panel = panel; m_clientStylesheets = new ArrayList(); m_components = new ArrayList(); - m_componentMap = new HashMap(); + m_componentMap = new TreeMap(); setErrorDisplay(new PageErrorDisplay()); setTitle(title); @@ -327,6 +334,7 @@ */ public void add(Component c) { m_panel.add(c); + } /** @@ -1289,4 +1297,33 @@ String klass = c.getClass().getName(); return klass.substring(klass.lastIndexOf(".")+1, klass.length()); } + + /** + * return a string that represents an ordered list of component + * ids used on the page. For situations where only the + * components present is of importance, this may be used + * by implementations of hashCode & equals + * @return + */ + public String getComponentString () { + Iterator it = m_componentMap.keySet().iterator(); + /*int hash = 0; + while (it.hasNext()) { + String componentId = (String)it.next(); + s_log.debug("component id = " + componentId); + hash = hash | componentId.hashCode(); + s_log.debug("hash so far = " + hash); + }*/ + Date start = new Date(); + + StringBuffer hashString = new StringBuffer(); + while (it.hasNext()) { + String componentId = (String)it.next(); + hashString.append(componentId); + } + s_log.debug("Time to create hashCode for page: " + (new Date().getTime() - start.getTime())); + return hashString.toString(); + + + } } Added: trunk/ccm-core/src/com/arsdigita/bebop/jsp/CachedPage.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/bebop/jsp/CachedPage.java 2006-07-18 13:14:45 UTC (rev 1267) +++ trunk/ccm-core/src/com/arsdigita/bebop/jsp/CachedPage.java 2006-07-18 13:34:55 UTC (rev 1268) @@ -0,0 +1,57 @@ +/* + * Created on 20-Jan-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.bebop.jsp; + +import com.arsdigita.bebop.Page; + +/** + * Wrapper around object array used by com.arsdigita.bebop.jsp.DefinePage + * that implements hashCode in order that pages can be put in a CacheTable + * without being removed unnecessarily by other nodes. This is required by + * stateful portlet framework. + * + * Hashcode is based on ids of components on the page and should be equal for pages + * containing the same components. These ids are either specified when the component is added + * or assigned an integer from a straightforward sequence. As a consequence, even if the components + * are added in a different order, and hence individually may have different ids, the same ids should be + * present on the page. + * + * + * @author Chris Gilbert <a href="mailto:chr...@we...">chr...@we...</a> + * @version $Id: CorrespondenceConfig.java,v 1.4 2006/01/18 08:39:11 cgyg9330 Exp $ + */ +public class CachedPage { + + private Object[] pair; + + public CachedPage(Object[] pair) { + this.pair = pair; + } + + + public Object[] getPageTimeStampPair () { + return pair; + } + public int hashCode() { + Page page = (Page) pair[0]; + return page.getComponentString().hashCode(); + } + + public boolean equals(Object other) { + if (other == null) { + return false; + } + if (!other.getClass().equals(CachedPage.class)) { + return false; + } + CachedPage otherCachedPage = (CachedPage) other; + Page otherPage = (Page)otherCachedPage.getPageTimeStampPair()[0]; + Page thisPage = (Page)getPageTimeStampPair()[0]; + return otherPage.getComponentString().equals(thisPage.getComponentString()); + } + +} Modified: trunk/ccm-core/src/com/arsdigita/bebop/jsp/DefinePage.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/bebop/jsp/DefinePage.java 2006-07-18 13:14:45 UTC (rev 1267) +++ trunk/ccm-core/src/com/arsdigita/bebop/jsp/DefinePage.java 2006-07-18 13:34:55 UTC (rev 1268) @@ -23,6 +23,7 @@ import com.arsdigita.bebop.PageFactory; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SlaveComponent; +import com.arsdigita.caching.CacheTable; import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.xml.Document; @@ -75,14 +76,12 @@ private static final Logger s_log = Logger.getLogger(DefinePage.class.getName()); - private static Map s_pageCache = new HashMap(); + private static CacheTable s_pageCache = new CacheTable("PageCache"); // maps URL(/packages/foo/www/asdf.jsp) -> {Page, creation date} + // should this be a CacheTable or not? private static Map s_pageLocks = new HashMap(); - // Collection of dirty page URLs (ie/packages/foo/www/asdf.jsp). - // Can be set anywhere and is checked here before retreiving page from cache. - private static Set s_dirtyPages = - Collections.synchronizedSet(new HashSet()); + /** * Creates a Bebop Page instance. A page tag is a special case @@ -104,12 +103,15 @@ } // Now we just synchronize against our specific page. synchronized (pageLock) { - Object[] pair = (Object[])s_pageCache.get(cacheKey); - if (pair != null) { + + CachedPage cached = (CachedPage)s_pageCache.get(cacheKey); + if (cached != null) { + Object[] pair = cached.getPageTimeStampPair(); + long pageDate = ((Long)pair[1]).longValue(); File jspFile = new File(pageContext.getServletContext() .getRealPath(cacheKey)); - if (jspFile.lastModified() <= pageDate && !s_dirtyPages.contains(cacheKey)) { + if (jspFile.lastModified() <= pageDate) { // jsp file is not newer than cached page, // and page hasn't been marked as dirty by anyone so we can use the cached page. @@ -136,17 +138,11 @@ return SKIP_BODY; } - s_log.debug("rebuilding page - first time requested? " - + !s_pageCache.containsKey(cacheKey) - + " marked as dirty? " - + s_dirtyPages.contains(cacheKey) - + " else JSP modified"); m_page = buildPage(); - s_pageCache.put(cacheKey, - new Object[] {m_page, - new Long(System.currentTimeMillis())}); - s_dirtyPages.remove(cacheKey); + // s_pageCache.put(cacheKey, + // new CachedPage(new Object[] {m_page, + // new Long(System.currentTimeMillis())})); } } else { @@ -160,9 +156,12 @@ * pass in resource URL (eg by using DispatcherHelper.getCurrentResourcePath()) * and page will be rebuilt next time it is requested. * @param resourceURL URL for page eg /packages/foo/www/asdf.jsp + * + * */ - public static void setPageAsDirty (String resourceURL) { - s_dirtyPages.add(resourceURL); + public static void invalidatePage (String resourceURL) { + s_log.debug("page - " + resourceURL + " removed from cache"); + s_pageCache.remove(resourceURL); } @@ -232,7 +231,14 @@ synchronized(pageLock) { if (!m_page.isLocked()) { m_page.lock(); - + CachedPage cached = (CachedPage)s_pageCache.get(cacheKey); + // cache page in end tag because hashcode of cached page relies on + // components that are added between start and end tag + if (cached == null) { + s_pageCache.put(cacheKey, + new CachedPage(new Object[] {m_page, + new Long(System.currentTimeMillis())})); + } // Now notify anyone waiting for us to lock the page // that we're all done. see doStartTag() if (s_log.isDebugEnabled()) { Modified: trunk/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java 2006-07-18 13:14:45 UTC (rev 1267) +++ trunk/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java 2006-07-18 13:34:55 UTC (rev 1268) @@ -18,9 +18,13 @@ */ package com.arsdigita.kernel; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.kernel.ui.ResourceConfigFormSection; import com.arsdigita.kernel.ui.BasicResourceConfigFormSection; import com.arsdigita.kernel.ui.ResourceConfigComponent; +import com.arsdigita.toolbox.ui.SecurityContainer; import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Form; @@ -38,18 +42,31 @@ * @see ResourceConfigFormSection * @see com.arsdigita.kernel.Resource * @author Justin Ross - * @version $Id$ + * @version $Id$ */ public class ResourceTypeConfig { public static final String versionId = - "$Id$" + - "$Author$" + + "$Id$" + + "$Author$" + "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger (ResourceTypeConfig.class); /** + * optionally set - prevents create/modify form being rendered unless user has + * this privilege on the appropriate object (parent application in the case of create, + * application in the case of modify + */ + private PrivilegeDescriptor m_createModifyPrivilege = null; + /** + * optionally set - allows components that list applications to filter on the basis + * of this privilege - see com.arsdigita.london.portal.ui.PersistantPortal + * and com.arsdigita.london.portal.ui.ApplicationSelector + */ + private PrivilegeDescriptor m_viewPrivilege = null; + + /** * For use in generating default config components when * Resource authors don't specify their own. Should only be * used by PortletType. @@ -59,10 +76,31 @@ } public ResourceTypeConfig(String resourceObjectType) { + this(resourceObjectType, null, null); + } + + /** + * constructor that allows the resource create and modify forms to be conditionally + * displayed according to the accessPrivilege. + * + * On creation, a permission check is carried out on the parent resource while + * on modification, a permission check is carried out on the resource being modified. + * + * + * @param resourceObjectType + * @param accessPrivilege + */ + public ResourceTypeConfig(String resourceObjectType, PrivilegeDescriptor createModifyPrivilege, PrivilegeDescriptor viewPrivilege) { if (s_log.isDebugEnabled()) { s_log.debug("Registering " + this + " to object type " + resourceObjectType); } + m_createModifyPrivilege = createModifyPrivilege; + m_viewPrivilege = viewPrivilege; + + s_log.debug("create/modify privilege is " + m_createModifyPrivilege + ". View privilege is " + m_viewPrivilege); + + ResourceType.registerResourceTypeConfig (resourceObjectType, this); @@ -99,7 +137,7 @@ final ResourceConfigFormSection section = getCreateFormSection(resType, parentResRL); - return new ResourceConfigWrapperComponent(section); + return new ResourceConfigWrapperComponent(section, parentResRL); } /** @@ -113,20 +151,54 @@ final ResourceConfigFormSection section = getModifyFormSection(resource); - return new ResourceConfigWrapperComponent(section); + return new ResourceConfigWrapperComponent(section, resource); } public void configureResource(Resource resource) { // Empty } + /** + * Retrieve privilege required for user to see an instance of the resource type. + * Privilege may be specified in constructor, or this method may be overridden. + * + * Privilege must be specified by overriding this method if the privilege is retrieved with + * PrivilegeDescriptor.get, which relies on a map populated during legacy init event + * and so may not be populated when the ResourceTypeConfig is created. + * + * If no privilege specified, null is returned + * @return + */ + public PrivilegeDescriptor getViewPrivilege() { + return m_viewPrivilege; + } + /** + * Retrieve privilege required for user to create or modify an instance of the resource type. + * Privilege may be specified in constructor, or this method may be overridden. + * + * Privilege must be specified by overriding this method if the privilege is retrieved with + * PrivilegeDescriptor.get, which relies on a map populated during legacy init event + * and so may not be populated when the ResourceTypeConfig is created + * + * If privilege is specified, view/modify form may not be displayed if user has insufficient + * privileges. + * @return + */ + public PrivilegeDescriptor getCreateModifyPrivilege() { + return m_createModifyPrivilege; + } + + private class ResourceConfigWrapperComponent extends ResourceConfigComponent { + // on creation, check privilege against parent resource. On modification, check privilege against resource + private RequestLocal m_accessCheckRes; private ResourceConfigFormSection m_section; private SaveCancelSection m_buttons; public ResourceConfigWrapperComponent - (ResourceConfigFormSection section) { + (ResourceConfigFormSection section, RequestLocal accessCheckResRL) { + m_accessCheckRes = accessCheckResRL; m_section = section; m_buttons = new SaveCancelSection(); @@ -153,13 +225,28 @@ fireCompletionEvent(state); } }); + if (m_createModifyPrivilege != null && m_accessCheckRes != null) { + s_log.debug("creating resource create/modify wrapper form with access check"); + SecurityContainer sc = new SecurityContainer(form) { + + protected boolean canAccess(Party party, PageState state) { + Resource resource = (Resource)m_accessCheckRes.get(state); + s_log.debug("check permission on " + resource + " for " + party.getPrimaryEmail().getEmailAddress()); + PermissionDescriptor access = new PermissionDescriptor(m_createModifyPrivilege, resource, party); + return PermissionService.checkPermission(access); + }}; + add(sc); + } else { + s_log.debug("creating resource create/modify wrapper form without access check"); add(form); } + } public Resource createResource(PageState state) { Resource resource = null; + // when either save is selected, or nothing is selected // (e.g. when pressing enter in IE) if (m_buttons.getSaveButton().isSelected(state) @@ -177,5 +264,6 @@ m_section.modifyResource(state); } } + } } |