- Formatting

- Added more entities to the PDLEntities UML diagram


git-svn-id: https://svn.libreccm.org/ccm/trunk@2584 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-03-24 18:04:10 +00:00
parent 8f786439e6
commit d1057f7475
9 changed files with 293 additions and 189 deletions

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2014 Jens Pelzetter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.portletdataprovider;
import com.arsdigita.db.DbHelper;
import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.runtime.CompoundInitializer;
import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class Initalizer extends CompoundInitializer {
public Initalizer() {
final String jdbcUrl = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(jdbcUrl);
add(new PDLInitializer(new ManifestSource("empty.pdl.mf",
new NameFilter(DbHelper.
getDatabaseSuffix(database), "pdl"))));
}
@Override
public void init(final DomainInitEvent event) {
super.init(event);
}
}

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd"> <xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<!-- No need to list all the content types here. Only <!-- No need to list all the content types here. Only
need to list a type if is adds associations that need to list a type if is adds associations that
were not in the parent type, or to remove attributes were not in the parent type, or to remove attributes
--> -->
<!-- First off the adapters for ContentItemPanel --> <!-- First off the adapters for ContentItemPanel -->
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<!-- Content item is the simplest type --> <!-- Content item is the simplest type -->
@ -54,27 +54,22 @@
</xrd:adapter> </xrd:adapter>
<xrd:adapter objectType="com.arsdigita.cms.ContentPage" <xrd:adapter objectType="com.arsdigita.cms.ContentPage"
extends="com.arsdigita.cms.ContentItem" extends="com.arsdigita.cms.ContentItem"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
</xrd:attributes> </xrd:attributes>
<xrd:associations rule="include"> <xrd:associations rule="include">
<xrd:property name="/object/masterVersion"/> <xrd:property name="/object/masterVersion"/>
<xrd:property name="/object/masterVersion/auditing"/> <xrd:property name="/object/masterVersion/auditing"/>
<xrd:property name="/object/masterVersion/auditing/creationUser"/> <xrd:property name="/object/masterVersion/auditing/creationUser"/>
<xrd:property name="/object/masterVersion/auditing/lastModifiedUser"/> <xrd:property name="/object/masterVersion/auditing/lastModifiedUser"/>
</xrd:associations> </xrd:associations>
</xrd:adapter> </xrd:adapter>
<!-- Adds a text asset --> <!-- Adds a text asset -->
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" <xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle"
extends="com.arsdigita.cms.ContentPage" extends="com.arsdigita.cms.ContentPage"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/textAsset/id"/> <xrd:property name="/object/textAsset/id"/>
<xrd:property name="/object/textAsset/defaultDomainClass"/> <xrd:property name="/object/textAsset/defaultDomainClass"/>
@ -93,43 +88,43 @@
<!-- Adds several image assets --> <!-- Adds several image assets -->
<!-- Quasimodo: Ich denke, das ist jetzt unnötig --> <!-- Quasimodo: Ich denke, das ist jetzt unnötig -->
<!-- <!--
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" extends="com.arsdigita.cms.contenttypes.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" extends="com.arsdigita.cms.contenttypes.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/imageCaptions/id"/> <xrd:property name="/object/imageCaptions/id"/>
<xrd:property name="/object/imageCaptions/defaultDomainClass"/> <xrd:property name="/object/imageCaptions/defaultDomainClass"/>
<xrd:property name="/object/imageCaptions/objectType"/> <xrd:property name="/object/imageCaptions/objectType"/>
<xrd:property name="/object/imageCaptions/displayName"/> <xrd:property name="/object/imageCaptions/displayName"/>
<xrd:property name="/object/imageCaptions/isDeleted"/> <xrd:property name="/object/imageCaptions/isDeleted"/>
<xrd:property name="/object/imageCaptions/ancestors"/> <xrd:property name="/object/imageCaptions/ancestors"/>
<xrd:property name="/object/imageCaptions/version"/> <xrd:property name="/object/imageCaptions/version"/>
<xrd:property name="/object/imageCaptions/name"/> <xrd:property name="/object/imageCaptions/name"/>
<xrd:property name="/object/imageCaptions/language"/> <xrd:property name="/object/imageCaptions/language"/>
<xrd:property name="/object/imageCaptions/imageId"/> <xrd:property name="/object/imageCaptions/imageId"/>
<xrd:property name="/object/imageCaptions/articleId"/> <xrd:property name="/object/imageCaptions/articleId"/>
--> -->
<!-- XXX change /cms-service to take OID --> <!-- XXX change /cms-service to take OID -->
<!--<xrd:property name="/object/imageCaptions/imageAsset/id"/>--> <!--<xrd:property name="/object/imageCaptions/imageAsset/id"/>-->
<!-- <!--
<xrd:property name="/object/imageCaptions/imageAsset/defaultDomainClass"/> <xrd:property name="/object/imageCaptions/imageAsset/defaultDomainClass"/>
<xrd:property name="/object/imageCaptions/imageAsset/objectType"/> <xrd:property name="/object/imageCaptions/imageAsset/objectType"/>
<xrd:property name="/object/imageCaptions/imageAsset/displayName"/> <xrd:property name="/object/imageCaptions/imageAsset/displayName"/>
<xrd:property name="/object/imageCaptions/imageAsset/isDeleted"/> <xrd:property name="/object/imageCaptions/imageAsset/isDeleted"/>
<xrd:property name="/object/imageCaptions/imageAsset/ancestors"/> <xrd:property name="/object/imageCaptions/imageAsset/ancestors"/>
<xrd:property name="/object/imageCaptions/imageAsset/version"/> <xrd:property name="/object/imageCaptions/imageAsset/version"/>
<xrd:property name="/object/imageCaptions/imageAsset/name"/> <xrd:property name="/object/imageCaptions/imageAsset/name"/>
<xrd:property name="/object/imageCaptions/imageAsset/language"/> <xrd:property name="/object/imageCaptions/imageAsset/language"/>
<xrd:property name="/object/imageCaptions/imageAsset/content"/> <xrd:property name="/object/imageCaptions/imageAsset/content"/>
<xrd:property name="/object/imageCaptions/imageAsset/mimeType/javaClass"/> <xrd:property name="/object/imageCaptions/imageAsset/mimeType/javaClass"/>
<xrd:property name="/object/imageCaptions/imageAsset/mimeType/objectType"/> <xrd:property name="/object/imageCaptions/imageAsset/mimeType/objectType"/>
</xrd:attributes> </xrd:attributes>
<xrd:associations rule="include"> <xrd:associations rule="include">
<xrd:property name="/object/imageCaptions"/> <xrd:property name="/object/imageCaptions"/>
<xrd:property name="/object/imageCaptions/imageAsset"/> <xrd:property name="/object/imageCaptions/imageAsset"/>
<xrd:property name="/object/imageCaptions/imageAsset/mimeType"/> <xrd:property name="/object/imageCaptions/imageAsset/mimeType"/>
</xrd:associations> </xrd:associations>
</xrd:adapter> </xrd:adapter>
--> -->
</xrd:context> </xrd:context>
@ -137,7 +132,7 @@
<xrd:context name="com.arsdigita.cms.search.ContentPageMetadataProvider"> <xrd:context name="com.arsdigita.cms.search.ContentPageMetadataProvider">
<!-- Content item is the simplest type --> <!-- Content item is the simplest type -->
<xrd:adapter objectType="com.arsdigita.cms.ContentItem" <xrd:adapter objectType="com.arsdigita.cms.ContentItem"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/id"/> <xrd:property name="/object/id"/>
<xrd:property name="/object/defaultDomainClass"/> <xrd:property name="/object/defaultDomainClass"/>
@ -162,8 +157,8 @@
<!-- Adds a text asset --> <!-- Adds a text asset -->
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" <xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle"
extends="com.arsdigita.cms.ContentItem" extends="com.arsdigita.cms.ContentItem"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/textAsset/id"/> <xrd:property name="/object/textAsset/id"/>
<xrd:property name="/object/textAsset/defaultDomainClass"/> <xrd:property name="/object/textAsset/defaultDomainClass"/>
@ -181,51 +176,51 @@
</xrd:adapter> </xrd:adapter>
<!-- Adds several image assets --> <!-- Adds several image assets -->
<!-- Quasimodo: Ich denke, das ist jetzt unnötig --> <!-- Quasimodo: Ich denke, das ist jetzt unnötig -->
<!-- <!--
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" extends="com.arsdigita.cms.contenttypes.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" extends="com.arsdigita.cms.contenttypes.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/imageCaptions/id"/> <xrd:property name="/object/imageCaptions/id"/>
<xrd:property name="/object/imageCaptions/defaultDomainClass"/> <xrd:property name="/object/imageCaptions/defaultDomainClass"/>
<xrd:property name="/object/imageCaptions/objectType"/> <xrd:property name="/object/imageCaptions/objectType"/>
<xrd:property name="/object/imageCaptions/displayName"/> <xrd:property name="/object/imageCaptions/displayName"/>
<xrd:property name="/object/imageCaptions/isDeleted"/> <xrd:property name="/object/imageCaptions/isDeleted"/>
<xrd:property name="/object/imageCaptions/ancestors"/> <xrd:property name="/object/imageCaptions/ancestors"/>
<xrd:property name="/object/imageCaptions/version"/> <xrd:property name="/object/imageCaptions/version"/>
<xrd:property name="/object/imageCaptions/name"/> <xrd:property name="/object/imageCaptions/name"/>
<xrd:property name="/object/imageCaptions/language"/> <xrd:property name="/object/imageCaptions/language"/>
<xrd:property name="/object/imageCaptions/imageId"/> <xrd:property name="/object/imageCaptions/imageId"/>
<xrd:property name="/object/imageCaptions/articleId"/> <xrd:property name="/object/imageCaptions/articleId"/>
--> -->
<!-- XXX change /cms-service to take OID --> <!-- XXX change /cms-service to take OID -->
<!--<xrd:property name="/object/imageCaptions/imageAsset/id"/>--> <!--<xrd:property name="/object/imageCaptions/imageAsset/id"/>-->
<!-- <!--
<xrd:property name="/object/imageCaptions/imageAsset/defaultDomainClass"/> <xrd:property name="/object/imageCaptions/imageAsset/defaultDomainClass"/>
<xrd:property name="/object/imageCaptions/imageAsset/objectType"/> <xrd:property name="/object/imageCaptions/imageAsset/objectType"/>
<xrd:property name="/object/imageCaptions/imageAsset/displayName"/> <xrd:property name="/object/imageCaptions/imageAsset/displayName"/>
<xrd:property name="/object/imageCaptions/imageAsset/isDeleted"/> <xrd:property name="/object/imageCaptions/imageAsset/isDeleted"/>
<xrd:property name="/object/imageCaptions/imageAsset/ancestors"/> <xrd:property name="/object/imageCaptions/imageAsset/ancestors"/>
<xrd:property name="/object/imageCaptions/imageAsset/version"/> <xrd:property name="/object/imageCaptions/imageAsset/version"/>
<xrd:property name="/object/imageCaptions/imageAsset/name"/> <xrd:property name="/object/imageCaptions/imageAsset/name"/>
<xrd:property name="/object/imageCaptions/imageAsset/language"/> <xrd:property name="/object/imageCaptions/imageAsset/language"/>
<xrd:property name="/object/imageCaptions/imageAsset/content"/> <xrd:property name="/object/imageCaptions/imageAsset/content"/>
<xrd:property name="/object/imageCaptions/imageAsset/mimeType/javaClass"/> <xrd:property name="/object/imageCaptions/imageAsset/mimeType/javaClass"/>
<xrd:property name="/object/imageCaptions/imageAsset/mimeType/objectType"/> <xrd:property name="/object/imageCaptions/imageAsset/mimeType/objectType"/>
</xrd:attributes> </xrd:attributes>
<xrd:associations rule="include"> <xrd:associations rule="include">
<xrd:property name="/object/imageCaptions"/> <xrd:property name="/object/imageCaptions"/>
<xrd:property name="/object/imageCaptions/imageAsset"/> <xrd:property name="/object/imageCaptions/imageAsset"/>
<xrd:property name="/object/imageCaptions/imageAsset/mimeType"/> <xrd:property name="/object/imageCaptions/imageAsset/mimeType"/>
</xrd:associations> </xrd:associations>
</xrd:adapter> </xrd:adapter>
--> -->
<!-- Article in several sections --> <!-- Article in several sections -->
</xrd:context> </xrd:context>
<!-- Search metadata for file assets --> <!-- Search metadata for file assets -->
<xrd:context name="com.arsdigita.cms.search.AssetMetadataProvider"> <xrd:context name="com.arsdigita.cms.search.AssetMetadataProvider">
<xrd:adapter objectType="com.arsdigita.cms.FileAsset" <xrd:adapter objectType="com.arsdigita.cms.FileAsset"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:attributes rule="exclude"> <xrd:attributes rule="exclude">
<xrd:property name="/object/id"/> <xrd:property name="/object/id"/>
<xrd:property name="/object/content"/> <xrd:property name="/object/content"/>
@ -242,14 +237,14 @@
<xrd:context name="com.arsdigita.cms.search.AssetExtractor"> <xrd:context name="com.arsdigita.cms.search.AssetExtractor">
<!-- Content item is the simplest type --> <!-- Content item is the simplest type -->
<xrd:adapter objectType="com.arsdigita.cms.ContentItem" <xrd:adapter objectType="com.arsdigita.cms.ContentItem"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:associations rule="include"/> <xrd:associations rule="include"/>
</xrd:adapter> </xrd:adapter>
<!-- Adds a text asset --> <!-- Adds a text asset -->
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle" <xrd:adapter objectType="com.arsdigita.cms.contenttypes.GenericArticle"
extends="com.arsdigita.cms.ContentItem" extends="com.arsdigita.cms.ContentItem"
traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
<xrd:associations rule="include"> <xrd:associations rule="include">
<xrd:property name="/object/textAsset"/> <xrd:property name="/object/textAsset"/>
</xrd:associations> </xrd:associations>

View File

@ -26,29 +26,25 @@ import com.arsdigita.domain.DomainObjectTraversalAdapter;
import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
/** /**
* An adapter for content items allowing pluggable * An adapter for content items allowing pluggable assets to extend the traversal.
* assets to extend the traversal.
*/ */
public class ContentItemTraversalAdapter public class ContentItemTraversalAdapter
extends SimpleDomainObjectTraversalAdapter { extends SimpleDomainObjectTraversalAdapter {
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(ContentItemTraversalAdapter.class); Logger.getLogger(ContentItemTraversalAdapter.class);
private static final Map s_assetAdapters = new HashMap(); private static final Map s_assetAdapters = new HashMap();
public static void registerAssetAdapter(String path, public static void registerAssetAdapter(String path,
DomainObjectTraversalAdapter adapter, DomainObjectTraversalAdapter adapter,
String context) { String context) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Registering asset adapter " + path + s_log.debug("Registering asset adapter " + path + " adapter " + adapter.getClass()
" adapter " + adapter.getClass() + + " in context " + context);
" in context " + context);
} }
Map adapters = (Map)s_assetAdapters.get(context); Map adapters = (Map) s_assetAdapters.get(context);
if (adapters == null) { if (adapters == null) {
adapters = new HashMap(); adapters = new HashMap();
s_assetAdapters.put(context, adapters); s_assetAdapters.put(context, adapters);
@ -65,9 +61,8 @@ public class ContentItemTraversalAdapter
} }
/** /**
* If the path references an asset, then delegates * If the path references an asset, then delegates to the asset's adapter, otherwise delegates
* to the asset's adapter, otherwise delegates to * to the content item's primary adapter
* the content item's primary adapter
*/ */
@Override @Override
public boolean processProperty(DomainObject obj, public boolean processProperty(DomainObject obj,
@ -75,15 +70,14 @@ public class ContentItemTraversalAdapter
Property prop, Property prop,
String context) { String context) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Process property " + path + " in context " + context ); s_log.debug("Process property " + path + " in context " + context);
} }
String prefix = "/object/"; String prefix = "/object/";
int offset = path.indexOf("/", prefix.length()); int offset = path.indexOf("/", prefix.length());
if (offset == -1) { if (offset == -1) {
String base = path.substring(prefix.length()); String base = path.substring(prefix.length());
Map adapters = (Map)s_assetAdapters.get(context); Map adapters = (Map) s_assetAdapters.get(context);
if (adapters != null && if (adapters != null && adapters.containsKey(base)) {
adapters.containsKey(base)) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Following asset"); s_log.debug("Following asset");
} }
@ -98,20 +92,17 @@ public class ContentItemTraversalAdapter
String base = path.substring(prefix.length(), offset); String base = path.substring(prefix.length(), offset);
String rest = path.substring(offset + 1); String rest = path.substring(offset + 1);
Map adapters = (Map)s_assetAdapters.get(context); Map adapters = (Map) s_assetAdapters.get(context);
if (adapters != null && if (adapters != null && adapters.containsKey(base)) {
adapters.containsKey(base)) { DomainObjectTraversalAdapter adapter = (DomainObjectTraversalAdapter) adapters.get(
DomainObjectTraversalAdapter adapter = (DomainObjectTraversalAdapter) base);
adapters.get(base);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Delegate to asset adapter " + base + s_log.debug("Delegate to asset adapter " + base + " " + rest + " " + adapter);
" " + rest + " " + adapter);
} }
return adapter.processProperty(obj, "/object/" + rest, prop, context); return adapter.processProperty(obj, "/object/" + rest, prop, context);
} else { } else {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Delegate to primary adapter " + base + s_log.debug("Delegate to primary adapter " + base + " " + rest);
" " + rest);
} }
return super.processProperty(obj, path, prop, context); return super.processProperty(obj, path, prop, context);
} }

View File

@ -299,7 +299,6 @@ public interface DataQuery {
* *
* @return The filter that has just been added to the query * @return The filter that has just been added to the query
**/ **/
Filter addFilter(String conditions); Filter addFilter(String conditions);

View File

@ -7,14 +7,15 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.Filter; import com.arsdigita.persistence.Filter;
/** /**
* An extension to the {@link CMSDataCollectionDefinition}. With this definition it is possible to filter an object * An extension to the {@link CMSDataCollectionDefinition}. With this definition it is possible to
* list using a second category system/terms domain. This class is designed to be used together with the * filter an object list using a second category system/terms domain. This class is designed to be
* {@link CategorisedDataCollectionRenderer} which displays the objects in a list with several sections. * used together with the {@link CategorisedDataCollectionRenderer} which displays the objects in a
* list with several sections.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
*/ */
public class CategorisedDataCollectionDefinition extends CMSDataCollectionDefinition{ public class CategorisedDataCollectionDefinition extends CMSDataCollectionDefinition {
private String termDomain; private String termDomain;
@ -34,10 +35,12 @@ public class CategorisedDataCollectionDefinition extends CMSDataCollectionDefini
final Category rootCat = domain.getModel(); final Category rootCat = domain.getModel();
//final FilterFactory filterFactory = objects.getFilterFactory(); //final FilterFactory filterFactory = objects.getFilterFactory();
final Filter filter = objects.addInSubqueryFilter(getCategorizedObjectPath("id"), "com.arsdigita.categorization.objectIDsInSubtree"); final Filter filter = objects.addInSubqueryFilter(
getCategorizedObjectPath("id"),
"com.arsdigita.categorization.objectIDsInSubtree");
filter.set("categoryID", rootCat.getID()); filter.set("categoryID", rootCat.getID());
objects.addOrder("parent.categories.link.sortKey"); //objects.addOrder("parent.categories.link.sortKey");
//objects.addOrder("title desc"); //objects.addOrder("title desc");
} }

View File

@ -27,11 +27,12 @@ import org.apache.log4j.Logger;
/** /**
* <p> * <p>
* An extended {@code DataCollectionRenderer} which displays a object list split into several sections. The sections * An extended {@code DataCollectionRenderer} which displays a object list split into several
* are created using a second category system/term domain set using the {@link #setTermDomain(java.lang.String)} * sections. The sections are created using a second category system/term domain set using the
* method in the JSP template. This renderer is designed to be used together with the * {@link #setTermDomain(java.lang.String)} method in the JSP template. This renderer is designed to
* {@link CategorisedDataCollectionRenderer}. To use them, a special JSP template is required. More specificly a JSP * be used together with the {@link CategorisedDataCollectionRenderer}. To use them, a special JSP
* template using these two class would look like this (only relevant parts shown): * template is required. More specificly a JSP template using these two class would look like this
* (only relevant parts shown):
* </p> * </p>
* <pre> * <pre>
* ... * ...
@ -54,9 +55,9 @@ import org.apache.log4j.Logger;
* </jsp:scriplet> * </jsp:scriplet>
* </pre> * </pre>
* <p> * <p>
* This example will create a list of objects of the type {@link GenericPerson}, split into sections definied by the * This example will create a list of objects of the type {@link GenericPerson}, split into sections
* terms domain identified by the key {@code memberTypes}. Only the root terms of the domain are used for creating the * definied by the terms domain identified by the key {@code memberTypes}. Only the root terms of
* sections. * the domain are used for creating the sections.
* </p> * </p>
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
@ -143,8 +144,7 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
} }
paginator.addAttribute("pageParam", pageParam); paginator.addAttribute("pageParam", pageParam);
paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map). paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map).toString());
toString());
// Quasimodo: End // Quasimodo: End
paginator.addAttribute("pageNumber", Long.toString(pageNumber)); paginator.addAttribute("pageNumber", Long.toString(pageNumber));
@ -167,16 +167,17 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
//if (m_specializeObjects) { //if (m_specializeObjects) {
object = (ACSObject) DomainObjectFactory.newInstance(dobj); object = (ACSObject) DomainObjectFactory.newInstance(dobj);
if (object == null) { if (object == null) {
s_log.error(String.format("Failed to specialize object with with id %s. Skiping object.", dobj. s_log.error(String.format(
getOID().toString())); "Failed to specialize object with with id %s. Skiping object.",
dobj.getOID().toString()));
continue; continue;
} else { } else {
s_log.debug("Specializing successful."); s_log.debug("Specializing successful.");
} }
//} //}
// Get the content bundle to retrieve the terms/categories. This is necessary because the bundle is // Get the content bundle to retrieve the terms/categories. This is necessary
// object which is categorised not the item itself. //because the bundle is object which is categorised not the item itself.
final ACSObject categorisedObj; final ACSObject categorisedObj;
if (object instanceof ContentPage) { if (object instanceof ContentPage) {
final ContentPage item = (ContentPage) object; final ContentPage item = (ContentPage) object;
@ -185,20 +186,23 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
categorisedObj = object; categorisedObj = object;
} }
// Get the term from the term domain used to separate the list which are associated the current object. // Get the term from the term domain used to separate the list which are associated the
// current object.
final DomainCollection terms = domain.getDirectTerms(categorisedObj); final DomainCollection terms = domain.getDirectTerms(categorisedObj);
if (terms.next()) { while (terms.next()) {
//Get the category //Get the category
final Category cat = ((Term) terms.getDomainObject()).getModel(); final Category cat = ((Term) terms.getDomainObject()).getModel();
// If a new section starts create a new section element. Ordering has to be done the theme using the // If a new section starts create a new section element. Ordering has to be done
// sortKey attribute added to the section // the theme using the sortKey attribute added to the section
if (currentCat == null) { if (currentCat == null) {
currentCat = cat; currentCat = cat;
final Element section = Navigation.newElement(content, "section"); final Element section = Navigation.newElement(content, "section");
section.addAttribute("id", cat.getID().toString()); section.addAttribute("id", cat.getID().toString());
section.addAttribute("url", cat.getURL()); section.addAttribute("url", cat.getURL());
section.addAttribute("title", cat.getName(GlobalizationHelper.getNegotiatedLocale().getLanguage())); section.addAttribute("title", cat.getName(GlobalizationHelper.
final DataAssociationCursor childCats = domain.getModel().getRelatedCategories(Category.CHILD); getNegotiatedLocale().getLanguage()));
final DataAssociationCursor childCats = domain.getModel().getRelatedCategories(
Category.CHILD);
childCats.addEqualsFilter("id", cat.getID()); childCats.addEqualsFilter("id", cat.getID());
if (childCats.next()) { if (childCats.next()) {
section.addAttribute("sortKey", childCats.get("link.sortKey").toString()); section.addAttribute("sortKey", childCats.get("link.sortKey").toString());
@ -215,12 +219,15 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
final Element section = Navigation.newElement(content, "section"); final Element section = Navigation.newElement(content, "section");
section.addAttribute("id", cat.getID().toString()); section.addAttribute("id", cat.getID().toString());
section.addAttribute("url", cat.getURL()); section.addAttribute("url", cat.getURL());
section.addAttribute("title", cat.getName(GlobalizationHelper.getNegotiatedLocale(). section.addAttribute("title", cat.getName(GlobalizationHelper.
getNegotiatedLocale().
getLanguage())); getLanguage()));
final DataAssociationCursor childCats = domain.getModel().getRelatedCategories(Category.CHILD); final DataAssociationCursor childCats = domain.getModel().
getRelatedCategories(Category.CHILD);
childCats.addEqualsFilter("id", cat.getID()); childCats.addEqualsFilter("id", cat.getID());
if (childCats.next()) { if (childCats.next()) {
section.addAttribute("sortKey", childCats.get("link.sortKey").toString()); section.
addAttribute("sortKey", childCats.get("link.sortKey").toString());
} }
childCats.close(); childCats.close();
currentSection = section; currentSection = section;
@ -246,7 +253,8 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer
final Iterator properties = getProperties().iterator(); final Iterator properties = getProperties().iterator();
while (properties.hasNext()) { while (properties.hasNext()) {
final DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next(); final DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.
next();
property.render(objects, item); property.render(objects, item);
} }

View File

@ -12,7 +12,6 @@
* rights and limitations under the License. * rights and limitations under the License.
* *
*/ */
package com.arsdigita.navigation.cms; package com.arsdigita.navigation.cms;
import com.arsdigita.navigation.NavigationModel; import com.arsdigita.navigation.NavigationModel;
@ -21,26 +20,27 @@ import com.arsdigita.london.terms.Domain;
import com.arsdigita.london.terms.Term; import com.arsdigita.london.terms.Term;
/** /**
* Use this to display the items in one specific category, * Use this to display the items in one specific category, bypassing the navigation model.
* bypassing the navigation model.
*/ */
public class CategoryDataCollectionDefinition extends CMSDataCollectionDefinition { public class CategoryDataCollectionDefinition extends CMSDataCollectionDefinition {
private Category m_category = null; private Category m_category = null;
public void setCategoryByPID(String pid, String domain) { public void setCategoryByPID(String pid, String domain) {
Domain dom = Domain.retrieve(domain); Domain dom = Domain.retrieve(domain);
Term term = dom.getTerm(pid); Term term = dom.getTerm(pid);
Category cat = term.getModel(); Category cat = term.getModel();
setCategory(cat); setCategory(cat);
} }
public void setCategory(Category category) { public void setCategory(Category category) {
m_category = category; m_category = category;
} }
/** Use the specified category if any; otherwise use the model. */ /**
* Use the specified category if any; otherwise use the model.
*/
protected Category getCategory(NavigationModel model) { protected Category getCategory(NavigationModel model) {
return (m_category != null) ? m_category : model.getCategory(); return (m_category != null) ? m_category : model.getCategory();
} }
} }

View File

@ -248,8 +248,8 @@
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="normalize-space(./contacts/contact[@contactType='commonContact']/contactentries[keyId='homepage']/value)"/> <xsl:value-of select="normalize-space(./contacts/contact[@contactType='commonContact']/contactentries[keyId='homepage']/value)"/>
</xsl:attribute> </xsl:attribute>
<xsl:if test="string-length(./titlePre) &gt; 0"> <xsl:if test="string-length(./titlepre) &gt; 0">
<xsl:value-of select="./titlePre"/> <xsl:value-of select="./titlepre"/>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
</xsl:if> </xsl:if>
<xsl:if test="string-length(./givenname) &gt; 0"> <xsl:if test="string-length(./givenname) &gt; 0">
@ -259,16 +259,16 @@
<xsl:if test="string-length(./givenname) &gt; 0"> <xsl:if test="string-length(./givenname) &gt; 0">
<xsl:value-of select="./surname"/> <xsl:value-of select="./surname"/>
</xsl:if> </xsl:if>
<xsl:if test="string-length(./titlePost) &gt; 0"> <xsl:if test="string-length(./titlepost) &gt; 0">
<xsl:text>, </xsl:text> <xsl:text>, </xsl:text>
<xsl:value-of select="./titlePost"/> <xsl:value-of select="./titlepost"/>
</xsl:if> </xsl:if>
</a> </a>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<span class="CIname memberName"> <span class="CIname memberName">
<xsl:if test="string-length(./titlePre) &gt; 0"> <xsl:if test="string-length(./titlepre) &gt; 0">
<xsl:value-of select="./titlePre"/> <xsl:value-of select="./titlepre"/>
<xsl:text> </xsl:text> <xsl:text> </xsl:text>
</xsl:if> </xsl:if>
<xsl:if test="string-length(./givenname) &gt; 0"> <xsl:if test="string-length(./givenname) &gt; 0">
@ -278,9 +278,9 @@
<xsl:if test="string-length(./givenname) &gt; 0"> <xsl:if test="string-length(./givenname) &gt; 0">
<xsl:value-of select="./surname"/> <xsl:value-of select="./surname"/>
</xsl:if> </xsl:if>
<xsl:if test="string-length(./titlePost) &gt; 0"> <xsl:if test="string-length(./titlepost) &gt; 0">
<xsl:text>, </xsl:text> <xsl:text>, </xsl:text>
<xsl:value-of select="./titlePost"/> <xsl:value-of select="./titlepost"/>
</xsl:if> </xsl:if>
</span> </span>
</xsl:otherwise> </xsl:otherwise>

View File

@ -223,6 +223,7 @@ namespace com.arsdigita.cms.contenttypes {
class AddressType class AddressType
class Agenda class Agenda
class Article class Article
class ArticleSection
class Bookmark class Bookmark
class Contact class Contact
class ContentGroup class ContentGroup
@ -248,16 +249,38 @@ namespace com.arsdigita.cms.contenttypes {
class HistoricDate class HistoricDate
class Image class Image
class InlineSite class InlineSite
class IsoCountry
class Job class Job
class LegalNotice class LegalNotice
class Link class Link
class Member
class Minutes
class MOTDItem
class MultiPartArticle
class NewsItem
class Organization
class Person
class PressRelease
class PublicPersonalProfile class PublicPersonalProfile
class PublicPersonalProfileBundle class PublicPersonalProfileBundle
class PublicPersonalProfileNavItem class PublicPersonalProfileNavItem
class ResearchNetwork
class ResearchNetworkMembership
class Service
class SimpleAddress
class SimpleOrganization
class SimpleOrganizationBundle
class SiteProxy
class Survey
class SurveyResponse
class SurveyAnswer
com.arsdigita.kernel.ACSObject <|-- Link com.arsdigita.kernel.ACSObject <|-- Link
com.arsdigita.kernel.ACSObject <|-- ResearchNetworkMembership
com.arsdigita.cms.ContentItem <|-- ContentGroup com.arsdigita.cms.ContentItem <|-- ContentGroup
com.arsdigita.cms.ContentItem <|-- ContentGroupAssociation com.arsdigita.cms.ContentItem <|-- ContentGroupAssociation
com.arsdigita.cms.ContentItem <|-- SurveyResponse
com.arsdigita.cms.ContentItem <|-- SurveyAnswer
com.arsdigita.cms.ContentBundle <|-- GenericAddressBundle com.arsdigita.cms.ContentBundle <|-- GenericAddressBundle
com.arsdigita.cms.ContentBundle <|-- GenericContactBundle com.arsdigita.cms.ContentBundle <|-- GenericContactBundle
com.arsdigita.cms.ContentBundle <|-- GenericOrganizationalUnitBundle com.arsdigita.cms.ContentBundle <|-- GenericOrganizationalUnitBundle
@ -266,6 +289,7 @@ namespace com.arsdigita.cms.contenttypes {
com.arsdigita.cms.ContentItem <|-- GenericContactEntry com.arsdigita.cms.ContentItem <|-- GenericContactEntry
com.arsdigita.cms.ContentItem <|-- DecisionTreeSectionOption com.arsdigita.cms.ContentItem <|-- DecisionTreeSectionOption
com.arsdigita.cms.ContentItem <|-- DecisionTreeOptionTarget com.arsdigita.cms.ContentItem <|-- DecisionTreeOptionTarget
com.arsdigita.cms.ContentPage <|-- ArticleSection
com.arsdigita.cms.ContentPage <|-- Bookmark com.arsdigita.cms.ContentPage <|-- Bookmark
com.arsdigita.cms.ContentPage <|-- DecisionTree com.arsdigita.cms.ContentPage <|-- DecisionTree
com.arsdigita.cms.ContentPage <|-- DecisionTreeSection com.arsdigita.cms.ContentPage <|-- DecisionTreeSection
@ -280,16 +304,32 @@ namespace com.arsdigita.cms.contenttypes {
com.arsdigita.cms.ContentPage <|-- Image com.arsdigita.cms.ContentPage <|-- Image
com.arsdigita.cms.ContentPage <|-- InlineSite com.arsdigita.cms.ContentPage <|-- InlineSite
com.arsdigita.cms.ContentPage <|-- Job com.arsdigita.cms.ContentPage <|-- Job
com.arsdigita.cms.ContentPage <|-- MOTDItem
com.arsdigita.cms.ContentPage <|-- MultiPartArticle
com.arsdigita.cms.ContentPage <|-- Organization
com.arsdigita.cms.ContentPage <|-- PublicPersonalProfile com.arsdigita.cms.ContentPage <|-- PublicPersonalProfile
com.arsdigita.cms.ContentPage <|-- ResearchNetwork
com.arsdigita.cms.ContentPage <|-- Service
com.arsdigita.cms.ContentPage <|-- SimpleAddress
com.arsdigita.cms.ContentPage <|-- SiteProxy
com.arsdigita.cms.ContentPage <|-- Survey
GenericAddress <|-- Address GenericAddress <|-- Address
GenericArticle <|-- Agenda GenericArticle <|-- Agenda
GenericArticle <|-- Article GenericArticle <|-- Article
GenericArticle <|-- Event GenericArticle <|-- Event
GenericArticle <|-- HistoricDate GenericArticle <|-- HistoricDate
GenericArticle <|-- LegalNotice GenericArticle <|-- LegalNotice
GenericArticle <|-- Minutes
GenericArticle <|-- NewsItem
GenericArticle <|-- PressRelease
GenericContact <|-- Contact GenericContact <|-- Contact
GenericPerson <|-- Member
GenericPerson <|-- Person
GenericOrganizationalUnit <|-- SimpleOrganization
GenericOrganizationalUnitBundle <|-- SimpleOrganizationBundle
ArticleSection -- com.arsdigita.cms.TextAsset
ArticleSection -- com.arsdigita.cms.ReusableImageAsset
ContentGroup -- ContentGroupAssociation ContentGroup -- ContentGroupAssociation
ContentGroupAssociation -- com.arsdigita.cms.ContentItem ContentGroupAssociation -- com.arsdigita.cms.ContentItem
DecisionTree -- DecisionTreeSection DecisionTree -- DecisionTreeSection
@ -304,8 +344,26 @@ namespace com.arsdigita.cms.contenttypes {
GenericOrganizationalUnitBundle -- GenericPersonBundle GenericOrganizationalUnitBundle -- GenericPersonBundle
Image -- com.arsdigita.cms.ImageAsset Image -- com.arsdigita.cms.ImageAsset
Link -- ContentItem Link -- ContentItem
MOTDItem -- com.arsdigita.cms.FileAsset
Organization -- com.arsdigita.cms.ImageAsset
MultiPartArticle -- ArticleSection
PublicPersonalProfileBundle -- GenericPersonBundle PublicPersonalProfileBundle -- GenericPersonBundle
PublicPersonalProfile -- PublicPersonalProfileNavItem PublicPersonalProfile -- PublicPersonalProfileNavItem
ResearchNetwork -- ResearchNetworkMembership
ResarchNetworkMembership -- Person
SimpleAddress -- IsoCountry
Survey -- com.arsdigita.formbuilder.FormSection
Survey -- SurveyResponse
SurveyResponse -- SurveyAnswer
}
namespace com.arsdigita.cms.contenttypes.xmlfeed {
class XMLFeed
com.arsdigita.cms.formbuilder.FormItem <|-- XMLFeed
XMLFeed -- com.arsdigita.cms.FileAsset
} }
namespace com.arsdigita.cms.formbuilder { namespace com.arsdigita.cms.formbuilder {