diff --git a/ccm-cms-portletdataprovider/src/com/arsdigita/cms/portletdataprovider/Initalizer.java b/ccm-cms-portletdataprovider/src/com/arsdigita/cms/portletdataprovider/Initalizer.java new file mode 100644 index 000000000..094a410a0 --- /dev/null +++ b/ccm-cms-portletdataprovider/src/com/arsdigita/cms/portletdataprovider/Initalizer.java @@ -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 + * @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); + } + +} diff --git a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml index 39b7593ca..fa4eb1d6e 100755 --- a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml +++ b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml @@ -1,11 +1,11 @@ + need to list a type if is adds associations that + were not in the parent type, or to remove attributes + --> - + @@ -54,27 +54,22 @@ - - + extends="com.arsdigita.cms.ContentItem" + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> - - - + extends="com.arsdigita.cms.ContentPage" + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> @@ -93,43 +88,43 @@ - - + + - + @@ -137,7 +132,7 @@ + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> @@ -162,8 +157,8 @@ + extends="com.arsdigita.cms.ContentItem" + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> @@ -181,51 +176,51 @@ - - - + + + - + + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> @@ -242,14 +237,14 @@ + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> + extends="com.arsdigita.cms.ContentItem" + traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentItemTraversalAdapter.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentItemTraversalAdapter.java index 61cf0a849..2c3730c19 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentItemTraversalAdapter.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentItemTraversalAdapter.java @@ -26,29 +26,25 @@ import com.arsdigita.domain.DomainObjectTraversalAdapter; import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; import com.arsdigita.domain.DomainObject; - /** - * An adapter for content items allowing pluggable - * assets to extend the traversal. + * An adapter for content items allowing pluggable assets to extend the traversal. */ -public class ContentItemTraversalAdapter - extends SimpleDomainObjectTraversalAdapter { - - private static final Logger s_log = - Logger.getLogger(ContentItemTraversalAdapter.class); - +public class ContentItemTraversalAdapter + extends SimpleDomainObjectTraversalAdapter { + + private static final Logger s_log = + Logger.getLogger(ContentItemTraversalAdapter.class); private static final Map s_assetAdapters = new HashMap(); - + public static void registerAssetAdapter(String path, DomainObjectTraversalAdapter adapter, String context) { if (s_log.isDebugEnabled()) { - s_log.debug("Registering asset adapter " + path + - " adapter " + adapter.getClass() + - " in context " + context); + s_log.debug("Registering asset adapter " + path + " adapter " + adapter.getClass() + + " in context " + context); } - - Map adapters = (Map)s_assetAdapters.get(context); + + Map adapters = (Map) s_assetAdapters.get(context); if (adapters == null) { adapters = new HashMap(); s_assetAdapters.put(context, adapters); @@ -59,15 +55,14 @@ public class ContentItemTraversalAdapter public ContentItemTraversalAdapter() { super(); } - + public ContentItemTraversalAdapter(SimpleDomainObjectTraversalAdapter adapter) { super(adapter); } /** - * If the path references an asset, then delegates - * to the asset's adapter, otherwise delegates to - * the content item's primary adapter + * If the path references an asset, then delegates to the asset's adapter, otherwise delegates + * to the content item's primary adapter */ @Override public boolean processProperty(DomainObject obj, @@ -75,15 +70,14 @@ public class ContentItemTraversalAdapter Property prop, String context) { 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/"; int offset = path.indexOf("/", prefix.length()); if (offset == -1) { String base = path.substring(prefix.length()); - Map adapters = (Map)s_assetAdapters.get(context); - if (adapters != null && - adapters.containsKey(base)) { + Map adapters = (Map) s_assetAdapters.get(context); + if (adapters != null && adapters.containsKey(base)) { if (s_log.isDebugEnabled()) { s_log.debug("Following asset"); } @@ -98,20 +92,17 @@ public class ContentItemTraversalAdapter String base = path.substring(prefix.length(), offset); String rest = path.substring(offset + 1); - Map adapters = (Map)s_assetAdapters.get(context); - if (adapters != null && - adapters.containsKey(base)) { - DomainObjectTraversalAdapter adapter = (DomainObjectTraversalAdapter) - adapters.get(base); + Map adapters = (Map) s_assetAdapters.get(context); + if (adapters != null && adapters.containsKey(base)) { + DomainObjectTraversalAdapter adapter = (DomainObjectTraversalAdapter) adapters.get( + base); if (s_log.isDebugEnabled()) { - s_log.debug("Delegate to asset adapter " + base + - " " + rest + " " + adapter); + s_log.debug("Delegate to asset adapter " + base + " " + rest + " " + adapter); } return adapter.processProperty(obj, "/object/" + rest, prop, context); } else { if (s_log.isDebugEnabled()) { - s_log.debug("Delegate to primary adapter " + base + - " " + rest); + s_log.debug("Delegate to primary adapter " + base + " " + rest); } return super.processProperty(obj, path, prop, context); } diff --git a/ccm-core/src/com/arsdigita/persistence/DataQuery.java b/ccm-core/src/com/arsdigita/persistence/DataQuery.java index c8662f5fe..fba9571d6 100755 --- a/ccm-core/src/com/arsdigita/persistence/DataQuery.java +++ b/ccm-core/src/com/arsdigita/persistence/DataQuery.java @@ -299,7 +299,6 @@ public interface DataQuery { * * @return The filter that has just been added to the query **/ - Filter addFilter(String conditions); diff --git a/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionDefinition.java b/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionDefinition.java index 15201b25c..02cb7ada4 100644 --- a/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionDefinition.java +++ b/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionDefinition.java @@ -7,38 +7,41 @@ import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.Filter; /** - * An extension to the {@link CMSDataCollectionDefinition}. With this definition it is possible to filter an object - * list using a second category system/terms domain. This class is designed to be used together with the - * {@link CategorisedDataCollectionRenderer} which displays the objects in a list with several sections. - * + * An extension to the {@link CMSDataCollectionDefinition}. With this definition it is possible to + * filter an object list using a second category system/terms domain. This class is designed to be + * used together with the {@link CategorisedDataCollectionRenderer} which displays the objects in a + * list with several sections. + * * @author Jens Pelzetter * @version $Id$ */ -public class CategorisedDataCollectionDefinition extends CMSDataCollectionDefinition{ - +public class CategorisedDataCollectionDefinition extends CMSDataCollectionDefinition { + private String termDomain; - + public String getTermDomain() { return termDomain; } - + public void setTermDomain(final String termDomain) { this.termDomain = termDomain; } - + @Override protected void applyFilters(final DataCollection objects, final NavigationModel model) { super.applyFilters(objects, model); - + final Domain domain = Domain.retrieve(termDomain); final Category rootCat = domain.getModel(); - + //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()); - - objects.addOrder("parent.categories.link.sortKey"); + + //objects.addOrder("parent.categories.link.sortKey"); //objects.addOrder("title desc"); } - + } diff --git a/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionRenderer.java b/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionRenderer.java index 340fc55aa..83677bdf4 100644 --- a/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionRenderer.java +++ b/ccm-navigation/src/com/arsdigita/navigation/cms/CategorisedDataCollectionRenderer.java @@ -27,11 +27,12 @@ import org.apache.log4j.Logger; /** *

- * An extended {@code DataCollectionRenderer} which displays a object list split into several sections. The sections - * are created using a second category system/term domain set using the {@link #setTermDomain(java.lang.String)} - * method in the JSP template. This renderer is designed to be used together with the - * {@link CategorisedDataCollectionRenderer}. To use them, a special JSP template is required. More specificly a JSP - * template using these two class would look like this (only relevant parts shown): + * An extended {@code DataCollectionRenderer} which displays a object list split into several + * sections. The sections are created using a second category system/term domain set using the + * {@link #setTermDomain(java.lang.String)} method in the JSP template. This renderer is designed to + * be used together with the {@link CategorisedDataCollectionRenderer}. To use them, a special JSP + * template is required. More specificly a JSP template using these two class would look like this + * (only relevant parts shown): *

*
  * ...
@@ -40,25 +41,25 @@ import org.apache.log4j.Logger;
  * 
  *   CategorisedDataCollectionDefinition definition = new CategorisedDataCollectionDefinition();
  *   CategorisedDataCollectionRenderer renderer = new CategorisedDataCollectionRenderer();
- *   
+ *
  *   definition.setObjectType("com.arsdigita.cms.contenttypes.GenericPerson");
  *   definition.setDescendCategories(false);
  *   definition.setTermDomain("memberTypes");
- * 
+ *
  *   renderer.setTermDomain("memberTypes");
- * 
+ *
  *   ((com.arsdigita.navigation.ui.object.SimpleObjectList) itemList).setDefinition(definition);
  *   ((com.arsdigita.navigation.ui.object.SimpleObjectList) itemList).setRenderer(renderer);
- * 
+ *
  *   ...
  * 
  * 
*

- * This example will create a list of objects of the type {@link GenericPerson}, split into sections definied by the - * terms domain identified by the key {@code memberTypes}. Only the root terms of the domain are used for creating the - * sections. + * This example will create a list of objects of the type {@link GenericPerson}, split into sections + * definied by the terms domain identified by the key {@code memberTypes}. Only the root terms of + * the domain are used for creating the sections. *

- * + * * @author Jens Pelzetter * @version $Id$ */ @@ -143,8 +144,7 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer } paginator.addAttribute("pageParam", pageParam); - paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map). - toString()); + paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map).toString()); // Quasimodo: End paginator.addAttribute("pageNumber", Long.toString(pageNumber)); @@ -167,16 +167,17 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer //if (m_specializeObjects) { object = (ACSObject) DomainObjectFactory.newInstance(dobj); if (object == null) { - s_log.error(String.format("Failed to specialize object with with id %s. Skiping object.", dobj. - getOID().toString())); + s_log.error(String.format( + "Failed to specialize object with with id %s. Skiping object.", + dobj.getOID().toString())); continue; } else { s_log.debug("Specializing successful."); } //} - // Get the content bundle to retrieve the terms/categories. This is necessary because the bundle is - // object which is categorised not the item itself. + // Get the content bundle to retrieve the terms/categories. This is necessary + //because the bundle is object which is categorised not the item itself. final ACSObject categorisedObj; if (object instanceof ContentPage) { final ContentPage item = (ContentPage) object; @@ -185,20 +186,23 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer 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); - if (terms.next()) { + while (terms.next()) { //Get the category 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 - // sortKey attribute added to the section + // If a new section starts create a new section element. Ordering has to be done + // the theme using the sortKey attribute added to the section if (currentCat == null) { currentCat = cat; final Element section = Navigation.newElement(content, "section"); section.addAttribute("id", cat.getID().toString()); section.addAttribute("url", cat.getURL()); - section.addAttribute("title", cat.getName(GlobalizationHelper.getNegotiatedLocale().getLanguage())); - final DataAssociationCursor childCats = domain.getModel().getRelatedCategories(Category.CHILD); + section.addAttribute("title", cat.getName(GlobalizationHelper. + getNegotiatedLocale().getLanguage())); + final DataAssociationCursor childCats = domain.getModel().getRelatedCategories( + Category.CHILD); childCats.addEqualsFilter("id", cat.getID()); if (childCats.next()) { section.addAttribute("sortKey", childCats.get("link.sortKey").toString()); @@ -215,12 +219,15 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer final Element section = Navigation.newElement(content, "section"); section.addAttribute("id", cat.getID().toString()); section.addAttribute("url", cat.getURL()); - section.addAttribute("title", cat.getName(GlobalizationHelper.getNegotiatedLocale(). + section.addAttribute("title", cat.getName(GlobalizationHelper. + getNegotiatedLocale(). getLanguage())); - final DataAssociationCursor childCats = domain.getModel().getRelatedCategories(Category.CHILD); + final DataAssociationCursor childCats = domain.getModel(). + getRelatedCategories(Category.CHILD); childCats.addEqualsFilter("id", cat.getID()); if (childCats.next()) { - section.addAttribute("sortKey", childCats.get("link.sortKey").toString()); + section. + addAttribute("sortKey", childCats.get("link.sortKey").toString()); } childCats.close(); currentSection = section; @@ -246,7 +253,8 @@ public class CategorisedDataCollectionRenderer extends CMSDataCollectionRenderer final Iterator properties = getProperties().iterator(); while (properties.hasNext()) { - final DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next(); + final DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties. + next(); property.render(objects, item); } diff --git a/ccm-navigation/src/com/arsdigita/navigation/cms/CategoryDataCollectionDefinition.java b/ccm-navigation/src/com/arsdigita/navigation/cms/CategoryDataCollectionDefinition.java index 688da94c7..b441e9498 100755 --- a/ccm-navigation/src/com/arsdigita/navigation/cms/CategoryDataCollectionDefinition.java +++ b/ccm-navigation/src/com/arsdigita/navigation/cms/CategoryDataCollectionDefinition.java @@ -12,7 +12,6 @@ * rights and limitations under the License. * */ - package com.arsdigita.navigation.cms; import com.arsdigita.navigation.NavigationModel; @@ -21,26 +20,27 @@ import com.arsdigita.london.terms.Domain; import com.arsdigita.london.terms.Term; /** - * Use this to display the items in one specific category, - * bypassing the navigation model. + * Use this to display the items in one specific category, bypassing the navigation model. */ public class CategoryDataCollectionDefinition extends CMSDataCollectionDefinition { private Category m_category = null; public void setCategoryByPID(String pid, String domain) { - Domain dom = Domain.retrieve(domain); - Term term = dom.getTerm(pid); - Category cat = term.getModel(); - setCategory(cat); + Domain dom = Domain.retrieve(domain); + Term term = dom.getTerm(pid); + Category cat = term.getModel(); + setCategory(cat); } 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) { - return (m_category != null) ? m_category : model.getCategory(); + return (m_category != null) ? m_category : model.getCategory(); } } diff --git a/ccm-sci-bundle/web/themes/mandalay/user/includes/types/SciMember/SciMember.xsl b/ccm-sci-bundle/web/themes/mandalay/user/includes/types/SciMember/SciMember.xsl index be9d7c3c8..83b04bd6b 100644 --- a/ccm-sci-bundle/web/themes/mandalay/user/includes/types/SciMember/SciMember.xsl +++ b/ccm-sci-bundle/web/themes/mandalay/user/includes/types/SciMember/SciMember.xsl @@ -248,8 +248,8 @@ - - + + @@ -259,16 +259,16 @@ - + , - + - - + + @@ -278,9 +278,9 @@ - + , - + diff --git a/doc/PDLEntities.puml b/doc/PDLEntities.puml index f64d697be..67084d65d 100644 --- a/doc/PDLEntities.puml +++ b/doc/PDLEntities.puml @@ -223,6 +223,7 @@ namespace com.arsdigita.cms.contenttypes { class AddressType class Agenda class Article + class ArticleSection class Bookmark class Contact class ContentGroup @@ -248,16 +249,38 @@ namespace com.arsdigita.cms.contenttypes { class HistoricDate class Image class InlineSite + class IsoCountry class Job class LegalNotice class Link + class Member + class Minutes + class MOTDItem + class MultiPartArticle + class NewsItem + class Organization + class Person + class PressRelease class PublicPersonalProfile class PublicPersonalProfileBundle 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 <|-- ResearchNetworkMembership com.arsdigita.cms.ContentItem <|-- ContentGroup com.arsdigita.cms.ContentItem <|-- ContentGroupAssociation + com.arsdigita.cms.ContentItem <|-- SurveyResponse + com.arsdigita.cms.ContentItem <|-- SurveyAnswer com.arsdigita.cms.ContentBundle <|-- GenericAddressBundle com.arsdigita.cms.ContentBundle <|-- GenericContactBundle com.arsdigita.cms.ContentBundle <|-- GenericOrganizationalUnitBundle @@ -266,6 +289,7 @@ namespace com.arsdigita.cms.contenttypes { com.arsdigita.cms.ContentItem <|-- GenericContactEntry com.arsdigita.cms.ContentItem <|-- DecisionTreeSectionOption com.arsdigita.cms.ContentItem <|-- DecisionTreeOptionTarget + com.arsdigita.cms.ContentPage <|-- ArticleSection com.arsdigita.cms.ContentPage <|-- Bookmark com.arsdigita.cms.ContentPage <|-- DecisionTree com.arsdigita.cms.ContentPage <|-- DecisionTreeSection @@ -280,16 +304,32 @@ namespace com.arsdigita.cms.contenttypes { com.arsdigita.cms.ContentPage <|-- Image com.arsdigita.cms.ContentPage <|-- InlineSite 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 <|-- ResearchNetwork + com.arsdigita.cms.ContentPage <|-- Service + com.arsdigita.cms.ContentPage <|-- SimpleAddress + com.arsdigita.cms.ContentPage <|-- SiteProxy + com.arsdigita.cms.ContentPage <|-- Survey GenericAddress <|-- Address GenericArticle <|-- Agenda GenericArticle <|-- Article GenericArticle <|-- Event GenericArticle <|-- HistoricDate GenericArticle <|-- LegalNotice + GenericArticle <|-- Minutes + GenericArticle <|-- NewsItem + GenericArticle <|-- PressRelease GenericContact <|-- Contact + GenericPerson <|-- Member + GenericPerson <|-- Person + GenericOrganizationalUnit <|-- SimpleOrganization + GenericOrganizationalUnitBundle <|-- SimpleOrganizationBundle - + ArticleSection -- com.arsdigita.cms.TextAsset + ArticleSection -- com.arsdigita.cms.ReusableImageAsset ContentGroup -- ContentGroupAssociation ContentGroupAssociation -- com.arsdigita.cms.ContentItem DecisionTree -- DecisionTreeSection @@ -304,8 +344,26 @@ namespace com.arsdigita.cms.contenttypes { GenericOrganizationalUnitBundle -- GenericPersonBundle Image -- com.arsdigita.cms.ImageAsset Link -- ContentItem + MOTDItem -- com.arsdigita.cms.FileAsset + Organization -- com.arsdigita.cms.ImageAsset + MultiPartArticle -- ArticleSection PublicPersonalProfileBundle -- GenericPersonBundle 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 {