RelationAttribute
* Abgeleitet von ACSObject * Diverse Anpassungen * Kopiliert, ist aber noch nicht vollständig git-svn-id: https://svn.libreccm.org/ccm/trunk@565 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
ec89055598
commit
e2081752e1
|
|
@ -20,17 +20,16 @@
|
||||||
model com.arsdigita.cms;
|
model com.arsdigita.cms;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.cms.*;
|
|
||||||
|
|
||||||
object type RelationAttribute extends ContentItem {
|
object type RelationAttribute extends ACSObject {
|
||||||
|
|
||||||
String[1..1] attribute = cms_relation_attribute.attribute VARCHAR(100);
|
String[1..1] attribute = cms_relation_attribute.attribute VARCHAR(100);
|
||||||
String[1..1] key = cms_relation_attribute.key VARCHAR(100);
|
String[1..1] key = cms_relation_attribute.key VARCHAR(100);
|
||||||
String[1..1] lang = cms_relation_attribute.lang VARCHAR(2);
|
String[1..1] lang = cms_relation_attribute.lang VARCHAR(2);
|
||||||
// String[1..1] name = cms_relation_attribute.name VARCHAR(100);
|
String[1..1] name = cms_relation_attribute.name VARCHAR(100);
|
||||||
String[0..1] description = cms_relation_attribute.description VARCHAR(500);
|
String[0..1] description = cms_relation_attribute.description VARCHAR(500);
|
||||||
|
|
||||||
unique (attribute, key, lang);
|
unique (attribute, key, lang);
|
||||||
reference key(cms_relationAttribute.relationattribute_id);
|
reference key(cms_relation_attribute.relationattribute_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,15 +44,6 @@ 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);
|
|
||||||
|
|
||||||
reference key (cms_contacttypes.contacttypes_id);
|
|
||||||
unique (key, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
association {
|
association {
|
||||||
|
|
||||||
GenericPerson[0..1] person = join cms_contacts.contact_id
|
GenericPerson[0..1] person = join cms_contacts.contact_id
|
||||||
|
|
@ -67,7 +58,6 @@ association {
|
||||||
|
|
||||||
// Link Attribute
|
// Link Attribute
|
||||||
BigDecimal[0..1] contact_order = cms_person_contact_map.contact_order INTEGER;
|
BigDecimal[0..1] contact_order = cms_person_contact_map.contact_order INTEGER;
|
||||||
// Can't use a join statement here because contacttype_id is not unique
|
|
||||||
String[0..1] contact_type = cms_person_contact_map.key VARCHAR(100);
|
String[0..1] contact_type = cms_person_contact_map.key VARCHAR(100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
package com.arsdigita.cms;
|
package com.arsdigita.cms;
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -14,13 +15,13 @@ import java.math.BigDecimal;
|
||||||
*
|
*
|
||||||
* @author quasi
|
* @author quasi
|
||||||
*/
|
*/
|
||||||
public class RelationAttribute extends ContentItem {
|
public class RelationAttribute extends ACSObject {
|
||||||
|
|
||||||
public static final String ATTRIBUTE = "attribute";
|
public static final String ATTRIBUTE = "attribute";
|
||||||
public static final String KEY = "KEY";
|
public static final String KEY = "key";
|
||||||
public static final String LANGUAGE = "lang";
|
public static final String LANGUAGE = "lang";
|
||||||
//public static final String NAME = "name";
|
public static final String NAME = "name";
|
||||||
public static final String DESCRIPTION = "DESCRIPTION";
|
public static final String DESCRIPTION = "description";
|
||||||
/** Data object type for this domain object */
|
/** Data object type for this domain object */
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.RelationAttribute";
|
"com.arsdigita.cms.RelationAttribute";
|
||||||
|
|
@ -40,7 +41,6 @@ public class RelationAttribute extends ContentItem {
|
||||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RelationAttribute(DataObject obj) {
|
public RelationAttribute(DataObject obj) {
|
||||||
super(obj);
|
super(obj);
|
||||||
}
|
}
|
||||||
|
|
@ -49,60 +49,62 @@ public class RelationAttribute extends ContentItem {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RelationAttribute(String key, String language, String name) {
|
||||||
|
this();
|
||||||
|
setKey(key);
|
||||||
|
setLanguage(language);
|
||||||
|
setName(name);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the base PDL object type for this item. Child classes
|
* @return the base PDL object type for this item. Child classes
|
||||||
* should override this method to return the correct value
|
* should override this method to return the correct value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getBaseDataObjectType() {
|
public String getBaseDataObjectType() {
|
||||||
return BASE_DATA_OBJECT_TYPE;
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* accessors *****************************************************/
|
/* accessors *****************************************************/
|
||||||
public String getAttribute() {
|
public final String getAttribute() {
|
||||||
return (String) get(ATTRIBUTE);
|
return (String) get(ATTRIBUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttribute(String attribute) {
|
public final void setAttribute(String attribute) {
|
||||||
set(ATTRIBUTE, attribute);
|
set(ATTRIBUTE, attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public final String getKey() {
|
||||||
return (String) get(KEY);
|
return (String) get(KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(String key) {
|
public final void setKey(String key) {
|
||||||
set(KEY, key);
|
set(KEY, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public final String getLanguage() {
|
||||||
public String getLanguage() {
|
|
||||||
return (String) get(LANGUAGE);
|
return (String) get(LANGUAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public final void setLanguage(String language) {
|
||||||
public void setLanguage(String language) {
|
|
||||||
set(LANGUAGE, language);
|
set(LANGUAGE, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
public final String getName() {
|
||||||
// public String getName() {
|
return (String) get(NAME);
|
||||||
// return (String) get(NAME);
|
}
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void setName(String name) {
|
|
||||||
// set(NAME, name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getDescription() {
|
public final void setName(String name) {
|
||||||
|
set(NAME, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getDescription() {
|
||||||
return (String) get(DESCRIPTION);
|
return (String) get(DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public final void setDescription(String description) {
|
||||||
set(DESCRIPTION, description);
|
set(DESCRIPTION, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
|
|
||||||
package com.arsdigita.cms;
|
package com.arsdigita.cms;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.kernel.ACSObjectCollection;
|
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.Filter;
|
import com.arsdigita.persistence.Filter;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
|
@ -15,11 +14,13 @@ import com.arsdigita.persistence.SessionManager;
|
||||||
*
|
*
|
||||||
* @author quasi
|
* @author quasi
|
||||||
*/
|
*/
|
||||||
public class RelationAttributeCollection extends ACSObjectCollection {
|
public class RelationAttributeCollection extends DomainCollection {
|
||||||
|
|
||||||
public static String ATTRIBUTE = RelationAttribute.ATTRIBUTE;
|
public static String ATTRIBUTE = RelationAttribute.ATTRIBUTE;
|
||||||
public static String KEY = RelationAttribute.KEY;
|
public static String KEY = RelationAttribute.KEY;
|
||||||
public static String LANGUAGE = RelationAttribute.LANGUAGE;
|
public static String LANGUAGE = RelationAttribute.LANGUAGE;
|
||||||
|
public static String NAME = RelationAttribute.NAME;
|
||||||
|
public static String DESCRIPTION = RelationAttribute.DESCRIPTION;
|
||||||
|
|
||||||
private Filter m_attributeFilter = null;
|
private Filter m_attributeFilter = null;
|
||||||
private Filter m_keyFilter = null;
|
private Filter m_keyFilter = null;
|
||||||
|
|
@ -32,6 +33,12 @@ public class RelationAttributeCollection extends ACSObjectCollection {
|
||||||
public RelationAttributeCollection(String attribute) {
|
public RelationAttributeCollection(String attribute) {
|
||||||
this();
|
this();
|
||||||
this.addAttributeFilter(attribute);
|
this.addAttributeFilter(attribute);
|
||||||
|
this.addOrder(KEY + ", " + LANGUAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelationAttributeCollection(String attribute, String key) {
|
||||||
|
this(attribute);
|
||||||
|
this.addKeyFilter(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelationAttributeCollection(DataCollection dataCollection) {
|
public RelationAttributeCollection(DataCollection dataCollection) {
|
||||||
|
|
@ -40,23 +47,17 @@ public class RelationAttributeCollection extends ACSObjectCollection {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper to <code>getDomainObject()</code> that casts the returned
|
* Wrapper to <code>getDomainObject()</code> that casts the returned
|
||||||
* <code>DomainObject</code> as a <code>CategoryLocalization</code>.
|
* <code>DomainObject</code> as a <code>RelationAttribute</code>.
|
||||||
*
|
*
|
||||||
* @return a <code>CategoryLocalization</code> for the current position in the
|
* @return a <code>RelationAttribute</code> for the current position in the
|
||||||
* collection.
|
* collection.
|
||||||
**/
|
**/
|
||||||
public RelationAttribute getRelationAttribute() {
|
public RelationAttribute getRelationAttribute() {
|
||||||
return (RelationAttribute) getDomainObject();
|
return new RelationAttribute(m_dataCollection.getDataObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ACSObject getACSObject() {
|
|
||||||
return getRelationAttribute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Modify filter
|
// Modify filter
|
||||||
public void addAttributeFilter(String attribute) {
|
public final void addAttributeFilter(String attribute) {
|
||||||
m_attributeFilter = this.addEqualsFilter(ATTRIBUTE, attribute);
|
m_attributeFilter = this.addEqualsFilter(ATTRIBUTE, attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +70,7 @@ public class RelationAttributeCollection extends ACSObjectCollection {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addKeyFilter(String key) {
|
public final void addKeyFilter(String key) {
|
||||||
m_keyFilter = this.addEqualsFilter(KEY, key);
|
m_keyFilter = this.addEqualsFilter(KEY, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,6 +101,39 @@ public class RelationAttributeCollection extends ACSObjectCollection {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// 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
|
||||||
|
public RelationAttribute getRelationAttribute(String key, String language) {
|
||||||
|
|
||||||
|
// First, test the current element
|
||||||
|
if(this.getKey().equals(key) && this.getLanguage().equals(language)) {
|
||||||
|
|
||||||
|
return this.getRelationAttribute();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Rewind the collection and search for a matching element
|
||||||
|
this.rewind();
|
||||||
|
while(this.next()) {
|
||||||
|
if(this.getKey().equals(key) && this.getLanguage().equals(language)){
|
||||||
|
return this.getRelationAttribute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nothing found
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return getRelationAttribute().getName();
|
return getRelationAttribute().getName();
|
||||||
}
|
}
|
||||||
|
|
@ -107,4 +141,18 @@ public class RelationAttributeCollection extends ACSObjectCollection {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return getRelationAttribute().getDescription();
|
return getRelationAttribute().getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests
|
||||||
|
public boolean hasLanguage(String language) {
|
||||||
|
|
||||||
|
boolean retVal = false;
|
||||||
|
this.addLanguageFilter(language);
|
||||||
|
if(this.size() > 0) {
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
this.removeLanguageFilter(language);
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
* GenericContactType.java
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
|
||||||
import com.arsdigita.persistence.DataObject;
|
|
||||||
import com.arsdigita.persistence.OID;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author quasi
|
|
||||||
*/
|
|
||||||
public class GenericContactType extends ACSObject {
|
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.GenericContactType";
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(GenericContactType.class);
|
|
||||||
|
|
||||||
/** PDL property names */
|
|
||||||
public static final String KEY = "key";
|
|
||||||
public static final String LANGUAGE = "language";
|
|
||||||
public static final String NAME = "name";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new instance of GenericContactEntry
|
|
||||||
*/
|
|
||||||
public GenericContactType() {
|
|
||||||
this(BASE_DATA_OBJECT_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenericContactType(String typeName) {
|
|
||||||
super(typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenericContactType(OID oid) {
|
|
||||||
super(oid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenericContactType(DataObject object) {
|
|
||||||
super(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor. Retrieves an object instance with the given id.
|
|
||||||
* @param id the id of the object to retrieve
|
|
||||||
*/
|
|
||||||
public GenericContactType(BigDecimal id) throws DataObjectNotFoundException {
|
|
||||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenericContactType(String key, String language, String name, int order) {
|
|
||||||
this();
|
|
||||||
setKey(key);
|
|
||||||
setLanguage(language);
|
|
||||||
setName(name);
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
// accessors
|
|
||||||
|
|
||||||
// Get key
|
|
||||||
public String getKey() {
|
|
||||||
return (String) get(KEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set key
|
|
||||||
public void setKey(String key) {
|
|
||||||
set(KEY, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get language
|
|
||||||
public String getLanguage() {
|
|
||||||
return (String) get(LANGUAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
set(LANGUAGE, language);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get name
|
|
||||||
public String getName() {
|
|
||||||
return (String) get(NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set name
|
|
||||||
public void setName(String name) {
|
|
||||||
set(NAME, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -7,89 +7,37 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.domain.DomainCollection;
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.Filter;
|
|
||||||
import com.arsdigita.persistence.SessionManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author quasi
|
* @author quasi
|
||||||
*/
|
*/
|
||||||
public class GenericContactTypeCollection extends DomainCollection {
|
public class GenericContactTypeCollection extends RelationAttributeCollection {
|
||||||
|
|
||||||
|
public static final String CONTACT_ORDER = "contact_order";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of GenericContactEntryCollection
|
* Creates a new instance of GenericContactEntryCollection
|
||||||
*/
|
*/
|
||||||
public GenericContactTypeCollection() {
|
public GenericContactTypeCollection() {
|
||||||
this((DataCollection) SessionManager.getSession().retrieve(GenericContactType.BASE_DATA_OBJECT_TYPE));
|
super("person");
|
||||||
this.addOrder("key, language");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericContactTypeCollection(String key) {
|
public GenericContactTypeCollection(String key) {
|
||||||
this();
|
super("person", key);
|
||||||
this.addEqualsFilter("key", key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericContactTypeCollection(DataCollection dataCollection) {
|
public GenericContactTypeCollection(DataCollection dataCollection) {
|
||||||
super(dataCollection);
|
super(dataCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getKey() {
|
// public void setContactOrder(String contact_order) {
|
||||||
return (String) getContactType().getKey();
|
// set(CONTACT_ORDER, contact_order);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String getContactOrder() {
|
||||||
|
return (String) get(CONTACT_ORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getLanguage() {
|
|
||||||
return (String) getContactType().getLanguage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String getName() {
|
|
||||||
return (String) getContactType().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public GenericContactType getContactType() {
|
|
||||||
return new GenericContactType(m_dataCollection.getDataObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get ContactType in desired language
|
|
||||||
public GenericContactType getContactType(String key, String language) {
|
|
||||||
|
|
||||||
// First, test the current element
|
|
||||||
if(this.getKey().equals(key) && this.getLanguage().equals(language)) {
|
|
||||||
|
|
||||||
return this.getContactType();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Rewind the collection and search for a matching element
|
|
||||||
this.rewind();
|
|
||||||
while(this.next()) {
|
|
||||||
if(this.getKey().equals(key) && this.getLanguage().equals(language)){
|
|
||||||
return this.getContactType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nothing found
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void filterLanguage(String language) {
|
|
||||||
this.addEqualsFilter("language", language);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasLanguage(String language) {
|
|
||||||
|
|
||||||
boolean retVal = false;
|
|
||||||
Filter languageFilter = this.getFilterFactory().equals("language", language);
|
|
||||||
|
|
||||||
this.addFilter(languageFilter);
|
|
||||||
if(this.size() > 0) {
|
|
||||||
retVal = true;
|
|
||||||
}
|
|
||||||
this.removeFilter(languageFilter);
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
|
|
@ -32,7 +31,7 @@ import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContact;
|
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactType;
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
|
|
@ -48,12 +47,10 @@ import org.apache.log4j.Logger;
|
||||||
public class GenericContactAttachPersonPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
public class GenericContactAttachPersonPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(GenericContactPropertyForm.class);
|
private static final Logger logger = Logger.getLogger(GenericContactPropertyForm.class);
|
||||||
|
|
||||||
private GenericContactPersonPropertiesStep m_step;
|
private GenericContactPersonPropertiesStep m_step;
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private SaveCancelSection m_saveCancelSection;
|
private SaveCancelSection m_saveCancelSection;
|
||||||
private final String ITEM_SEARCH = "contactPerson";
|
private final String ITEM_SEARCH = "contactPerson";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the form
|
* ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
@ -64,7 +61,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
*
|
*
|
||||||
* @param itemModel
|
* @param itemModel
|
||||||
*/
|
*/
|
||||||
public GenericContactAttachPersonPropertyForm(ItemSelectionModel itemModel) {
|
public GenericContactAttachPersonPropertyForm(ItemSelectionModel itemModel) {
|
||||||
this(itemModel, null);
|
this(itemModel, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +84,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
add(new Label((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person").localize()));
|
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person").localize()));
|
||||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.GenericPerson"));
|
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.GenericPerson"));
|
||||||
add(this.m_itemSearch);
|
add(this.m_itemSearch);
|
||||||
|
|
||||||
|
|
@ -100,10 +97,10 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
|
|
||||||
// Add the Options to the SingleSelect widget
|
// Add the Options to the SingleSelect widget
|
||||||
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
|
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
|
||||||
contacttypes.filterLanguage(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
contacttypes.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
||||||
|
|
||||||
while (contacttypes.next()) {
|
while (contacttypes.next()) {
|
||||||
GenericContactType ct = contacttypes.getContactType();
|
RelationAttribute ct = contacttypes.getRelationAttribute();
|
||||||
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,9 +108,9 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(state);
|
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
setVisible(state, true);
|
setVisible(state, true);
|
||||||
|
|
||||||
|
|
@ -123,17 +120,16 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(state);
|
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||||
contact.setPerson((GenericPerson)data.get(ITEM_SEARCH));
|
contact.setPerson((GenericPerson) data.get(ITEM_SEARCH));
|
||||||
}
|
}
|
||||||
init(fse);
|
init(fse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the section with the save and the cancel button.
|
* Creates the section with the save and the cancel button.
|
||||||
*/
|
*/
|
||||||
|
|
@ -143,13 +139,13 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
||||||
|
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(e.getPageState());
|
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||||
Submit target = (Submit) e.getTarget();
|
Submit target = (Submit) e.getTarget();
|
||||||
|
|
||||||
if (contact.getPerson() != null) {
|
if (contact.getPerson() != null) {
|
||||||
target.setButtonLabel((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.change").localize());
|
target.setButtonLabel((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.change").localize());
|
||||||
} else {
|
} else {
|
||||||
target.setButtonLabel((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.add").localize());
|
target.setButtonLabel((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.add").localize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -161,14 +157,14 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
@Override
|
@Override
|
||||||
public void validate(FormSectionEvent e) throws FormProcessException {
|
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||||
if (e.getFormData().get(ITEM_SEARCH) == null) {
|
if (e.getFormData().get(ITEM_SEARCH) == null) {
|
||||||
throw new FormProcessException((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.wrong_type").localize());
|
throw new FormProcessException((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.wrong_type").localize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
public void submitted(FormSectionEvent e) throws FormProcessException {
|
||||||
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
|
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
|
||||||
init(e);
|
init(e);
|
||||||
throw new FormProcessException((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.cancelled").localize());
|
throw new FormProcessException((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.select_person.cancelled").localize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactType;
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
@ -52,14 +52,13 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class GenericContactTypeAddForm extends BasicItemForm {
|
public class GenericContactTypeAddForm extends BasicItemForm {
|
||||||
|
|
||||||
public final static String KEY = GenericContactType.KEY;
|
public final static String KEY = RelationAttribute.KEY;
|
||||||
public final static String LANGUAGE = GenericContactType.LANGUAGE;
|
public final static String LANGUAGE = RelationAttribute.LANGUAGE;
|
||||||
public final static String NAME = GenericContactType.NAME;
|
public final static String NAME = RelationAttribute.NAME;
|
||||||
private static final Logger s_log = Logger.getLogger(GenericContactTypeAddForm.class);
|
private static final Logger s_log = Logger.getLogger(GenericContactTypeAddForm.class);
|
||||||
private GenericPersonPropertiesStep m_step;
|
private GenericPersonPropertiesStep m_step;
|
||||||
private SaveCancelSection m_saveCancelSection;
|
private SaveCancelSection m_saveCancelSection;
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
private SingleSelect language;
|
private SingleSelect language;
|
||||||
|
|
||||||
/** Creates a new instance of CategoryLocalizationAddForm */
|
/** Creates a new instance of CategoryLocalizationAddForm */
|
||||||
|
|
@ -101,8 +100,8 @@ public class GenericContactTypeAddForm extends BasicItemForm {
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
GenericContactType contacttype = (GenericContactType) getItemSelectionModel().getSelectedObject(state);
|
RelationAttribute contacttype = (RelationAttribute) getItemSelectionModel().getSelectedObject(state);
|
||||||
GenericContactTypeCollection contacttypeCollection = new GenericContactTypeCollection(contacttype.getKey());
|
GenericContactTypeCollection contacttypeCollection = new GenericContactTypeCollection(contacttype.getKey());
|
||||||
|
|
||||||
// all supported languages (by registry entry)
|
// all supported languages (by registry entry)
|
||||||
KernelConfig kernelConfig = Kernel.getConfig();
|
KernelConfig kernelConfig = Kernel.getConfig();
|
||||||
|
|
@ -128,7 +127,7 @@ public class GenericContactTypeAddForm extends BasicItemForm {
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
GenericContactType contacttype = (GenericContactType) getItemSelectionModel().getSelectedObject(state);
|
RelationAttribute contacttype = (RelationAttribute) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,12 @@ import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactType;
|
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
@ -92,7 +91,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
|
|
||||||
public TableModel makeModel(Table table, PageState state) {
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
GenericContactType contacttype = (GenericContactType) m_itemModel.getSelectedObject(state);
|
RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state);
|
||||||
return new GenericContactTypeTableModel(table, state, contacttype);
|
return new GenericContactTypeTableModel(table, state, contacttype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -105,13 +104,13 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
|
|
||||||
final private int MAX_DESC_LENGTH = 25;
|
final private int MAX_DESC_LENGTH = 25;
|
||||||
private Table m_table;
|
private Table m_table;
|
||||||
private GenericContactType m_contacttype;
|
private RelationAttribute m_contacttype;
|
||||||
private GenericContactTypeCollection m_contacttypeCollection = new GenericContactTypeCollection();
|
private GenericContactTypeCollection m_contacttypeCollection = new GenericContactTypeCollection();
|
||||||
|
|
||||||
private GenericContactTypeTableModel(Table t, PageState ps, GenericContactType contacttype) {
|
private GenericContactTypeTableModel(Table t, PageState ps, RelationAttribute contacttype) {
|
||||||
m_table = t;
|
m_table = t;
|
||||||
m_contacttype = contacttype;
|
m_contacttype = contacttype;
|
||||||
// m_contacttypeCollection.filterLanguage(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
// m_contacttypeCollection.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
|
|
@ -127,7 +126,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
public boolean nextRow() {
|
public boolean nextRow() {
|
||||||
|
|
||||||
if (m_contacttypeCollection != null && m_contacttypeCollection.next()) {
|
if (m_contacttypeCollection != null && m_contacttypeCollection.next()) {
|
||||||
m_contacttype = m_contacttypeCollection.getContactType();
|
m_contacttype = m_contacttypeCollection.getRelationAttribute();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -159,7 +158,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
|
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
|
||||||
*/
|
*/
|
||||||
public Object getKeyAt(int columnIndex) {
|
public Object getKeyAt(int columnIndex) {
|
||||||
return m_contacttype.getID();
|
return m_contacttype.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +173,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
|
|
||||||
SecurityManager sm = Utilities.getSecurityManager(state);
|
SecurityManager sm = Utilities.getSecurityManager(state);
|
||||||
GenericContactType contacttype = (GenericContactType) m_itemModel.getSelectedObject(state);
|
RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
// boolean canEdit = sm.canAccess(state.getRequest(),
|
// boolean canEdit = sm.canAccess(state.getRequest(),
|
||||||
// SecurityManager.EDIT_ITEM,
|
// SecurityManager.EDIT_ITEM,
|
||||||
|
|
@ -199,7 +198,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
|
|
||||||
SecurityManager sm = Utilities.getSecurityManager(state);
|
SecurityManager sm = Utilities.getSecurityManager(state);
|
||||||
GenericContactType contacttype = (GenericContactType) m_itemModel.getSelectedObject(state);
|
RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
// boolean canDelete = sm.canAccess(state.getRequest(),
|
// boolean canDelete = sm.canAccess(state.getRequest(),
|
||||||
// SecurityManager.DELETE_ITEM,
|
// SecurityManager.DELETE_ITEM,
|
||||||
|
|
@ -224,7 +223,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
|
||||||
PageState state = evt.getPageState();
|
PageState state = evt.getPageState();
|
||||||
|
|
||||||
// Get selected GenericContactType
|
// Get selected GenericContactType
|
||||||
GenericContactType contacttype = new GenericContactType(new BigDecimal(evt.getRowKey().toString()));
|
RelationAttribute contacttype = new RelationAttribute(new BigDecimal(evt.getRowKey().toString()));
|
||||||
|
|
||||||
// Get selected column
|
// Get selected column
|
||||||
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContact;
|
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactType;
|
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||||
|
|
@ -67,8 +67,7 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
|
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.select_contact").localize()));
|
"cms.contenttypes.ui.genericorgaunit.select_contact").localize()));
|
||||||
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType(GenericContact.class.getName()));
|
||||||
findByAssociatedObjectType(GenericContact.class.getName()));
|
|
||||||
add(m_itemSearch);
|
add(m_itemSearch);
|
||||||
|
|
||||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||||
|
|
@ -77,16 +76,14 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
||||||
GenericOrganizationalUnitContactCollection.CONTACT_TYPE);
|
GenericOrganizationalUnitContactCollection.CONTACT_TYPE);
|
||||||
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
||||||
contactType.addValidationListener(new NotNullValidationListener());
|
contactType.addValidationListener(new NotNullValidationListener());
|
||||||
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.
|
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
||||||
globalize("cms.ui.select_one").localize())));
|
|
||||||
|
|
||||||
GenericContactTypeCollection contacttypes =
|
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
|
||||||
new GenericContactTypeCollection();
|
contacttypes.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
|
||||||
contacttypes.filterLanguage(DispatcherHelper.getNegotiatedLocale().
|
|
||||||
getLanguage());
|
getLanguage());
|
||||||
|
|
||||||
while (contacttypes.next()) {
|
while (contacttypes.next()) {
|
||||||
GenericContactType ct = contacttypes.getContactType();
|
RelationAttribute ct = contacttypes.getRelationAttribute();
|
||||||
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,8 +109,7 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
|
|
||||||
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
|
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
|
||||||
orgaunit.addContact((GenericContact) data.get(ITEM_SEARCH), (String) data.
|
orgaunit.addContact((GenericContact) data.get(ITEM_SEARCH), (String) data.get(GenericOrganizationalUnitContactCollection.CONTACT_TYPE));
|
||||||
get(GenericOrganizationalUnitContactCollection.CONTACT_TYPE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init(fse);
|
init(fse);
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
||||||
public Object getElementAt(int columnIndex) {
|
public Object getElementAt(int columnIndex) {
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return contacttypes.getContactType(m_contactCollection.
|
return contacttypes.getRelationAttribute(m_contactCollection.
|
||||||
getContactType(),
|
getContactType(),
|
||||||
DispatcherHelper.
|
DispatcherHelper.
|
||||||
getNegotiatedLocale().getLanguage());
|
getNegotiatedLocale().getLanguage());
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContact;
|
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactType;
|
|
||||||
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
|
@ -84,10 +84,10 @@ public class GenericPersonContactAddForm extends BasicItemForm {
|
||||||
|
|
||||||
// Add the Options to the SingleSelect widget
|
// Add the Options to the SingleSelect widget
|
||||||
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
|
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
|
||||||
contacttypes.filterLanguage(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
contacttypes.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
|
||||||
|
|
||||||
while (contacttypes.next()) {
|
while (contacttypes.next()) {
|
||||||
GenericContactType ct = contacttypes.getContactType();
|
RelationAttribute ct = contacttypes.getRelationAttribute();
|
||||||
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,12 @@ public class GenericPersonContactTable extends Table implements TableActionListe
|
||||||
case 0:
|
case 0:
|
||||||
return m_contactCollection.getContactOrder();
|
return m_contactCollection.getContactOrder();
|
||||||
case 1:
|
case 1:
|
||||||
return contacttypes.getContactType(m_contactCollection.getContactType(),
|
String lang = DispatcherHelper.getNegotiatedLocale().getLanguage();
|
||||||
|
String key = m_contactCollection.getContactType();
|
||||||
|
return contacttypes.getRelationAttribute(m_contactCollection.getContactType(),
|
||||||
DispatcherHelper.getNegotiatedLocale().getLanguage());
|
DispatcherHelper.getNegotiatedLocale().getLanguage());
|
||||||
|
// return contacttypes.getRelationAttribute(m_contactCollection.getContactType(),
|
||||||
|
// DispatcherHelper.getNegotiatedLocale().getLanguage());
|
||||||
case 2:
|
case 2:
|
||||||
return m_contact.getTitle();
|
return m_contact.getTitle();
|
||||||
// case 2:
|
// case 2:
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,11 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mandatoryFieldWidgets(FormSection form) {
|
public static void mandatoryFieldWidgets(FormSection form) {
|
||||||
|
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize()));
|
||||||
|
ParameterModel titlepreParam = new StringParameter(TITLEPRE);
|
||||||
|
TextField titlepre = new TextField(titlepreParam);
|
||||||
|
form.add(titlepre);
|
||||||
|
|
||||||
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize()));
|
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize()));
|
||||||
ParameterModel surnameParam = new StringParameter(SURNAME);
|
ParameterModel surnameParam = new StringParameter(SURNAME);
|
||||||
TextField surname = new TextField(surnameParam);
|
TextField surname = new TextField(surnameParam);
|
||||||
|
|
@ -110,11 +115,6 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
TextField givenname = new TextField(givennameParam);
|
TextField givenname = new TextField(givennameParam);
|
||||||
form.add(givenname);
|
form.add(givenname);
|
||||||
|
|
||||||
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize()));
|
|
||||||
ParameterModel titlepreParam = new StringParameter(TITLEPRE);
|
|
||||||
TextField titlepre = new TextField(titlepreParam);
|
|
||||||
form.add(titlepre);
|
|
||||||
|
|
||||||
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize()));
|
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize()));
|
||||||
ParameterModel titlepostParam = new StringParameter(TITLEPOST);
|
ParameterModel titlepostParam = new StringParameter(TITLEPOST);
|
||||||
TextField titlepost = new TextField(titlepostParam);
|
TextField titlepost = new TextField(titlepostParam);
|
||||||
|
|
@ -125,9 +125,9 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
GenericPerson person = (GenericPerson) super.initBasicWidgets(fse);
|
GenericPerson person = (GenericPerson) super.initBasicWidgets(fse);
|
||||||
|
|
||||||
|
data.put(TITLEPRE, person.getTitlePre());
|
||||||
data.put(SURNAME, person.getSurname());
|
data.put(SURNAME, person.getSurname());
|
||||||
data.put(GIVENNAME, person.getGivenName());
|
data.put(GIVENNAME, person.getGivenName());
|
||||||
data.put(TITLEPRE, person.getTitlePre());
|
|
||||||
data.put(TITLEPOST, person.getTitlePost());
|
data.put(TITLEPOST, person.getTitlePost());
|
||||||
data.put(BIRTHDATE, person.getBirthdate());
|
data.put(BIRTHDATE, person.getBirthdate());
|
||||||
data.put(GENDER, person.getGender());
|
data.put(GENDER, person.getGender());
|
||||||
|
|
@ -148,9 +148,9 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
|
|
||||||
if (person != null
|
if (person != null
|
||||||
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
|
person.setTitlePre((String) data.get(TITLEPRE));
|
||||||
person.setSurname((String) data.get(SURNAME));
|
person.setSurname((String) data.get(SURNAME));
|
||||||
person.setGivenName((String) data.get(GIVENNAME));
|
person.setGivenName((String) data.get(GIVENNAME));
|
||||||
person.setTitlePre((String) data.get(TITLEPRE));
|
|
||||||
person.setTitlePost((String) data.get(TITLEPOST));
|
person.setTitlePost((String) data.get(TITLEPOST));
|
||||||
person.setBirthdate((Date) data.get(BIRTHDATE));
|
person.setBirthdate((Date) data.get(BIRTHDATE));
|
||||||
person.setGender((String) data.get(GENDER));
|
person.setGender((String) data.get(GENDER));
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,8 @@ public class RelationAttributeList extends List {
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
public final Object getElement() {
|
public final Object getElement() {
|
||||||
return m_item.getDisplayName();
|
return m_item.getName();
|
||||||
|
// return m_item.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// URL
|
// URL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue