diff --git a/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl b/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl
index 38821d726..a8f9c3e56 100644
--- a/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl
+++ b/ccm-cms/pdl/com/arsdigita/content-section/RelationAttribute.pdl
@@ -20,17 +20,16 @@
model com.arsdigita.cms;
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] key = cms_relation_attribute.key VARCHAR(100);
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);
unique (attribute, key, lang);
- reference key(cms_relationAttribute.relationattribute_id);
+ reference key(cms_relation_attribute.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 94c47eec5..a044c753f 100644
--- a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
+++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl
@@ -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 {
GenericPerson[0..1] person = join cms_contacts.contact_id
@@ -67,7 +58,6 @@ association {
// Link Attribute
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);
}
diff --git a/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java b/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java
index f1d280037..3b74d948d 100644
--- a/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java
+++ b/ccm-cms/src/com/arsdigita/cms/RelationAttribute.java
@@ -6,6 +6,7 @@
package com.arsdigita.cms;
import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.kernel.ACSObject;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import java.math.BigDecimal;
@@ -14,13 +15,13 @@ import java.math.BigDecimal;
*
* @author quasi
*/
-public class RelationAttribute extends ContentItem {
+public class RelationAttribute extends ACSObject {
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 NAME = "name";
- public static final String DESCRIPTION = "DESCRIPTION";
+ public static final String NAME = "name";
+ public static final String DESCRIPTION = "description";
/** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.RelationAttribute";
@@ -40,7 +41,6 @@ public class RelationAttribute extends ContentItem {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
-
public RelationAttribute(DataObject obj) {
super(obj);
}
@@ -49,60 +49,62 @@ public class RelationAttribute extends ContentItem {
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
* should override this method to return the correct value
*/
+ @Override
public String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
/* accessors *****************************************************/
- public String getAttribute() {
+ public final String getAttribute() {
return (String) get(ATTRIBUTE);
}
- public void setAttribute(String attribute) {
+ public final void setAttribute(String attribute) {
set(ATTRIBUTE, attribute);
}
- public String getKey() {
+ public final String getKey() {
return (String) get(KEY);
}
- public void setKey(String key) {
+ public final void setKey(String key) {
set(KEY, key);
}
- @Override
- public String getLanguage() {
+ public final String getLanguage() {
return (String) get(LANGUAGE);
}
- @Override
- public void setLanguage(String language) {
+ public final void setLanguage(String language) {
set(LANGUAGE, language);
}
-// @Override
-// public String getName() {
-// return (String) get(NAME);
-// }
-//
-// @Override
-// public void setName(String name) {
-// set(NAME, name);
-// }
+ public final String getName() {
+ return (String) get(NAME);
+ }
- public String getDescription() {
+ public final void setName(String name) {
+ set(NAME, name);
+ }
+
+ public final String getDescription() {
return (String) get(DESCRIPTION);
}
- public void setDescription(String description) {
+ public final void setDescription(String description) {
set(DESCRIPTION, description);
}
-
-
-
}
diff --git a/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java b/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java
index 9a80fc80e..178e9b303 100644
--- a/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java
+++ b/ccm-cms/src/com/arsdigita/cms/RelationAttributeCollection.java
@@ -5,8 +5,7 @@
package com.arsdigita.cms;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.kernel.ACSObjectCollection;
+import com.arsdigita.domain.DomainCollection;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.Filter;
import com.arsdigita.persistence.SessionManager;
@@ -15,11 +14,13 @@ import com.arsdigita.persistence.SessionManager;
*
* @author quasi
*/
-public class RelationAttributeCollection extends ACSObjectCollection {
+public class RelationAttributeCollection extends DomainCollection {
public static String ATTRIBUTE = RelationAttribute.ATTRIBUTE;
public static String KEY = RelationAttribute.KEY;
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_keyFilter = null;
@@ -32,6 +33,12 @@ public class RelationAttributeCollection extends ACSObjectCollection {
public RelationAttributeCollection(String attribute) {
this();
this.addAttributeFilter(attribute);
+ this.addOrder(KEY + ", " + LANGUAGE);
+ }
+
+ public RelationAttributeCollection(String attribute, String key) {
+ this(attribute);
+ this.addKeyFilter(key);
}
public RelationAttributeCollection(DataCollection dataCollection) {
@@ -40,23 +47,17 @@ public class RelationAttributeCollection extends ACSObjectCollection {
/**
* Wrapper to getDomainObject() that casts the returned
- * DomainObject as a CategoryLocalization.
+ * DomainObject as a RelationAttribute.
*
- * @return a CategoryLocalization for the current position in the
+ * @return a RelationAttribute for the current position in the
* collection.
**/
public RelationAttribute getRelationAttribute() {
- return (RelationAttribute) getDomainObject();
+ return new RelationAttribute(m_dataCollection.getDataObject());
}
- @Override
- public ACSObject getACSObject() {
- return getRelationAttribute();
- }
-
-
// Modify filter
- public void addAttributeFilter(String attribute) {
+ public final void addAttributeFilter(String attribute) {
m_attributeFilter = this.addEqualsFilter(ATTRIBUTE, attribute);
}
@@ -69,7 +70,7 @@ public class RelationAttributeCollection extends ACSObjectCollection {
return retVal;
}
- public void addKeyFilter(String key) {
+ public final void addKeyFilter(String key) {
m_keyFilter = this.addEqualsFilter(KEY, key);
}
@@ -100,6 +101,39 @@ public class RelationAttributeCollection extends ACSObjectCollection {
}
// 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() {
return getRelationAttribute().getName();
}
@@ -107,4 +141,18 @@ public class RelationAttributeCollection extends ACSObjectCollection {
public String 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;
+ }
+
}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactType.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactType.java
deleted file mode 100644
index 1b98c7934..000000000
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactType.java
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactTypeCollection.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactTypeCollection.java
index a80b3280a..ea8780f0c 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactTypeCollection.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericContactTypeCollection.java
@@ -7,89 +7,37 @@
*/
package com.arsdigita.cms.contenttypes;
-import com.arsdigita.domain.DomainCollection;
+import com.arsdigita.cms.RelationAttributeCollection;
import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.Filter;
-import com.arsdigita.persistence.SessionManager;
/**
*
* @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
*/
public GenericContactTypeCollection() {
- this((DataCollection) SessionManager.getSession().retrieve(GenericContactType.BASE_DATA_OBJECT_TYPE));
- this.addOrder("key, language");
+ super("person");
}
public GenericContactTypeCollection(String key) {
- this();
- this.addEqualsFilter("key", key);
+ super("person", key);
}
public GenericContactTypeCollection(DataCollection dataCollection) {
super(dataCollection);
}
- public final String getKey() {
- return (String) getContactType().getKey();
+// public void setContactOrder(String contact_order) {
+// 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;
- }
-
}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
index 2cdaeaa5d..a6ef283e1 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
@@ -6,7 +6,6 @@
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
-
package com.arsdigita.cms.contenttypes.ui;
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.ui.ItemSearchWidget;
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.GenericPersonContactCollection;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
@@ -46,14 +45,12 @@ import org.apache.log4j.Logger;
* @author quasi
*/
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 ItemSearchWidget m_itemSearch;
private SaveCancelSection m_saveCancelSection;
private final String ITEM_SEARCH = "contactPerson";
-
/**
* ID of the form
*/
@@ -64,7 +61,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
*
* @param itemModel
*/
- public GenericContactAttachPersonPropertyForm(ItemSelectionModel itemModel) {
+ public GenericContactAttachPersonPropertyForm(ItemSelectionModel itemModel) {
this(itemModel, null);
}
@@ -82,12 +79,12 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
addInitListener(this);
addSubmissionListener(this);
-
+
}
@Override
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"));
add(this.m_itemSearch);
@@ -100,21 +97,21 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
// Add the Options to the SingleSelect widget
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
- contacttypes.filterLanguage(DispatcherHelper.getNegotiatedLocale().getLanguage());
+ contacttypes.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
while (contacttypes.next()) {
- GenericContactType ct = contacttypes.getContactType();
+ RelationAttribute ct = contacttypes.getRelationAttribute();
contactType.addOption(new Option(ct.getKey(), ct.getName()));
}
add(contactType);
}
-
+
public void init(FormSectionEvent fse) {
- FormData data = fse.getFormData();
+ FormData data = fse.getFormData();
PageState state = fse.getPageState();
- GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(state);
-
+ GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
+
setVisible(state, true);
if (contact != null) {
@@ -123,17 +120,16 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
}
public void process(FormSectionEvent fse) {
- FormData data = fse.getFormData();
+ FormData data = fse.getFormData();
PageState state = fse.getPageState();
- GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(state);
+ GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
- contact.setPerson((GenericPerson)data.get(ITEM_SEARCH));
+ contact.setPerson((GenericPerson) data.get(ITEM_SEARCH));
}
init(fse);
}
-
/**
* 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() {
public void prepare(PrintEvent e) {
- GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(e.getPageState());
+ GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(e.getPageState());
Submit target = (Submit) e.getTarget();
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 {
- 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
public void validate(FormSectionEvent e) throws FormProcessException {
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 {
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
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());
}
}
-}
\ No newline at end of file
+}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeAddForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeAddForm.java
index 15f76a55c..b10ddaab3 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeAddForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeAddForm.java
@@ -33,7 +33,7 @@ import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
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.kernel.Kernel;
import com.arsdigita.kernel.KernelConfig;
@@ -52,14 +52,13 @@ import org.apache.log4j.Logger;
*/
public class GenericContactTypeAddForm extends BasicItemForm {
- public final static String KEY = GenericContactType.KEY;
- public final static String LANGUAGE = GenericContactType.LANGUAGE;
- public final static String NAME = GenericContactType.NAME;
+ public final static String KEY = RelationAttribute.KEY;
+ public final static String LANGUAGE = RelationAttribute.LANGUAGE;
+ public final static String NAME = RelationAttribute.NAME;
private static final Logger s_log = Logger.getLogger(GenericContactTypeAddForm.class);
private GenericPersonPropertiesStep m_step;
private SaveCancelSection m_saveCancelSection;
private ItemSelectionModel m_itemModel;
-
private SingleSelect language;
/** Creates a new instance of CategoryLocalizationAddForm */
@@ -101,8 +100,8 @@ public class GenericContactTypeAddForm extends BasicItemForm {
public void init(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
- GenericContactType contacttype = (GenericContactType) getItemSelectionModel().getSelectedObject(state);
- GenericContactTypeCollection contacttypeCollection = new GenericContactTypeCollection(contacttype.getKey());
+ RelationAttribute contacttype = (RelationAttribute) getItemSelectionModel().getSelectedObject(state);
+ GenericContactTypeCollection contacttypeCollection = new GenericContactTypeCollection(contacttype.getKey());
// all supported languages (by registry entry)
KernelConfig kernelConfig = Kernel.getConfig();
@@ -128,7 +127,7 @@ public class GenericContactTypeAddForm extends BasicItemForm {
public void process(FormSectionEvent fse) {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
- GenericContactType contacttype = (GenericContactType) getItemSelectionModel().getSelectedObject(state);
+ RelationAttribute contacttype = (RelationAttribute) getItemSelectionModel().getSelectedObject(state);
//
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeTable.java
index 8440b3f57..dd0070df1 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeTable.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactTypeTable.java
@@ -31,13 +31,12 @@ import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.GenericContactType;
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
@@ -92,7 +91,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
public TableModel makeModel(Table table, PageState 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);
}
}
@@ -105,13 +104,13 @@ public class GenericContactTypeTable extends Table implements TableActionListene
final private int MAX_DESC_LENGTH = 25;
private Table m_table;
- private GenericContactType m_contacttype;
+ private RelationAttribute m_contacttype;
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_contacttype = contacttype;
-// m_contacttypeCollection.filterLanguage(DispatcherHelper.getNegotiatedLocale().getLanguage());
+// m_contacttypeCollection.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
}
public int getColumnCount() {
@@ -127,7 +126,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
public boolean nextRow() {
if (m_contacttypeCollection != null && m_contacttypeCollection.next()) {
- m_contacttype = m_contacttypeCollection.getContactType();
+ m_contacttype = m_contacttypeCollection.getRelationAttribute();
return true;
} else {
@@ -159,7 +158,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
*/
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) {
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(),
// SecurityManager.EDIT_ITEM,
@@ -199,7 +198,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
int row, int column) {
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(),
// SecurityManager.DELETE_ITEM,
@@ -224,7 +223,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
PageState state = evt.getPageState();
// Get selected GenericContactType
- GenericContactType contacttype = new GenericContactType(new BigDecimal(evt.getRowKey().toString()));
+ RelationAttribute contacttype = new RelationAttribute(new BigDecimal(evt.getRowKey().toString()));
// Get selected column
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
index f00776bf6..46b4a76cf 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
@@ -32,8 +32,8 @@ import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.contenttypes.GenericContact;
-import com.arsdigita.cms.contenttypes.GenericContactType;
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
@@ -67,8 +67,7 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_contact").localize()));
- m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(GenericContact.class.getName()));
+ m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType(GenericContact.class.getName()));
add(m_itemSearch);
add(new Label(ContenttypesGlobalizationUtil.globalize(
@@ -77,16 +76,14 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
GenericOrganizationalUnitContactCollection.CONTACT_TYPE);
SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener());
- contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
+ contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
- GenericContactTypeCollection contacttypes =
- new GenericContactTypeCollection();
- contacttypes.filterLanguage(DispatcherHelper.getNegotiatedLocale().
+ GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
+ contacttypes.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
getLanguage());
while (contacttypes.next()) {
- GenericContactType ct = contacttypes.getContactType();
+ RelationAttribute ct = contacttypes.getRelationAttribute();
contactType.addOption(new Option(ct.getKey(), ct.getName()));
}
@@ -112,8 +109,7 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
getSelectedObject(state);
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
- orgaunit.addContact((GenericContact) data.get(ITEM_SEARCH), (String) data.
- get(GenericOrganizationalUnitContactCollection.CONTACT_TYPE));
+ orgaunit.addContact((GenericContact) data.get(ITEM_SEARCH), (String) data.get(GenericOrganizationalUnitContactCollection.CONTACT_TYPE));
}
init(fse);
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
index 10289c3c4..f7f08b953 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
@@ -162,7 +162,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
public Object getElementAt(int columnIndex) {
switch (columnIndex) {
case 0:
- return contacttypes.getContactType(m_contactCollection.
+ return contacttypes.getRelationAttribute(m_contactCollection.
getContactType(),
DispatcherHelper.
getNegotiatedLocale().getLanguage());
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
index 203bc8289..a1154a67c 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
@@ -32,8 +32,8 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentType;
+import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.contenttypes.GenericContact;
-import com.arsdigita.cms.contenttypes.GenericContactType;
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
import com.arsdigita.cms.contenttypes.GenericPerson;
@@ -84,10 +84,10 @@ public class GenericPersonContactAddForm extends BasicItemForm {
// Add the Options to the SingleSelect widget
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
- contacttypes.filterLanguage(DispatcherHelper.getNegotiatedLocale().getLanguage());
+ contacttypes.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage());
while (contacttypes.next()) {
- GenericContactType ct = contacttypes.getContactType();
+ RelationAttribute ct = contacttypes.getRelationAttribute();
contactType.addOption(new Option(ct.getKey(), ct.getName()));
}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java
index ca075fcc9..f53a7d42c 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java
@@ -150,8 +150,12 @@ public class GenericPersonContactTable extends Table implements TableActionListe
case 0:
return m_contactCollection.getContactOrder();
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());
+// return contacttypes.getRelationAttribute(m_contactCollection.getContactType(),
+// DispatcherHelper.getNegotiatedLocale().getLanguage());
case 2:
return m_contact.getTitle();
// case 2:
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java
index 609009eb6..1d3404b86 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java
@@ -100,6 +100,11 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
}
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()));
ParameterModel surnameParam = new StringParameter(SURNAME);
TextField surname = new TextField(surnameParam);
@@ -110,11 +115,6 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
TextField givenname = new TextField(givennameParam);
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()));
ParameterModel titlepostParam = new StringParameter(TITLEPOST);
TextField titlepost = new TextField(titlepostParam);
@@ -125,9 +125,9 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
FormData data = fse.getFormData();
GenericPerson person = (GenericPerson) super.initBasicWidgets(fse);
+ data.put(TITLEPRE, person.getTitlePre());
data.put(SURNAME, person.getSurname());
data.put(GIVENNAME, person.getGivenName());
- data.put(TITLEPRE, person.getTitlePre());
data.put(TITLEPOST, person.getTitlePost());
data.put(BIRTHDATE, person.getBirthdate());
data.put(GENDER, person.getGender());
@@ -148,9 +148,9 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
if (person != null
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
+ person.setTitlePre((String) data.get(TITLEPRE));
person.setSurname((String) data.get(SURNAME));
person.setGivenName((String) data.get(GIVENNAME));
- person.setTitlePre((String) data.get(TITLEPRE));
person.setTitlePost((String) data.get(TITLEPOST));
person.setBirthdate((Date) data.get(BIRTHDATE));
person.setGender((String) data.get(GENDER));
diff --git a/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeList.java b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeList.java
index b52050f3a..df3e0a527 100644
--- a/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeList.java
+++ b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeList.java
@@ -112,7 +112,8 @@ public class RelationAttributeList extends List {
// Label
public final Object getElement() {
- return m_item.getDisplayName();
+ return m_item.getName();
+// return m_item.getDisplayName();
}
// URL