From b5e742dca46d7d46e7fdc2caa092a2c2fd3b4c96 Mon Sep 17 00:00:00 2001 From: pb Date: Sat, 1 Jun 2013 09:08:44 +0000 Subject: [PATCH] Erste Variane von DublinCore standard Element Set Version 1.1. Kompiliert noch nicht! git-svn-id: https://svn.libreccm.org/ccm/trunk@2159 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms-assets-dublincore/application.xml | 27 ++ .../cms/contentassets/DublinCoreES.pdl | 133 +++++++ .../dc-query-getRelatedItems.pdl | 78 ++++ .../oracle-se-create.sql | 2 + .../postgres-create.sql | 4 + .../upgrade/oracle-se-1.4.2-1.4.3.sql | 1 + .../upgrade/oracle-se-6.3.0-6.3.1.sql | 7 + .../upgrade/postgres-1.4.2-1.4.3.sql | 5 + .../upgrade/postgres-6.3.0-6.3.1.sql | 12 + .../cms/contentassets/DublinCore.xml | 34 ++ .../src/ccm-cms-assets-dublincore.config | 5 + .../src/ccm-cms-assets-dublincore.load | 18 + .../src/ccm-cms-assets-dublincore.upgrade | 11 + .../cms/contentassets/DublinCoreConfig.java | 168 +++++++++ .../DublinCoreConfig_parameter.properties | 44 +++ .../contentassets/DublinCoreInitializer.java | 92 +++++ .../DublinCoreResources.properties | 2 + .../contentassets/RelatedItemsQueryImpl.java | 68 ++++ .../arsdigita/cms/contentassets/package.html | 44 +++ .../cms/contentassets/ui/DublinCoreEdit.java | 60 +++ .../cms/contentassets/ui/DublinCoreForm.java | 68 ++++ .../ui/DublinCoreFormSection.java | 342 ++++++++++++++++++ .../contentassets/ui/DublinCoreSummary.java | 301 +++++++++++++++ .../cms/contentassets/DublinSuite.java | 51 +++ .../cms/contentassets/DublinTestSetup.java | 50 +++ .../cms/contentassets/RelatedItemsTest.java | 243 +++++++++++++ .../contentassets/dublincore/xsl/metadata.xsl | 19 + 27 files changed, 1889 insertions(+) create mode 100755 ccm-cms-assets-dublincore/application.xml create mode 100755 ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/DublinCoreES.pdl create mode 100755 ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/dc-query-getRelatedItems.pdl create mode 100755 ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/oracle-se-create.sql create mode 100755 ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/postgres-create.sql create mode 100755 ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-1.4.2-1.4.3.sql create mode 100755 ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-6.3.0-6.3.1.sql create mode 100755 ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-1.4.2-1.4.3.sql create mode 100755 ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-6.3.0-6.3.1.sql create mode 100755 ccm-cms-assets-dublincore/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/DublinCore.xml create mode 100755 ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.config create mode 100755 ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.load create mode 100755 ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.upgrade create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/DublinCoreConfig.java create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/DublinCoreConfig_parameter.properties create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/DublinCoreInitializer.java create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/DublinCoreResources.properties create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/RelatedItemsQueryImpl.java create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/package.html create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/ui/DublinCoreEdit.java create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/ui/DublinCoreForm.java create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/ui/DublinCoreFormSection.java create mode 100755 ccm-cms-assets-dublincore/src/com/arsdigita/cms/contentassets/ui/DublinCoreSummary.java create mode 100755 ccm-cms-assets-dublincore/test/src/com/arsdigita/cms/contentassets/DublinSuite.java create mode 100755 ccm-cms-assets-dublincore/test/src/com/arsdigita/cms/contentassets/DublinTestSetup.java create mode 100755 ccm-cms-assets-dublincore/test/src/com/arsdigita/cms/contentassets/RelatedItemsTest.java create mode 100755 ccm-cms-assets-dublincore/web/themes/heirloom/contentassets/dublincore/xsl/metadata.xsl diff --git a/ccm-cms-assets-dublincore/application.xml b/ccm-cms-assets-dublincore/application.xml new file mode 100755 index 000000000..a0504faef --- /dev/null +++ b/ccm-cms-assets-dublincore/application.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + The Dublin Core asset for compliance with the Dublin Core Metadata + standard. + + This module is a relocation of former ccm-ldn-dublin. + + The Red Hat Web Application Framework is a platform for writing + database-backed web applications in Java. + + diff --git a/ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/DublinCoreES.pdl b/ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/DublinCoreES.pdl new file mode 100755 index 000000000..c3de54adc --- /dev/null +++ b/ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/DublinCoreES.pdl @@ -0,0 +1,133 @@ +// +// Copyright (C) 2004 Red Hat Inc. All Rights Reserved. +// +// The contents of this file are subject to the Open Software License v2.1 +// (the "License"); you may not use this file except in compliance with the +// License. You may obtain a copy of the License at +// http://rhea.redhat.com/licenses/osl2.1.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. +// + +model com.arsdigita.cms.contentassets; + +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ContentPage; + + +object type DublinCoreES extends ContentItem { + String dcContributor = ca_dublincore_dces.contributor VARCHAR(4000); + String dcCoverage = ca_dublincore_dces.coverage VARCHAR(300); + String dcCreator = ca_dublincore_dces.creator VARCHAR(300); + String dcDate = ca_dublincore_dces.date VARCHAR(100); + String dcDescription = ca_dublincore_dces.description VARCHAR(4000); + String dcIdentifier = ca_dublincore_dces.identifier VARCHAR(4000); + String dcLanguage = ca_dublincore_dces.language VARCHAR(3); + String dcPublisher = ca_dublincore_dces.publisher VARCHAR(4000); + String dcRelation = ca_dublincore_dces.relation VARCHAR(4000); + String dcRights = ca_dublincore_dces.rights VARCHAR(4000); + String dcSource = ca_dublincore_dces.source VARCHAR(4000); + String dcSubject = ldn_dublin_core_items.subject VARCHAR(4000); + String dcType = ca_dublincore_dces.type VARCHAR(4000); + + reference key(ca_dublincore_dces.dces_id); +} + +association { + composite ContentItem[1..1] dcesOwner = join ca_dublincore_dces.item_id + to cms_items.item_id; + component DublinCoreES[0..1] dublinCore = join cms_items.item_id + to ca_dublincore_dces.item_id; +} + + +// This query returns related items with an exact, or subcategory match. +query AllRelatedItems { + BigDecimal itemID; + String title; + String type; + String objectType; + + do { + select distinct i.item_id, + p.title, + t.label, + o.object_type + from cms_items i, + acs_objects o, + cms_pages p, + content_types t, + cat_object_category_map ocm1, + cat_object_category_map ocm2, + cat_cat_subcat_trans_index ccs1, + cat_cat_subcat_trans_index ccs2, + cat_category_purpose_map m + where i.version = 'live' + and i.item_id <> :itemID + and p.item_id = i.item_id + and i.item_id = o.object_id + and t.type_id = i.type_id + and ocm1.object_id = i.item_id + and ocm1.category_id = ccs2.subcategory_id + and ocm2.object_id = :itemID + and ocm2.category_id = ccs1.subcategory_id + and m.purpose_id = :purposeID + and ccs1.category_id = m.category_id + and ccs2.category_id = ocm2.category_id + } map { + itemID = i.item_id; + title = p.title; + type = t.label; + objectType = o.object_type; + } +} + +// The above query is not entirely clear since I've +// removed the nested queries in favour of joins +// +// The basic plan is: +// Get all live content items +// with a 'Subject' category matching +// a subject category assigned to item foo +// +// The complication is that it needs to treat +// subject categories heirarchically. + +// To do this we pull out all 'subject' categories, +// then restrict it by those that are assigned to the +// current item. + +// This query should be equivalent to the one above +// select i.item_id, +// p.title, +// t.label +// from cms_items i, +// cms_pages p, +// content_types t, +// cat_object_category_map ocm1 +// where i.version = 'live' +// and i.item_id <> 734036 +// and p.item_id = i.item_id +// and t.type_id = i.type_id +// and ocm1.object_id = i.item_id +// and ocm1.category_id in ( +// -- Get all categories with the specified +// -- category purpose +// select ccs1.subcategory_id +// from cat_cat_subcat_trans_index ccs1, +// cat_category_purpose_map m +// where m.purpose_id = 9909 +// and ccs1.category_id = m.category_id +// and ccs.subcategory_id in ( +// -- Get all categories & children for item +// select ccs2.subcategory_id +// from cat_object_category_map ocm2, +// cat_cat_subcat_trans_index ccs2 +// where ocm2.object_id = 734036 +// and ocm2.category_id = ccs2.category_id +// ) +// ); +// diff --git a/ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/dc-query-getRelatedItems.pdl b/ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/dc-query-getRelatedItems.pdl new file mode 100755 index 000000000..90e0b27a8 --- /dev/null +++ b/ccm-cms-assets-dublincore/pdl/com/arsdigita/cms/contentassets/dc-query-getRelatedItems.pdl @@ -0,0 +1,78 @@ +// +// 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. +// +// 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 + +model com.arsdigita.london.dublin; + + +// Pull out all items which have: +// * Matching LGCL category ID +// * Not in a subcat of the current Nav cat +// * Matching first Dublin keywords +query getRelatedItems { + BigDecimal[1..1] itemID; + BigDecimal[1..1] workingID; + String[1..1] title; + String[1..1] type; + String[1..1] objectType; + + do { + select ci.item_id, + ci.master_id, + cp.title, + ct.label, + ao.object_type + from + ( + select distinct bdm.object_id as unique_bundle_id + from + cat_object_category_map bsm, + cat_object_category_map bdm, + trm_terms tsd, + cms_bundles cb + where bsm.object_id = :bundleID + and bsm.category_id = bdm.category_id + and bdm.category_id = tsd.model_category_id + and tsd.domain = :subjectDomain + and cb.bundle_id = bdm.object_id + and bdm.object_id not in ( + select bnm.object_id + from cat_object_category_map bnm, + cat_cat_subcat_trans_index sti + where bnm.category_id = sti.subcategory_id + and sti.category_id = :navCategoryID + )) unique_bundles, + cms_items ci, + cms_pages cp, + acs_objects ao, + content_types ct, + ldn_dublin_core_items dci + where ci.parent_id = unique_bundles.unique_bundle_id + and ci.item_id = cp.item_id + and ci.item_id = ao.object_id + and ci.item_id != :itemID + and ci.type_id = ct.type_id + and ci.item_id = dci.item_id + and dci.keywords like :keyword || '%' + and ci.version = 'live' + } map { + itemID = ci.item_id; + workingID = ci.master_id; + title = cp.title; + type = ct.label; + objectType = ao.object_type; + } +} diff --git a/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/oracle-se-create.sql b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/oracle-se-create.sql new file mode 100755 index 000000000..1dcc59ed8 --- /dev/null +++ b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/oracle-se-create.sql @@ -0,0 +1,2 @@ +@@ ddl/oracle-se/create.sql +@@ ddl/oracle-se/deferred.sql diff --git a/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/postgres-create.sql b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/postgres-create.sql new file mode 100755 index 000000000..38209a696 --- /dev/null +++ b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/postgres-create.sql @@ -0,0 +1,4 @@ +begin; +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql +end; diff --git a/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-1.4.2-1.4.3.sql b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-1.4.2-1.4.3.sql new file mode 100755 index 000000000..005d7c4bf --- /dev/null +++ b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-1.4.2-1.4.3.sql @@ -0,0 +1 @@ +alter table ldn_dublin_core_items add ccn_portal_instance varchar2(200); diff --git a/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-6.3.0-6.3.1.sql b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-6.3.0-6.3.1.sql new file mode 100755 index 000000000..8788e7dc0 --- /dev/null +++ b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/oracle-se-6.3.0-6.3.1.sql @@ -0,0 +1,7 @@ +alter table ldn_dublin_core_items add + (item_id integer constraint ldn_dub_cor_ite_ite_id_f_f7q6_ references cms_items(item_id)); +update ldn_dublin_core_items dc + set item_id + = (select dcm.item_id from LDN_DUBLIN_CORE_ITEM_MAP dcm where dcm.dublin_id=dc.dublin_id); + +drop table ldn_dublin_core_item_map; diff --git a/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-1.4.2-1.4.3.sql b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-1.4.2-1.4.3.sql new file mode 100755 index 000000000..9c4d7a98b --- /dev/null +++ b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-1.4.2-1.4.3.sql @@ -0,0 +1,5 @@ +begin; + +alter table ldn_dublin_core_items add ccn_portal_instance varchar(200); + +commit; diff --git a/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-6.3.0-6.3.1.sql b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-6.3.0-6.3.1.sql new file mode 100755 index 000000000..4315d251a --- /dev/null +++ b/ccm-cms-assets-dublincore/sql/ccm-cms-assets-dublincore/upgrade/postgres-6.3.0-6.3.1.sql @@ -0,0 +1,12 @@ +begin; + + alter table ldn_dublin_core_items add + item_id integer constraint ldn_dub_cor_ite_ite_id_f_f7q6_ references cms_items(item_id); + update ldn_dublin_core_items + set item_id = dcm.item_id + from LDN_DUBLIN_CORE_ITEM_MAP dcm + where dcm.dublin_id=ldn_dublin_core_items.dublin_id; + + drop table ldn_dublin_core_item_map; + +commit; diff --git a/ccm-cms-assets-dublincore/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/DublinCore.xml b/ccm-cms-assets-dublincore/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/DublinCore.xml new file mode 100755 index 000000000..edc01c00d --- /dev/null +++ b/ccm-cms-assets-dublincore/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/DublinCore.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.config b/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.config new file mode 100755 index 000000000..ab7589cf6 --- /dev/null +++ b/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.config @@ -0,0 +1,5 @@ + + + + diff --git a/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.load b/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.load new file mode 100755 index 000000000..1448d1f47 --- /dev/null +++ b/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.load @@ -0,0 +1,18 @@ + + + +
+ +
+ + + + + + + + + + diff --git a/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.upgrade b/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.upgrade new file mode 100755 index 000000000..460e5d4d2 --- /dev/null +++ b/ccm-cms-assets-dublincore/src/ccm-cms-assets-dublincore.upgrade @@ -0,0 +1,11 @@ + + +