RelationAttribute
* 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-94f89814c4dfmaster
parent
6d1f718384
commit
6dd53b0920
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.math.BigDecimal;
|
|||
*
|
||||
* <p>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.</p>
|
||||
*
|
||||
* @author Stanislav Freidin (stas@arsdigita.com)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue