From 1b23384b47579d0ffaf78e0a5ed65036fcc38cba Mon Sep 17 00:00:00 2001 From: jensp Date: Sat, 1 Mar 2014 14:03:23 +0000 Subject: [PATCH] - Association between GenericContact and GenericAddress is now modeled like other associations (necessary to work around limitations in the publication process and of PDL). Solves Ticket #2039. - Is was not possible to remove a address from a contact. See #2017. Attention: Database Upgrade ccm-cms-6.6.10-6.6.11 required for existing databases! git-svn-id: https://svn.libreccm.org/ccm/trunk@2547 8810af33-2d31-482b-a856-94f89814c4df --- .../content-types/GenericAddress.pdl | 6 +- .../content-types/GenericContact.pdl | 35 +- .../WEB-INF/content-types/GenericAddress.xml | 2 +- ccm-cms/src/ccm-cms.upgrade | 3 + .../ContenttypesResources.properties | 1 + .../ContenttypesResources_de.properties | 1 + .../cms/contenttypes/GenericAddress.java | 4 + .../contenttypes/GenericAddressBundle.java | 107 ++++++ .../cms/contenttypes/GenericContact.java | 204 +++++----- .../contenttypes/GenericContactBundle.java | 67 +++- .../contenttypes/ui/GenericAddressCreate.java | 56 +++ .../GenericContactAddressPropertiesStep.java | 357 +++++++++++------- .../ui/GenericContactAddressSheet.java | 239 ++++++++++++ .../ui/GenericContactDeleteAddressForm.java | 1 + .../ui/GenericContactEntriesTable.java | 4 +- .../ui/GenericContactPersonSheet.java | 94 ++--- .../ui/GenericPersonExtraXmlGenerator.java | 2 + .../upgrades/AbstractAssocUpgrade.java | 2 +- .../Upgrade6610to6611ContactAddressAssoc.java | 324 ++++++++++++++++ 19 files changed, 1205 insertions(+), 304 deletions(-) create mode 100644 ccm-cms/src/com/arsdigita/cms/contenttypes/GenericAddressBundle.java create mode 100644 ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericAddressCreate.java create mode 100644 ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAddressSheet.java create mode 100644 ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade6610to6611ContactAddressAssoc.java diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericAddress.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericAddress.pdl index 6811e2fbc..2015c3531 100644 --- a/ccm-cms/pdl/com/arsdigita/content-types/GenericAddress.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericAddress.pdl @@ -1,6 +1,6 @@ model com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.*; // Address object object type GenericAddress extends ContentPage { @@ -14,3 +14,7 @@ object type GenericAddress extends ContentPage { reference key ( cms_addresses.address_id ); } +object type GenericAddressBundle extends ContentBundle { + reference key (cms_address_bundles.bundle_id); +} + diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl index 2c4fb367b..209bdb5a4 100644 --- a/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl +++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericContact.pdl @@ -25,9 +25,6 @@ import com.arsdigita.cms.*; // Contact Object object type GenericContact extends ContentPage { - GenericAddress [0..1] address = join cms_contacts.address_id - to cms_addresses.address_id; - component GenericContactEntry [0..n] contactentries = join cms_contacts.contact_id to cms_contactEntries.contact_id; @@ -50,18 +47,36 @@ object type GenericContactEntry extends ContentItem { association { - GenericPersonBundle[0..n] person = join cms_contact_bundles.bundle_id - to cms_person_contact_map.contact_id, - join cms_person_contact_map.person_id - to cms_person_bundles.bundle_id; + GenericPersonBundle[0..n] person = join cms_contact_bundles.bundle_id + to cms_person_contact_map.contact_id, + join cms_person_contact_map.person_id + to cms_person_bundles.bundle_id; GenericContactBundle[0..n] contacts = join cms_person_bundles.bundle_id - to cms_person_contact_map.person_id, - join cms_person_contact_map.contact_id - to cms_contact_bundles.bundle_id; + to cms_person_contact_map.person_id, + join cms_person_contact_map.contact_id + to cms_contact_bundles.bundle_id; // Link Attribute BigDecimal[0..1] linkOrder = cms_person_contact_map.link_order INTEGER; String[0..1] linkKey = cms_person_contact_map.link_key VARCHAR(100); } + +association { + + GenericAddressBundle[0..n] address = join cms_contact_bundles.bundle_id + to cms_contact_address_map.contact_id, + join cms_contact_address_map.address_id + to cms_address_bundles.bundle_id; + + GenericContactBundle[0..n] contacts = join cms_address_bundles.bundle_id + to cms_contact_address_map.address_id, + join cms_contact_address_map.contact_id + to cms_contact_bundles.bundle_id; + + //We don't need for UI purposes but other the ContentItem#add method does not return a link + //object if an association has no attributes... + BigDecimal[0..1] linkOrder = cms_contact_address_map.link_order INTEGER; + +} diff --git a/ccm-cms/src/WEB-INF/content-types/GenericAddress.xml b/ccm-cms/src/WEB-INF/content-types/GenericAddress.xml index 76b3367c6..6eb57b276 100644 --- a/ccm-cms/src/WEB-INF/content-types/GenericAddress.xml +++ b/ccm-cms/src/WEB-INF/content-types/GenericAddress.xml @@ -12,7 +12,7 @@ mode="hidden"> + createComponent="com.arsdigita.cms.contenttypes.ui.GenericAddressCreate">