From 6dd53b092017f8a5de768b71c80d0ef8d9b8296e Mon Sep 17 00:00:00 2001 From: quasi Date: Mon, 18 Oct 2010 04:26:59 +0000 Subject: [PATCH] RelationAttribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ab jetzt abgeleitet vom DomainObject, dadurch hatt man keine Abhängigkeiten mehr zu der ACSObject- und anderen Tabellen. Man kann die Tabelle nun einfach per pgAdmin3 füllen. * NullPointer -Exception gefunden und entfernt. getRelationAttribute prüft nun, ob die Collection noch vor dem ersten Element steht. git-svn-id: https://svn.libreccm.org/ccm/trunk@580 8810af33-2d31-482b-a856-94f89814c4df --- .../arsdigita/content-section/RelationAttribute.pdl | 5 +++-- .../src/com/arsdigita/cms/ItemSelectionModel.java | 2 +- .../src/com/arsdigita/cms/RelationAttribute.java | 13 +++++++++++-- .../arsdigita/cms/RelationAttributeCollection.java | 4 +--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl b/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl index a8f9c3e56..912673b10 100644 --- a/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl @@ -21,8 +21,9 @@ model com.arsdigita.cms; import com.arsdigita.kernel.ACSObject; -object type RelationAttribute extends ACSObject { +object type RelationAttribute { + BigDecimal[1..1] id = cms_relation_attribute.object_id INTEGER; String[1..1] attribute = cms_relation_attribute.attribute VARCHAR(100); String[1..1] key = cms_relation_attribute.key VARCHAR(100); String[1..1] lang = cms_relation_attribute.lang VARCHAR(2); @@ -30,6 +31,6 @@ object type RelationAttribute extends ACSObject { String[0..1] description = cms_relation_attribute.description VARCHAR(500); unique (attribute, key, lang); - reference key(cms_relation_attribute.relationattribute_id); + object key (id); } diff --git a/ccm-cms/src/com/arsdigita/cms/ItemSelectionModel.java b/ccm-cms/src/com/arsdigita/cms/ItemSelectionModel.java index 96e0367df..cecaba32f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ItemSelectionModel.java +++ b/ccm-cms/src/com/arsdigita/cms/ItemSelectionModel.java @@ -37,7 +37,7 @@ import java.math.BigDecimal; * *

It is possible to instantiate this model with a {@link * com.arsdigita.cms.ContentType} as a constructor parameter. In this - * case, the model will only instantiate items that have are of the + * case, the model will only instantiate items that are of the * specified content type, or one of it subclasses.

* * @author Stanislav Freidin (stas@arsdigita.com) diff --git a/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java b/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java index 3b74d948d..a1d3fcdc6 100644 --- a/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java +++ b/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java @@ -6,7 +6,7 @@ package com.arsdigita.cms; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.kernel.ACSObject; +import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import java.math.BigDecimal; @@ -15,8 +15,9 @@ import java.math.BigDecimal; * * @author quasi */ -public class RelationAttribute extends ACSObject { +public class RelationAttribute extends DomainObject { + public static final String ID = "id"; public static final String ATTRIBUTE = "attribute"; public static final String KEY = "key"; public static final String LANGUAGE = "lang"; @@ -67,6 +68,14 @@ public class RelationAttribute extends ACSObject { } /* accessors *****************************************************/ + public BigDecimal getID() { + return (BigDecimal) get(ID); + } + + public BigDecimal setID(BigDecimal id) { + return getID(); + } + public final String getAttribute() { return (String) get(ATTRIBUTE); } diff --git a/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java b/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java index 653554b6b..eabe3cbd3 100644 --- a/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java @@ -106,12 +106,10 @@ public class RelationAttributeCollection extends DomainCollection { // Accessors public final String getKey() { return (String) get(KEY); -// return (String) getRelationAttribute().getKey(); } public final String getLanguage() { return (String) get(LANGUAGE); -// return (String) getRelationAttribute().getLanguage(); } // Get RelationAttribute in desired language @@ -121,7 +119,7 @@ public class RelationAttributeCollection extends DomainCollection { logger.debug(String.format("this.language() = %s", this.getLanguage())); // First, test the current element - if (this.getKey().equals(key) && this.getLanguage().equals(language)) { + if(!this.isBeforeFirst() && key.equals(this.getKey()) && language.equals(this.getLanguage())) { return this.getRelationAttribute();