Fehlende Dateien für RelationAttribute hinzugefügt

git-svn-id: https://svn.libreccm.org/ccm/trunk@528 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2010-09-07 15:34:45 +00:00
parent 013e7cae6d
commit 6075ff4c48
3 changed files with 153 additions and 7 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -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 <code>getDomainObject()</code> that casts the returned
* <code>DomainObject</code> as a <code>CategoryLocalization</code>.
*
* @return a <code>CategoryLocalization</code> 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();
}
}