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
master
jensp 2009-05-21 08:17:41 +00:00
parent 7cb8d6c60f
commit 8de9e445fe
3 changed files with 30 additions and 2 deletions

View File

@ -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);
}
object type OrganizationFunction extends ContentPage {
String[1..1] functionname = ct_organizationfunctions.name VARCHAR(256);
reference key ( ct_organizationfunctions.function_id );
}

View File

@ -3,10 +3,12 @@
<table name="inits" />
<table name="acs_objects" />
<table name="cms_items" />
<table name="ct_persons" />
<initializer class="com.arsdigita.cms.Initializer" />
</requires>
<provides>
<table name="ct_genericorganizations" />
<table name="ct_organizationfunctions" />
<initializer class="com.arsdigita.cms.contenttypes.GenericOrganizationInitializer"/>
</provides>
<scripts>

View File

@ -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);
}
}