diff --git a/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl b/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl
new file mode 100644
index 000000000..6fe50195a
--- /dev/null
+++ b/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2010 Sören Bernstein, for the Center of Social Politics of the University of Bremen
+//
+// 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.cms;
+
+import com.arsdigita.kernel.ACSObject;
+import com.arsdigita.cms.*;
+
+object type RelationAttribute extends ContentItem {
+
+ String[1..1] attribute = cms_contacttypes.attribute VARCHAR(100);
+ String[1..1] key = cms_contacttypes.key VARCHAR(100);
+ String[1..1] lang = cms_contacttypes.lang VARCHAR(2);
+// String[1..1] name = cms_contacttypes.name VARCHAR(100);
+ String[0..1] description = cms_contacttypes.description VARCHAR(500);
+
+ unique (attribute, key, lang);
+ reference key(cms_relationAttribute.relationattribute_id);
+}
+
diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
index d069bad7f..22417aa2b 100644
--- a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
+++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
@@ -45,9 +45,9 @@ object type GenericContactEntry extends ContentItem {
}
object type GenericContactType extends ACSObject {
- String[1..1] key = cms_contacttypes.key VARCHAR(100);
- String[1..1] language = cms_contacttypes.language VARCHAR(2);
- String[1..1] name = cms_contacttypes.name VARCHAR(100);
+ String[1..1] key = cms_contacttypes.key VARCHAR(100);
+ String[1..1] language = cms_contacttypes.language VARCHAR(2);
+ String[1..1] name = cms_contacttypes.name VARCHAR(100);
reference key (cms_contacttypes.contacttypes_id);
unique (key, language);
@@ -55,10 +55,10 @@ object type GenericContactType extends ACSObject {
association {
- GenericPerson[0..1] person = join cms_contacts.contact_id
- to cms_person_contact_map.contact_id,
- join cms_person_contact_map.person_id
- to cms_persons.person_id;
+ GenericPerson[0..1] person = join cms_contacts.contact_id
+ to cms_person_contact_map.contact_id,
+ join cms_person_contact_map.person_id
+ to cms_persons.person_id;
GenericContact[0..n] contacts = join cms_persons.person_id
to cms_person_contact_map.person_id,
diff --git a/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java b/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java
new file mode 100644
index 000000000..9a80fc80e
--- /dev/null
+++ b/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java
@@ -0,0 +1,110 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.arsdigita.cms;
+
+import com.arsdigita.kernel.ACSObject;
+import com.arsdigita.kernel.ACSObjectCollection;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.persistence.Filter;
+import com.arsdigita.persistence.SessionManager;
+
+/**
+ *
+ * @author quasi
+ */
+public class RelationAttributeCollection extends ACSObjectCollection {
+
+ public static String ATTRIBUTE = RelationAttribute.ATTRIBUTE;
+ public static String KEY = RelationAttribute.KEY;
+ public static String LANGUAGE = RelationAttribute.LANGUAGE;
+
+ private Filter m_attributeFilter = null;
+ private Filter m_keyFilter = null;
+ private Filter m_languageFilter = null;
+
+ public RelationAttributeCollection() {
+ super(SessionManager.getSession().retrieve(RelationAttribute.BASE_DATA_OBJECT_TYPE));
+ }
+
+ public RelationAttributeCollection(String attribute) {
+ this();
+ this.addAttributeFilter(attribute);
+ }
+
+ public RelationAttributeCollection(DataCollection dataCollection) {
+ super(dataCollection);
+ }
+
+ /**
+ * Wrapper to getDomainObject() that casts the returned
+ * DomainObject as a CategoryLocalization.
+ *
+ * @return a CategoryLocalization for the current position in the
+ * collection.
+ **/
+ public RelationAttribute getRelationAttribute() {
+ return (RelationAttribute) getDomainObject();
+ }
+
+ @Override
+ public ACSObject getACSObject() {
+ return getRelationAttribute();
+ }
+
+
+ // Modify filter
+ public void addAttributeFilter(String attribute) {
+ m_attributeFilter = this.addEqualsFilter(ATTRIBUTE, attribute);
+ }
+
+ public boolean removeAttributeFilter(String attribute) {
+ boolean retVal = false;
+ retVal = this.removeFilter(m_attributeFilter);
+ if(retVal == true) {
+ m_attributeFilter = null;
+ }
+ return retVal;
+ }
+
+ public void addKeyFilter(String key) {
+ m_keyFilter = this.addEqualsFilter(KEY, key);
+ }
+
+ public boolean removeKeyFilter(String key) {
+ boolean retVal = false;
+ retVal = this.removeFilter(m_keyFilter);
+ if(retVal == true) {
+ m_keyFilter = null;
+ }
+ return retVal;
+ }
+
+ public void addLanguageFilter(String language) {
+ m_languageFilter = this.addEqualsFilter(LANGUAGE, language);
+ }
+
+ public boolean removeLanguageFilter(String language) {
+ boolean retVal = false;
+ retVal = this.removeFilter(m_languageFilter);
+ if(retVal == true) {
+ m_languageFilter = null;
+ }
+ return retVal;
+ }
+
+ public void removeAllFilters() {
+ this.removeAllFilters();
+ }
+
+ // Accessors
+ public String getName() {
+ return getRelationAttribute().getName();
+ }
+
+ public String getDescription() {
+ return getRelationAttribute().getDescription();
+ }
+}