From 8de9e445fec5df7a93e5103b5b0077ff303fa29f Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 21 May 2009 08:17:41 +0000 Subject: [PATCH] First version of GenericOrganization with functions. Conmpiles, but I don't think it will work yet. AuthoringKit is missing also. git-svn-id: https://svn.libreccm.org/ccm/trunk@172 8810af33-2d31-482b-a856-94f89814c4df --- .../content-types/GenericOrganization.pdl | 13 ++++++++++++- .../src/ccm-cms-types-genericorganization.load | 2 ++ .../cms/contenttypes/GenericOrganization.java | 17 ++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl index 92820cf38..2fd3e0c94 100644 --- a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl +++ b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl @@ -21,11 +21,22 @@ model com.arsdigita.cms.contenttypes; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.DomainObject; object type GenericOrganization extends ContentPage { String[0..1] organizationname = ct_genericorganizations.organizationname VARCHAR(512); String[0..1] organizationnameaddendum = ct_genericorganizations.organizationnameaddendum VARCHAR(512); String[0..1] description = ct_genericorganizations.description VARCHAR(2000); + component OrganizationFunction[0..n] functions = join ct_genericorganizations.organization_id to ct_organizationfunctions.function_id; + reference key (ct_genericorganizations.organization_id); -} \ No newline at end of file +} + +object type OrganizationFunction extends ContentPage { + + String[1..1] functionname = ct_organizationfunctions.name VARCHAR(256); + + reference key ( ct_organizationfunctions.function_id ); +} + diff --git a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load b/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load index e1a12d9a7..ef8c59987 100644 --- a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load +++ b/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load @@ -3,10 +3,12 @@
+
+
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java index e421151c4..96c587bb8 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java @@ -27,7 +27,7 @@ import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.util.Assert; import java.math.BigDecimal; - +import com.arsdigita.persistence.DataCollection; /** * An very generic type to represent an organization. * @@ -38,6 +38,7 @@ public class GenericOrganization extends ContentPage { public static final String ORGANIZATIONNAME = "organizationname"; public static final String ORGANIZATIONNAMEADDENDUM = "organizationnameaddendum"; public static final String DESCRIPTION = "description"; + public static final String FUNCTIONS = "functions"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.GenericOrganization"; private static final GenericOrganizationConfig s_config = new GenericOrganizationConfig(); @@ -103,4 +104,18 @@ public class GenericOrganization extends ContentPage { public void setDescription(String description) { set(DESCRIPTION, description); } + + public OrganizationFunctionCollection getOrganizationFunctions() { + return new OrganizationFunctionCollection((DataCollection) get(FUNCTIONS)); + } + + public void addOrganizationFunction(OrganizationFunction organizationFunction) { + Assert.exists(organizationFunction, OrganizationFunction.class); + add(FUNCTIONS, organizationFunction); + } + + public void removeOrganizationFunction(OrganizationFunction organizationFunction) { + Assert.exists(organizationFunction, OrganizationFunction.class); + remove(FUNCTIONS, organizationFunction); + } } \ No newline at end of file