First try of a Person contenttype
git-svn-id: https://svn.libreccm.org/ccm/trunk@106 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
57aa67e968
commit
8c5e3c56ff
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
|
||||
|
||||
<ctd:content-type
|
||||
label="Person"
|
||||
description="A generic, Person type"
|
||||
objectType="com.arsdigita.cms.contenttypes.Person"
|
||||
classname="com.arsdigita.cms.contenttypes.Person">
|
||||
|
||||
<ctd:authoring-kit
|
||||
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="person.authoring.basic_properties.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.PersonResources"
|
||||
descriptionKey="person.authoring.basic_properties.description"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.PersonResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.PersonPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
</ctd:authoring-kit>
|
||||
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<config class="com.arsdigita.cms.contenttypes.PersonConfig"
|
||||
storage="ccm-cms-types-person/person.properties"/>
|
||||
</registry>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<load>
|
||||
<requires>
|
||||
<table name="inits"/>
|
||||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<table name="ct_persons"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.PersonInitializer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
<schema directory="ccm-cms-types-person"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.PersonLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (C) 2009 University Bremen, Center for Social Politics, Parkallee 39, 28209 Bremen.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.argsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Basic Person Contenttype for OpenCCM.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class Person extends ContentPage {
|
||||
|
||||
public static final String SURNAME = "surname";
|
||||
public static final String GIVENNAME = "givenname";
|
||||
public static final String TITLEPRE = "titlepre";
|
||||
public static final String TITLEPOST = "titlepost";
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Person";
|
||||
private static final PersonConfig s_config = new PersonConfig();
|
||||
|
||||
|
||||
static {
|
||||
s_config.load();
|
||||
}
|
||||
|
||||
public static final PersonConfig getConfig() {
|
||||
return s_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor. This creates a new (empty) Person.
|
||||
**/
|
||||
public Person() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public Person(BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public Person(OID id) throws DataObjectNotFoundException {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Person(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public Person(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public void beforeSave() {
|
||||
super.beforeSave();
|
||||
|
||||
Assert.exists(getContentType(), ContentType.class);
|
||||
}
|
||||
|
||||
/* accessors *****************************************************/
|
||||
public String getSurname() {
|
||||
return (String)get(SURNAME);
|
||||
}
|
||||
public void setSurname(String surname) {
|
||||
set(SURNAME, surname);
|
||||
}
|
||||
|
||||
public String getGivenName() {
|
||||
return (String)get(GIVENNAME);
|
||||
}
|
||||
public void setGivenName(String givenName) {
|
||||
set(GIVENNAME, givenName);
|
||||
}
|
||||
|
||||
public String getTitlePre() {
|
||||
return (String)get(TITLEPRE);
|
||||
}
|
||||
public void setTitlePre(String titlePre) {
|
||||
set(TITLEPRE, titlePre);
|
||||
}
|
||||
|
||||
public String getTitlePost() {
|
||||
return (String)get(TITLEPOST);
|
||||
}
|
||||
public void setTitlePost(String titlePost) {
|
||||
set(TITLEPOST, titlePost);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (C) 2009 University Bremen, Center for Social Politics, Parkallee 39, 28209 Bremen.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.argsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class PersonConfig extends AbstractConfig {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2009 University Bremen, Center for Social Politics, Parkallee 39, 28209 Bremen.
|
||||
*
|
||||
*/
|
||||
package com.argsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.domain.DomainObjectInstantiator;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.runtime.DomainInitEvent;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class PersonInitializer extends ContentTypeInitializer {
|
||||
|
||||
public final static String versionId =
|
||||
"$Id: AddressInitializer.java 1 2009-03-19 08:30:26Z jensp $" +
|
||||
"$Author: jensp $" +
|
||||
"$DateTime: 2009/03/19 09:30:00 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(PersonInitializer.class);
|
||||
|
||||
public PersonInitializer() {
|
||||
super("ccm-cms-types-person.pdl.mf",
|
||||
Person.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public void init(DomainInitEvent evt) {
|
||||
super.init(evt);
|
||||
}
|
||||
|
||||
public String[] getStylesheets() {
|
||||
return new String[] { "" };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (C) 2009 University Bremen, Center for Social Politics, Parkallee 39, 28209 Bremen.
|
||||
*
|
||||
*/
|
||||
package com.argsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class PersonLoader extends AbstractContentTypeLoader {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(PersonLoader.class);
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Person.xml"
|
||||
};
|
||||
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
model com.arsdigita.cms.ContentPage;
|
||||
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
|
||||
object type Person extends ContentPage {
|
||||
String[0..1] surname = ct_persons.surname VARCHAR(512);
|
||||
String[0..1] givenname = ct.persons.givenname VARCHAR(512);
|
||||
String[0..1] titlepre = ct.persons.titlepre VARCHAR(256);
|
||||
String[0..1] titlepost = ct.persons.titlepost VARCHAR(256);
|
||||
|
||||
reference key (ct.persons.person_id);
|
||||
}
|
||||
|
|
@ -75,7 +75,8 @@ public class BlobAd extends SimpleAdapter {
|
|||
return;
|
||||
}
|
||||
|
||||
oracle.sql.BLOB blob =
|
||||
/* Jens Pelzetter 2009-03-16 commented out to get rid of Netbeans errors */
|
||||
/*oracle.sql.BLOB blob =
|
||||
(oracle.sql.BLOB) rs.getBlob(column);
|
||||
OutputStream out = blob.getBinaryOutputStream();
|
||||
try {
|
||||
|
|
@ -88,7 +89,7 @@ public class BlobAd extends SimpleAdapter {
|
|||
// because the classpath isn't set up to include
|
||||
// com.arsdigita.util.*
|
||||
throw new Error("Unable to write LOB: " + e);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ public class StringAd extends SimpleAdapter {
|
|||
return;
|
||||
}
|
||||
|
||||
oracle.sql.CLOB clob =
|
||||
/* Jens Pelzetter 2009-03-16 commented out to get rid of Netbeans errors */
|
||||
/*oracle.sql.CLOB clob =
|
||||
(oracle.sql.CLOB) rs.getClob(column);
|
||||
Writer out = clob.getCharacterOutputStream();
|
||||
try {
|
||||
|
|
@ -88,7 +89,6 @@ public class StringAd extends SimpleAdapter {
|
|||
// because the classpath isn't set up to include
|
||||
// com.arsdigita.util.*
|
||||
throw new Error("Unable to write LOB: " + e);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue