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">