diff --git a/ccm-cms-types-baseContact/application.xml b/ccm-cms-types-baseContact/application.xml new file mode 100755 index 000000000..80cc1f8d1 --- /dev/null +++ b/ccm-cms-types-baseContact/application.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + The BaseContact Content Type for the Red Hat CCM CMS. + + diff --git a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContact.class b/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContact.class deleted file mode 100644 index b86f334c3..000000000 Binary files a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContact.class and /dev/null differ diff --git a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactInitializer.class b/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactInitializer.class deleted file mode 100644 index 82506afa0..000000000 Binary files a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactInitializer.class and /dev/null differ diff --git a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactLoader.class b/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactLoader.class deleted file mode 100644 index 045bdc14e..000000000 Binary files a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactLoader.class and /dev/null differ diff --git a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactGlobalizationUtil.class b/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactGlobalizationUtil.class deleted file mode 100644 index 0565df6f9..000000000 Binary files a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactGlobalizationUtil.class and /dev/null differ diff --git a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactResourceBundle.class b/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactResourceBundle.class deleted file mode 100644 index 61a21ae96..000000000 Binary files a/ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactResourceBundle.class and /dev/null differ diff --git a/ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/BaseContact b/ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/BaseContact.pdl similarity index 63% rename from ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/BaseContact rename to ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/BaseContact.pdl index 6817e52ef..8a2d4a475 100644 --- a/ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/BaseContact +++ b/ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/BaseContact.pdl @@ -1,13 +1,17 @@ model com.arsdigita.cms.contenttypes; import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.BaseAddress; import com.arsdigita.cms.*; // Contact Object -object type BaseContact extends Person { +object type BaseContact extends ContentPage { - component BaseAddress [0..n] addresses = join ct_baseContacts.address_id - to ct_baseAddresses.address_id; + componetn Person [0..1] person = join ct_baseContacts.person_id + to ct_persons.person_id; + + component BaseAddress [0..1] address = join ct_baseContacts.address_id + to ct_baseAddresses.address_id; component BaseContactEntry [0..n] contactentries = join ct_baseContacts.contact_id to ct_baseContactEntries.contact_id; diff --git a/ccm-cms-types-baseContact/src/ccm-cms-types-baseContact.load b/ccm-cms-types-baseContact/src/ccm-cms-types-baseContact.load index e87d198ac..ed764ee90 100755 --- a/ccm-cms-types-baseContact/src/ccm-cms-types-baseContact.load +++ b/ccm-cms-types-baseContact/src/ccm-cms-types-baseContact.load @@ -3,7 +3,8 @@
-
+
+
diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java index 45a0277fe..41433fdf6 100755 --- a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java @@ -35,30 +35,33 @@ import java.math.BigDecimal; public class BaseContact extends ContentPage { /** PDL property names */ + public static final String PERSON = "person"; + public static final String ADDRESS = "address"; + public static final String CONTACT_ENTRIES = "contactentries"; /** Data object type for tihs domain object */ public static final String BASE_DATA_OBJECT_TYPE - = "com.arsdigita.cms.contenttypes.Organization"; + = "com.arsdigita.cms.contenttypes.baseContact"; - public BaseContact () { + public BaseContact() { super(BASE_DATA_OBJECT_TYPE); } - public BaseContact ( BigDecimal id ) + public BaseContact(BigDecimal id) throws DataObjectNotFoundException { this(new OID(BASE_DATA_OBJECT_TYPE, id)); } - public BaseContact ( OID id ) + public BaseContact(OID id) throws DataObjectNotFoundException { super(id); } - public BaseContact ( DataObject obj ) { + public BaseContact(DataObject obj) { super(obj); } - public BaseContact ( String type ) { + public BaseContact(String type) { super(type); } @@ -72,46 +75,40 @@ public class BaseContact extends ContentPage { /////////////////////////////////////////////////////////////// // accessors -/* - public String getLink () { - return (String)get(LINK); + // Set the person for this contact + public Person getPerson() { + return (Person) get(PERSON); } - - public void setLink ( String link ) { - set(LINK, link); + + // Get the person for this contact + public void setPerson(Person person) { + set(PERSON, person); } -*/ - - -/* - public BigDecimal getImageID() { - return (BigDecimal)get(IMAGE_ID); + + // Get the address for this contact + public BaseAddress getAddress() { + return (BaseAddress) get(ADDRESS); } - - public ImageAsset getImage() { - DataObject obj = (DataObject)get(IMAGE); - if ( obj == null ) { - return null; - } - return new ImageAsset(obj); + + // Set the address for this contact + public void setAddress(BaseAddress address) { + set(ADDRESS, address); } - - public void setImage(ImageAsset image) { - if (image != null) - image.setMaster(this); - setAssociation(IMAGE,image); + + // Get all contact entries for this contact, p. ex. phone number, type of contact etc. + public BaseContactEntryCollection getContactEntries() { + return new BaseContactEntryCollection ((DataCollection) get(CONTACT_ENTRIES)); } - - - public void delete() { - ImageAsset image = getImage(); - if (image != null) { - setAssociation(IMAGE, null); - save(); - image.delete(); - } - - super.delete(); + + // Add a contact entry for this contact + public void addContactEntry(BaseContactEntry contactEntry) { + Assert.exists(contactEntry, BaseContactEntry.class); + add(CONTACT_ENTRIES, contactEntry); + } + + // Remove a contect entry for this contact + public void removeContactEntry(BaseContactEntry contactEntry) { + Assert.exists(contactEntry, BaseContactEntry.class); + remove(CONTACT_ENTRIES, contactEntry); } -*/ } diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntry.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntry.java new file mode 100644 index 000000000..bca929bc5 --- /dev/null +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntry.java @@ -0,0 +1,77 @@ +/* + * BaseContactEntry.java + * + * Created on 13. Mai 2009, 12:31 + * + * This class is part of BaseContact and stores the contact informations. + * These informations is organized by a key, which possible values are set by a config param. + * In addition there is a description field to provide additional information for this entry + * which will be shown along with the entry value, if set. If there is no description set, the + * key will be used as a fallback label. + * + * For example: + * key = "phone" + * description = "office phone" + * value = "1234 / 123456" + * + * would be shown as + * office phone: 1234 / 123456 + */ + +package com.arsdigita.cms.contenttypes; + +/** + * + * @author quasi + */ +public class BaseContactEntry extends DomainObject { + + private static final Logger s_log = Logger.getLogger(BaseContactEntry.class); + + /** PDL property names */ + public static final String KEY = "key"; + public static final String VALUE = "value"; + public static final String DESCRIPTION = "description"; + + public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.BaseContactEntry"; + + + /** + * Creates a new instance of BaseContactEntry + */ + public BaseContactEntry() { + } + + + ///////////////////////////////////////////////// + // accessors + + // Get key + public String getKey() { + return (String) get(KEY); + } + + // Set key + public void setKey(String key) { + set(KEY, key); + } + + // Get value + public String getValue() { + return (String) get(VALUE); + } + + // Set value + public void setValue(String value) { + set(VALUE, value); + } + + // Get description + public String getDescription() { + return (String) get(DESCRIPTION); + } + + public void setDescription(String Description) { + set(DESCRIPTION, description); + } +} diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntryCollection.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntryCollection.java new file mode 100644 index 000000000..48e2685e8 --- /dev/null +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntryCollection.java @@ -0,0 +1,43 @@ +/* + * BaseContactEntryCollection.java + * + * Created on 13. Mai 2009, 12:32 + * + * + */ + +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.persistence.DataCollection; +import org.apache.log4j.Logger; + +/** + * + * @author quasi + */ +public class BaseContactEntryCollection extends DomainCollection { + + /** + * Creates a new instance of BaseContactEntryCollection + */ + public BaseContactEntryCollection() { + } + + public final String getKey() { + return (String) getBaseContactEntry().getKey(); + } + + public final String getDescription() { + return (String) getBaseContactEntry().getDescription(); + } + + public final String getValue() { + return (String) getBaseContactEntry().getValue(); + } + + public BaseContactEntry getBaseContactEntry() { + return (BaseContactEntry) getDomainObject(); + } + +}