First code for the new project content type, derivated from ccm-cms/GenericOrganizationalUnit.

git-svn-id: https://svn.libreccm.org/ccm/trunk@483 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2010-07-16 15:15:55 +00:00
parent 8087fba29f
commit e84fb90e82
38 changed files with 465 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-cms-types-project"
prettyName="OpenCCM Content Types"
version="6.6.0"
release="1"
webapp="ROOT">
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.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 Project Content Type for OpenCCM.
</ccm:description>
</ccm:application>

View File

@ -0,0 +1,49 @@
<?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">
<!-- Is internal will be set the yes when testing is finished. -->
<ctd:content-type
label="Organization"
description="A content type of organization."
objectType="com.arsdigita.cms.contenttypes.Project"
classname="com.arsdigita.cms.contenttypes.Project">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"
labelBundle="cms.contenttypes.cms.ui.CMSResources"
descriptionKey="cms.contenttypes.shared.basic_properties.description"
descriptionBundle="com.arsdigita.cms.ui.CMSResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
ordering="1"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.contact_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.contact_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitContactPropertiesStep"
ordering="2"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.child_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.child_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.ProjectChildrenPropertiesStep"
ordering="3"
/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<xrd:adapters
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<!--
Extend adapter for ContentItemPanel to also output the associated objects.
The default properties for BaseContact are left as is and are inherited from ContentPage
-->
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Project" extends="com.arsdigita.cms.ContentPage">
<xrd:associations rule="include">
<xrd:property name="/object/contacts"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<!-- <config class="com.arsdigita.cms.contenttypes.ProjectConfig" storage="ccm-cms-types-project/project.properties"/> -->
</registry>

View File

@ -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_projects"/>
<initializer class="com.arsdigita.cms.contenttypes.ProjectInitializer"/>
</provides>
<scripts>
<schema directory="ccm-cms-types-project"/>
<data class="com.arsdigita.cms.contenttypes.ProjectLoader"/>
</scripts>
</load>

View File

@ -0,0 +1 @@
com/arsdigita/content-types/Project.pdl

View File

@ -0,0 +1 @@
static/content-types/com/arsdigita/cms/contenttypes/Project.xsl

View File

@ -0,0 +1 @@
ddl-timestamp

View File

@ -0,0 +1 @@
@ ddl/oracle-se/table-ct_projects-auto.sql

View File

@ -0,0 +1,3 @@
alter table ct_projects add
constraint ct_projects_project_id_f_5k900 foreign key (project_id)
references cms_organizationalunit(organizationalunit_id);

View File

@ -0,0 +1,2 @@
alter table ct_projects
drop constraint ct_projects_project_id_f_5k900;

View File

@ -0,0 +1 @@
drop table ct_projects;

View File

@ -0,0 +1,6 @@
create table ct_projects (
project_id INTEGER not null
constraint ct_projects_project_id_p_temz1
primary key
-- referential constraint for project_id deferred due to circular dependencies
);

View File

@ -0,0 +1 @@
\i ddl/postgres/table-ct_projects-auto.sql

View File

@ -0,0 +1,3 @@
alter table ct_projects add
constraint ct_projects_project_id_f_5k900 foreign key (project_id)
references cms_organizationalunit(organizationalunit_id);

View File

@ -0,0 +1,2 @@
alter table ct_projects
drop constraint ct_projects_project_id_f_5k900 RESTRICT;

View File

@ -0,0 +1 @@
drop table ct_projects;

View File

@ -0,0 +1,6 @@
create table ct_projects (
project_id INTEGER not null
constraint ct_projects_project_id_p_temz1
primary key
-- referential constraint for project_id deferred due to circular dependencies
);

View File

@ -0,0 +1,3 @@
begin;
\i ddl/postgres/create.sql
end;

View File

@ -0,0 +1,8 @@
model com.arsdigita.cms.contenttypes;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.cms.*;
object type Project extends GenericOrganizationalUnit {
reference key ( ct_projects.project_id );
}

View File

@ -0,0 +1,3 @@
begin;
\i ddl/postgres/create.sql
end;

View File

@ -0,0 +1,49 @@
<?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">
<!-- Is internal will be set the yes when testing is finished. -->
<ctd:content-type
label="Organization"
description="A content type of organization."
objectType="com.arsdigita.cms.contenttypes.Project"
classname="com.arsdigita.cms.contenttypes.Project">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"
labelBundle="cms.contenttypes.cms.ui.CMSResources"
descriptionKey="cms.contenttypes.shared.basic_properties.description"
descriptionBundle="com.arsdigita.cms.ui.CMSResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
ordering="1"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.contact_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.contact_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitContactPropertiesStep"
ordering="2"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.child_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.child_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.ProjectChildrenPropertiesStep"
ordering="3"
/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<xrd:adapters
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<!--
Extend adapter for ContentItemPanel to also output the associated objects.
The default properties for BaseContact are left as is and are inherited from ContentPage
-->
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Project" extends="com.arsdigita.cms.ContentPage">
<xrd:associations rule="include">
<xrd:property name="/object/contacts"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<!-- <config class="com.arsdigita.cms.contenttypes.ProjectConfig" storage="ccm-cms-types-project/project.properties"/> -->
</registry>

View File

@ -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_projects"/>
<initializer class="com.arsdigita.cms.contenttypes.ProjectInitializer"/>
</provides>
<scripts>
<schema directory="ccm-cms-types-project"/>
<data class="com.arsdigita.cms.contenttypes.ProjectLoader"/>
</scripts>
</load>

View File

@ -0,0 +1,36 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import java.math.BigDecimal;
/**
*
* @author Jens Pelzetter
*/
public class Project extends GenericOrganizationalUnit{
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Project";
public Project() {
super(BASE_DATA_OBJECT_TYPE);
}
public Project(BigDecimal id ) throws DataObjectNotFoundException{
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public Project(OID oid) {
super(oid);
}
public Project(DataObject obj) {
super(obj);
}
public Project(String type) {
super(type);
}
}

View File

@ -0,0 +1,29 @@
package com.arsdigita.cms.contenttypes;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class ProjectInitializer extends ContentTypeInitializer {
private static final Logger s_log = Logger.getLogger(
ProjectInitializer.class);
public ProjectInitializer() {
super("ccm-cms-types-project.pdl.mf", Project.BASE_DATA_OBJECT_TYPE);
}
@Override
public String[] getStylesheets() {
return new String[]{
"/static/content-types/com/arsdigita/cms/contenttypes/Project.xsl"
};
}
@Override
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Project.xml";
}
}

View File

@ -0,0 +1,22 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes;
/**
*
* @author Jens Pelzetter
*/
public class ProjectLoader extends AbstractContentTypeLoader {
private static final String[] TYPES = {
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Project.xml"
};
public String[] getTypes() {
return TYPES;
}
}

View File

@ -0,0 +1,73 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.Project;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class ProjectAddChildForm extends BasicItemForm{
private static final Logger s_log = Logger.getLogger(ProjectAddChildForm.class);
private ProjectChildrenPropertiesStep m_step;
private ItemSearchWidget m_itemSearch;
private SaveCancelSection m_saveCancelSection;
private final String ITEM_SEARCH = "projectChild";
private ItemSelectionModel m_itemModel;
public ProjectAddChildForm(ItemSelectionModel itemModel) {
super("ChildAddForm", itemModel);
}
@Override
protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_child").localize()));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
Project.BASE_DATA_OBJECT_TYPE));
add(this.m_itemSearch);
}
@Override
public void init(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
setVisible(state, true);
}
@Override
public void process(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
GenericOrganizationalUnit parent = (GenericOrganizationalUnit) getItemSelectionModel().
getSelectedObject(state);
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
parent.addOrgaUnitChildren((GenericOrganizationalUnit) data.get(
ITEM_SEARCH));
}
init(fse);
}
}

View File

@ -0,0 +1,47 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.authoring.WorkflowLockedComponentAccess;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class ProjectChildrenPropertiesStep extends SimpleEditStep {
private final static Logger s_log = Logger.getLogger(
ProjectChildrenPropertiesStep.class);
private String ADD_CHILD_SHEET_NAME = "addChild";
public ProjectChildrenPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null);
}
public ProjectChildrenPropertiesStep(
ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix);
BasicItemForm addChildSheet = new ProjectAddChildForm(itemModel);
add(ADD_CHILD_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.add_child").localize(),
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
addChildSheet.getSaveCancelSection().getCancelButton());
GenericOrganizationalUnitChildTable childrenTable = new GenericOrganizationalUnitChildTable(
itemModel);
setDisplayComponent(childrenTable);
}
}

View File

@ -0,0 +1,19 @@
<!DOCTYPE stylesheet [
<!ENTITY nbsp "&#160;" ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
version="1.0">
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Project']" mode="cms:CT_graphics"
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_Project">
<p><xsl:value-of select="./name"/></p>
</xsl:template>
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Organization']" mode="cms:CT_text"
name="cms:CT_text_com_arsdigita_cms_contenttypes_Project">
<p><xsl:value-of select="./name"/></p>
</xsl:template>
</xsl:stylesheet>