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-94f89814c4dfmaster
parent
e58cb3c93a
commit
0f780a23ba
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-cms-types-baseContact"
|
||||||
|
prettyName="Red Hat CCM Content Types"
|
||||||
|
version="6.5.0"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.2.0" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/>
|
||||||
|
</ccm:dependencies>
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="pdl"/>
|
||||||
|
<ccm:directory name="sql"/>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
<ccm:description>
|
||||||
|
The BaseContact Content Type for the Red Hat CCM CMS.
|
||||||
|
</ccm:description>
|
||||||
|
</ccm:application>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,13 +1,17 @@
|
||||||
model com.arsdigita.cms.contenttypes;
|
model com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.Person;
|
import com.arsdigita.cms.contenttypes.Person;
|
||||||
|
import com.arsdigita.cms.contenttypes.BaseAddress;
|
||||||
import com.arsdigita.cms.*;
|
import com.arsdigita.cms.*;
|
||||||
|
|
||||||
// Contact Object
|
// Contact Object
|
||||||
object type BaseContact extends Person {
|
object type BaseContact extends ContentPage {
|
||||||
|
|
||||||
component BaseAddress [0..n] addresses = join ct_baseContacts.address_id
|
componetn Person [0..1] person = join ct_baseContacts.person_id
|
||||||
to ct_baseAddresses.address_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
|
component BaseContactEntry [0..n] contactentries = join ct_baseContacts.contact_id
|
||||||
to ct_baseContactEntries.contact_id;
|
to ct_baseContactEntries.contact_id;
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
<table name="inits"/>
|
<table name="inits"/>
|
||||||
<table name="acs_objects"/>
|
<table name="acs_objects"/>
|
||||||
<table name="cms_items"/>
|
<table name="cms_items"/>
|
||||||
<table name="ct_baseAdresses"/>
|
<table name="ct_baseAddresses"/>
|
||||||
|
<table name="ct_persons"/>
|
||||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
</requires>
|
</requires>
|
||||||
<provides>
|
<provides>
|
||||||
|
|
|
||||||
|
|
@ -35,30 +35,33 @@ import java.math.BigDecimal;
|
||||||
public class BaseContact extends ContentPage {
|
public class BaseContact extends ContentPage {
|
||||||
|
|
||||||
/** PDL property names */
|
/** 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 */
|
/** Data object type for tihs domain object */
|
||||||
public static final String BASE_DATA_OBJECT_TYPE
|
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);
|
super(BASE_DATA_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseContact ( BigDecimal id )
|
public BaseContact(BigDecimal id)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseContact ( OID id )
|
public BaseContact(OID id)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
super(id);
|
super(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseContact ( DataObject obj ) {
|
public BaseContact(DataObject obj) {
|
||||||
super(obj);
|
super(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseContact ( String type ) {
|
public BaseContact(String type) {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,46 +75,40 @@ public class BaseContact extends ContentPage {
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// accessors
|
// accessors
|
||||||
|
|
||||||
/*
|
// Set the person for this contact
|
||||||
public String getLink () {
|
public Person getPerson() {
|
||||||
return (String)get(LINK);
|
return (Person) get(PERSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLink ( String link ) {
|
// Get the person for this contact
|
||||||
set(LINK, link);
|
public void setPerson(Person person) {
|
||||||
|
set(PERSON, person);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
// Get the address for this contact
|
||||||
|
public BaseAddress getAddress() {
|
||||||
/*
|
return (BaseAddress) get(ADDRESS);
|
||||||
public BigDecimal getImageID() {
|
|
||||||
return (BigDecimal)get(IMAGE_ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageAsset getImage() {
|
// Set the address for this contact
|
||||||
DataObject obj = (DataObject)get(IMAGE);
|
public void setAddress(BaseAddress address) {
|
||||||
if ( obj == null ) {
|
set(ADDRESS, address);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ImageAsset(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImage(ImageAsset image) {
|
// Get all contact entries for this contact, p. ex. phone number, type of contact etc.
|
||||||
if (image != null)
|
public BaseContactEntryCollection getContactEntries() {
|
||||||
image.setMaster(this);
|
return new BaseContactEntryCollection ((DataCollection) get(CONTACT_ENTRIES));
|
||||||
setAssociation(IMAGE,image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add a contact entry for this contact
|
||||||
public void delete() {
|
public void addContactEntry(BaseContactEntry contactEntry) {
|
||||||
ImageAsset image = getImage();
|
Assert.exists(contactEntry, BaseContactEntry.class);
|
||||||
if (image != null) {
|
add(CONTACT_ENTRIES, contactEntry);
|
||||||
setAssociation(IMAGE, null);
|
}
|
||||||
save();
|
|
||||||
image.delete();
|
// Remove a contect entry for this contact
|
||||||
}
|
public void removeContactEntry(BaseContactEntry contactEntry) {
|
||||||
|
Assert.exists(contactEntry, BaseContactEntry.class);
|
||||||
super.delete();
|
remove(CONTACT_ENTRIES, contactEntry);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue