From 0f780a23ba69a71a95834d84569b5ec41f52a118 Mon Sep 17 00:00:00 2001 From: quasi Date: Wed, 13 May 2009 13:26:12 +0000 Subject: [PATCH] BaseContact: Nun ist BaseContact nicht mehr von Person abgeleitet. Stattdessen wird Person als component verwendet. Die Klassen enthalten die ersten grundlegenden Methoden. git-svn-id: https://svn.libreccm.org/ccm/trunk@168 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms-types-baseContact/application.xml | 24 ++++++ .../cms/contenttypes/BaseContact.class | Bin 1519 -> 0 bytes .../contenttypes/BaseContactInitializer.class | Bin 1085 -> 0 bytes .../cms/contenttypes/BaseContactLoader.class | Bin 819 -> 0 bytes .../util/BaseContactGlobalizationUtil.class | Bin 1040 -> 0 bytes .../util/BaseContactResourceBundle.class | Bin 827 -> 0 bytes .../{BaseContact => BaseContact.pdl} | 10 ++- .../src/ccm-cms-types-baseContact.load | 3 +- .../cms/contenttypes/BaseContact.java | 81 +++++++++--------- .../cms/contenttypes/BaseContactEntry.java | 77 +++++++++++++++++ .../BaseContactEntryCollection.java | 43 ++++++++++ 11 files changed, 192 insertions(+), 46 deletions(-) create mode 100755 ccm-cms-types-baseContact/application.xml delete mode 100644 ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContact.class delete mode 100644 ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactInitializer.class delete mode 100644 ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/BaseContactLoader.class delete mode 100644 ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactGlobalizationUtil.class delete mode 100644 ccm-cms-types-baseContact/build/classes/com/arsdigita/cms/contenttypes/util/BaseContactResourceBundle.class rename ccm-cms-types-baseContact/pdl/com/arsdigita/content-types/{BaseContact => BaseContact.pdl} (63%) create mode 100644 ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntry.java create mode 100644 ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContactEntryCollection.java 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 b86f334c3752e4f62ccbf1aeb7d6f3d91df37986..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1519 zcmaizU2hvj6o#MU&(=70Lr8$sc2aK}XbUw8@>dZkYAVHw)T?N`9^8%W-N-wx zTK*L`7=gqO;71`e8#k<-G~A4K&YXG9Iqy6B_dkF91?*A3!Mz+yl(STFB&p`evtuLC zvTMKY+gL4&lj8vov+QO0N?2(&jyfmpMz?Wt*!-!}>Yj98zUT<0gH!cdIYZ?SoFg;# z{6SqlXw=rmQRTY+zsYwE&U`Mj}_GOwJb zH)w0u8>wO4)=zkSVfE^BA=i21>NDd7ewgKJVXM4Q`Am;PFErYBwR8AmJ3?;!PmWNz z4%1df9rjMOYa&`Q=$#7N*Dzxjgq7K>aT6k)tuR8ar+*H{`bfRDo1U}Gw zS6M;%IcG6nJr;`-k1e>Y|v>Np_~Brlc294=J!0p;ph+XDBGL#>WVs04apKQHSd@{62{&KU3YA zl3AoaCe4!=HFH7Du*RpCs2j7n=cw65>QmCx-$VV3O(g1Y>nheI3HM3!{d-uSN6v`- t7iO%+%#UJq%8lx8+`LWhcRu*9!2(I3Ns2ZFIuZEXn|Fc=Uq&u&{|n4dPO|_2 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 82506afa07cec67d4d16a72f94868881fb473f29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1085 zcma))T~8B16o%iSrQNRO!y+Q!$AXKrAUlWqMmSYk6_rmj&w*c-PB1) zS(ovSppg#O4{1|}p-8p~3OiCs`$)un#+p)z=e_tqBzx>25@}D(S+vg* zna2HO-gcxR*lcngQ6{%N^@X}E-AlN5CR16n7o&sJAOer`c!kGiC6lpo@LNXEZAU@; zhG3cNI5?9Y@Yn={(t{UC$do)`R%%toI2H-U|8$>Vmm15gzycgB;u?T5NLq+V zTn9ifg&TdyI`Y|@oBxXZ%Uor+_5O@f$X=EP2yUO?VERnPd{zax6DWK}@gtm62g!7t L64Hv9j5_-hb$A_v 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 045bdc14e5b07875374252976997b8712c81e294..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 819 zcma)&U279T6o%iEY?4h(Y)x&oRofM|&=#7B5kb=;v}p=~P=tg?@oKU=q*Hch>+WpP zf91!8Am|V9M~O_bl~MzC?&i#S&OGP+_51rz04+Eb6tP-H0c#~ZvhlctCnc;C%9kQe zWTbjNq252|mz)J$P1r!kQcd;|`cjFLG#ra~$j5;&zeOGoMm(10o)s;9CKE!d??oZwapKE~)SP)?!n{an zp|t*ZArf}T6VZv3=AQ0H+!yg4!JY^`G_Qo^t?jvP_P!Tnc9lVt#-2Eq#%1N7c?}aq z6*b(g;tr~W#hcj>y6kQDaJP4IeC4(~le@ip<3kt_nzsjL%MxDx2RRrgI_91>83{Fw z?{xn~=249gg0(4Da6NCrT!4LlcZ8gR( 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 0565df6f97a7c97697616445861ddf49d1e5b438..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1040 zcmbV~&2G~`6ot=?ow!L_T2d&K|Gux9^|70=SD?4LG>u;PM=Whs$~d9+P)MO46Rfq4Pq6#R zm=hKULh@l2k9himjUsMfNx&kXrNZ2cqOIQuMd%HJB=%UU#v&A&c|okaAd#9&tqPo!pneikJo7Ksl`i$v~g5p@amuqbjuf9?0yJ5wgd@|@uv6Zv?DE5$Yx#O}}B-5^$OId|9O?v~7-bCtK%%j7uX#N^d-vd#0s*M5Pe7k?$r%8(yx7Jf zkV}ComT(q89W5*ukMG0Ibfgc6r7iuIteZ<=BtH%g;LbyU<){g4<#mWNdm$l*Jxv}(na=e< zqe!LRxu+MU+WXzp`-6yfu!nuZewj--)ay*0@XVYpPvoG1yM)F?i(GiYAY627!ju16 zo$z3pKTFhTN=e#qolCI4A!jtafvZ25eM8sDZGBIxd6Y0H~k>0u?U?!a9JkM1Y;vXHd(ne8I|h sSf6mI<*uIJKbF)D04^*52e5Dt8#u%^?&B%|2ULi_#Wetg>m}pHFC}y7Gynhq 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(); + } + +}