-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/application.xml b/ccm-cms-types-organizationalunit/application.xml
deleted file mode 100644
index 94dcccf3c..000000000
--- a/ccm-cms-types-organizationalunit/application.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Content type for representing organizational units.
-
-
diff --git a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/Membership.pdl b/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/Membership.pdl
deleted file mode 100644
index 63e855c9c..000000000
--- a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/Membership.pdl
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// Copyright (C) 2009 Center for Social Policy Reseearch, University of Bremen
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; either version 2.1 of
-// the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-
-object type Membership extends ACSObject {
- MembershipStatus[1..1] status = join ct_memberships.status_id to ct_membershipstatus.status_id;
- Date[0..1] memberFrom = ct_memberships.member_from DATE;
- Date[0..1] memberTo = ct_memberships.member_to DATE;
- GenericPerson[0..1] targetItem = join ct_memberships.target_item_id to cms_persons.person_id;
-
- reference key(ct_memberships.membership_id);
- aggressive load (membershipOwner.id);
-}
-
-association {
- composite OrganizationalUnit[0..1] membershipOwner = join ct_memberships.owner_id to ct_organizationalunits.organizationalunit_id;
- composite Membership[0..n] members = join ct_organizationalunits.organizationalunit_id to ct_memberships.owner_id;
-}
-
-query getMembershipsReferingToUnits {
- BigDecimal id;
-
- do {
- select m.membership_id from memberships m where m.target_item_id = :itemID;
- } map {
- id = m.membership_id;
- }
-}
diff --git a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/MembershipStatus.pdl b/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/MembershipStatus.pdl
deleted file mode 100644
index 64359b9fe..000000000
--- a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/MembershipStatus.pdl
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Copyright (c) 2009 Center for Social Policy Research, University of Bremen.
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; either version 2.1 of
-// the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-
-object type MembershipStatus extends ACSObject {
-
- String[1..1] membershipStatusName = ct_membershipstatus.status_name VARCHAR(250);
-
- reference key(ct_membershipstatus.status_id);
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/OrgaUnit2OrgaUnit.pdl b/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/OrgaUnit2OrgaUnit.pdl
deleted file mode 100644
index b873ecb91..000000000
--- a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/OrgaUnit2OrgaUnit.pdl
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Copyright (C) 2009 Center of Socialpolitics, University of Bremen
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; either version 2.1 of
-// the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.kernel.ACSObject;
-
-object type OrgaUnit2OrgaUnit extends ACSObject {
- OrganizationalUnit[0..1] targetItem = join ct_orgaunit2orgaunits.target_item_id to ct_organizationalunits.organizationalunit_id;
-
- Integer[0..1] unitOrder = ct_orgaunit2orgaunits.unit_order INTEGER;
-
- reference key(ct_orgaunit2orgaunits.orgaunit2orgaunit_id);
- aggressive load (unitOwner.id);
-}
-
-association {
- composite OrganizationalUnit[0..1] unitOwner = join ct_orgaunit2orgaunits.owner_id to ct_organizationalunits.organizationalunit_id;
- composite OrgaUnit2OrgaUnit[0..n] units = join ct_organizationalunits.organizationalunit_id to ct_orgaunit2orgaunits.owner_id;
-}
-
-query getReferingOrgaUnits {
- BigDecimal id;
-
- do {
- select u.organizationalunit_id from orgaunit2orgaunits u where u.target_item_id = :itemID
- } map {
- id = u.orgaunit2orgaunit_id;
- }
-}
-
-data operation swapOrgaUnit2OrgaUnitWithNextInGroup {
- do {
- update ct_orgaunit2orgaunits
- set unit_order = CASE WHEN (unit_order = :unitOrder) THEN
- (:nextUnitOrder)
- ELSE
- (:unitOrder)
- END
- where (unit_order = :unitOrder or unit_order = :nextUnitOrder)
- and owner_id = :ownerID
- }
-}
-
-query allUnitsOrderForUnit {
- Integer unitOrder;
-
- do {
- select u.unit_order from ct_orgaunit2orgaunits u where u.owner_id = :ownerID
- }
- map {
- unitOrder = u.unit_order;
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/OrganizationalUnit.pdl b/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/OrganizationalUnit.pdl
deleted file mode 100644
index 1b0cc7b15..000000000
--- a/ccm-cms-types-organizationalunit/pdl/com/arsdigita/content-types/OrganizationalUnit.pdl
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright (C) 2009 Jens Pelzetter, for the Center for Social Policy Research of the University of Bremen
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; either version 2.1 of
-// the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-//
-
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.DomainObject;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-
-object type OrganizationalUnit extends ContentPage {
- String[0..1] organizationalunitName = ct_organizationalunits.organizationalunit_name VARCHAR(512);
- String[0..1] organizationalunitDescription = ct_organizationalunits.organizationalunit_description VARCHAR(2048);
-
- OrgaUnit2OrgaUnit[0..n] subunits = join ct_organizationalunits.organizationalunit_id to ct_orgaunit2orgaunits.owner_id;
- Membership[0..n] memberships = join ct_organizationalunits.organizationalunit_id to ct_memberships.owner_id;
-
- reference key (ct_organizationalunits.organizationalunit_id);
- //aggressive load (direction.id);
- //aggressive load (assistentDirection.id);
-}
-
-
-association {
- GenericPerson[0..1] direction = join ct_organizationalunits.direction_id to cms_persons.person_id;
- OrganizationalUnit[0..n] directedUnit = join cms_persons.person_id to ct_organizationalunits.direction_id;
-}
-
-association {
- GenericPerson[0..1] assistentDirection = join ct_organizationalunits.assistantDirection_id to cms_persons.person_id;
- OrganizationalUnit[0..n] assistenedDirectedUnit = join cms_persons.person_id to ct_organizationalunits.assistantDirection_id;
-}
-
diff --git a/ccm-cms-types-organizationalunit/sql/ccm-cms-types-organizationalunit/postgres-create.sql b/ccm-cms-types-organizationalunit/sql/ccm-cms-types-organizationalunit/postgres-create.sql
deleted file mode 100644
index a733590e2..000000000
--- a/ccm-cms-types-organizationalunit/sql/ccm-cms-types-organizationalunit/postgres-create.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-begin;
-\i ddl/postgres/create.sql
-end;
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml b/ccm-cms-types-organizationalunit/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml
deleted file mode 100644
index 630a17af7..000000000
--- a/ccm-cms-types-organizationalunit/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ccm-cms-types-organizationalunit/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml b/ccm-cms-types-organizationalunit/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml
deleted file mode 100644
index 506cd7d3b..000000000
--- a/ccm-cms-types-organizationalunit/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/ccm-cms-types-organizationalunit.config b/ccm-cms-types-organizationalunit/src/ccm-cms-types-organizationalunit.config
deleted file mode 100644
index b6865e594..000000000
--- a/ccm-cms-types-organizationalunit/src/ccm-cms-types-organizationalunit.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/ccm-cms-types-organizationalunit.load b/ccm-cms-types-organizationalunit/src/ccm-cms-types-organizationalunit.load
deleted file mode 100644
index 8fe3d4dab..000000000
--- a/ccm-cms-types-organizationalunit/src/ccm-cms-types-organizationalunit.load
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java
deleted file mode 100644
index b61fe1a94..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.Filter;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import com.arsdigita.web.URL;
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.util.Date;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class Membership extends ACSObject {
-
- private final static Logger logger = Logger.getLogger(Membership.class);
- public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Membership";
- public final static String STATUS = "status";
- public final static String FROM = "memberFrom";
- public final static String TO = "memberTo";
- public final static String MEMBERSHIP_OWNER = "membershipOwner";
- public final static String TARGET_ITEM = "targetItem";
-
- public Membership() {
- super(BASE_DATA_OBJECT_TYPE);
- }
-
- public Membership(DataObject obj) {
- super(obj);
- }
-
- public Membership(BigDecimal id) {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public Membership(OID oid) {
- super(oid);
- }
-
- public Membership(String type) {
- super(type);
- }
-
- public MembershipStatus getStatus() {
- DataObject obj = (DataObject) get(STATUS);
- if (obj != null) {
- return new MembershipStatus(obj);
- } else {
- return null;
- }
- }
-
- public void setStatus(MembershipStatus status) {
- setAssociation(STATUS, status);
- }
-
- public String getStatusName() {
- String name = "";
- if (getStatus() != null) {
- name = getStatus().getStatusName();
- }
- return name;
- }
-
- public String formatDate(Date date) {
- if (date != null) {
- return DateFormat.getDateInstance(DateFormat.LONG).format(date);
- } else {
- return null;
- }
- }
-
- public Date getFrom() {
- return (Date) get(FROM);
- }
-
- public String getDisplayFrom() {
- return formatDate(getFrom());
- }
-
- public void setFrom(Date from) {
- set(FROM, from);
- }
-
- public Date getTo() {
- return (Date) get(TO);
- }
-
- public String getDisplayTo() {
- return formatDate(getTo());
- }
-
- public void setTo(Date to) {
- set(TO, to);
- }
-
- public OrganizationalUnit getMembershipOwner() {
- DataObject obj = (DataObject) get(MEMBERSHIP_OWNER);
- if (obj == null) {
- return null;
- } else {
- return (OrganizationalUnit) DomainObjectFactory.newInstance(obj);
- }
- }
-
- public void setMembershipOwner(OrganizationalUnit ou) {
- Assert.exists(ou, OrganizationalUnit.class);
- logger.debug("Setting membership owner to " + ou.getOrganizationalUnitName());
- setAssociation(MEMBERSHIP_OWNER, ou);
- }
-
- public GenericPerson getTargetItem() {
- DataObject obj = (DataObject) get(TARGET_ITEM);
- return (GenericPerson) DomainObjectFactory.newInstance(obj);
- }
-
- public void setTargetItem(GenericPerson person) {
- Assert.exists(person, GenericPerson.class);
- setAssociation(TARGET_ITEM, person);
- }
-
- public String getURI(PageState state) {
- GenericPerson person = this.getTargetItem();
-
- if (person == null) {
- logger.error(getOID() + " is a link between a OrganizationalUnit and a Person, but the associated Person is null");
- return "";
- }
-
- ContentSection section = person.getContentSection();
- ItemResolver resolver = section.getItemResolver();
- String url = resolver.generateItemURL(state, person, section, person.getVersion());
-
- return URL.there(state.getRequest(), url).toString();
- }
-
- public static DataCollection getReferingPersons(GenericPerson person) {
- Session session = SessionManager.getSession();
- DataCollection memberships = session.retrieve(BASE_DATA_OBJECT_TYPE);
- Filter filter = memberships.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferingPersons");
- filter.set("itemID", person.getID());
-
- return memberships;
- }
-
- public static DataCollection getMemberships(OrganizationalUnit ou) {
- Session session = SessionManager.getSession();
- DataCollection dc = session.retrieve(BASE_DATA_OBJECT_TYPE);
- dc.addEqualsFilter(MEMBERSHIP_OWNER + ".id", ou.getID());
- return dc;
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/MembershipStatus.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/MembershipStatus.java
deleted file mode 100644
index ffb088258..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/MembershipStatus.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.OID;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatus extends ACSObject {
-
- public static final Logger logger = Logger.getLogger(MembershipStatus.class);
-
- public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.MembershipStatus";
-
- public static final String MEMBERSHIP_STATUS_NAME = "membershipStatusName";
-
- public MembershipStatus() {
- super(BASE_DATA_OBJECT_TYPE);
- logger.debug("Paramless constructor...");
- }
-
- public MembershipStatus(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- logger.debug("id constructor...");
- }
-
- public MembershipStatus(OID id) throws DataObjectNotFoundException {
- super(id);
- logger.debug("oid constructor...");
- }
-
- public MembershipStatus(DataObject obj) {
- super(obj);
- logger.debug("obj constructor...");
- }
-
- public MembershipStatus(String type) {
- super(type);
- logger.debug("type constructor...");
- }
-
- public String getStatusName() {
- return (String) get(MEMBERSHIP_STATUS_NAME);
- }
-
- public void setStatusName(String typeName) {
- set(MEMBERSHIP_STATUS_NAME, typeName);
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/MembershipStatusCollection.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/MembershipStatusCollection.java
deleted file mode 100644
index 7f2d98db5..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/MembershipStatusCollection.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.SessionManager;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatusCollection extends DomainCollection {
-
- private final static Logger logger = Logger.getLogger(MembershipStatusCollection.class);
-
- public static MembershipStatusCollection getMembershipStatusCollection() {
- logger.debug("Getting MembershipStatusCollection...");
- //SessionManager.getSession().retrieve(MembershipStatus.BASE_DATA_OBJECT_TYPE);
- DataCollection statusCollection = SessionManager.getSession().retrieve(MembershipStatus.BASE_DATA_OBJECT_TYPE);
- logger.debug("statusCollection.isEmpty() returns: " + statusCollection.isEmpty());
- logger.debug("statusCollection.size() = " + statusCollection.size());
-
- return new MembershipStatusCollection(statusCollection);
- }
-
- private MembershipStatusCollection(DataCollection dataCollection) {
- super(dataCollection);
- logger.debug("MembershipStatusCollection constructor...");
- }
-
- @Override
- public DomainObject getDomainObject() {
- logger.debug("m_dataCollection.isEmpty(): " + m_dataCollection.isEmpty());
- if (m_dataCollection.isEmpty()) {
- return null;
- } else {
- logger.debug("Returning data object: " + m_dataCollection.getDataObject());
- return new MembershipStatus(m_dataCollection.getDataObject());
- }
- }
-
- public MembershipStatus getMembershipStatus() {
- return (MembershipStatus) getDomainObject();
- }
-
- public String getMembershipStatusName() {
- return getMembershipStatus().getStatusName();
- }
-
- public BigDecimal getMembershipStatusId() {
- return getMembershipStatus().getID();
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrgaUnit2OrgaUnit.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrgaUnit2OrgaUnit.java
deleted file mode 100644
index d146dc0e3..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrgaUnit2OrgaUnit.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataOperation;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.Filter;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import com.arsdigita.web.URL;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrgaUnit2OrgaUnit extends ACSObject {
-
- private final static Logger logger = Logger.getLogger(OrgaUnit2OrgaUnit.class);
- public final static String TARGETITEM = "targetItem";
- public final static String UNITOWNER = "unitOwner";
- public final static String UNITORDER = "unitOrder";
- public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrgaUnit2OrgaUnit";
-
- public OrgaUnit2OrgaUnit() {
- super(BASE_DATA_OBJECT_TYPE);
- }
-
- public OrgaUnit2OrgaUnit(DataObject obj) {
- super(obj);
- }
-
- public OrgaUnit2OrgaUnit(BigDecimal id) {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public OrgaUnit2OrgaUnit(OID id) {
- super(id);
- }
-
- public OrgaUnit2OrgaUnit(String type) {
- super(type);
- }
-
- public OrganizationalUnit getUnitOwner() {
- DataObject obj = (DataObject) get(UNITOWNER);
- if (obj == null) {
- return null;
- } else {
- return (OrganizationalUnit) DomainObjectFactory.newInstance(obj);
- }
- }
-
- public void setUnitOwner(OrganizationalUnit ou) {
- Assert.exists(ou, OrganizationalUnit.class);
- setAssociation(UNITOWNER, ou);
- }
-
- public OrganizationalUnit getTargetItem() {
- DataObject obj = (DataObject) get(TARGETITEM);
- return (OrganizationalUnit) DomainObjectFactory.newInstance(obj);
- }
-
- public void setTargetItem(OrganizationalUnit ou) {
- setAssociation(TARGETITEM, ou);
- }
-
- public Integer getOrder() {
- return (Integer) get(UNITORDER);
- }
-
- public void setOrder(Integer order) {
- Assert.exists(order);
- set(UNITORDER, order);
- }
-
- public String getURI(PageState state) {
- OrganizationalUnit ou = this.getTargetItem();
-
- if (ou == null) {
- logger.error(getOID() + " is a link between two organizational units, but the associated organizational unit is null");
- return "";
- }
-
- ContentSection section = ou.getContentSection();
- ItemResolver resolver = section.getItemResolver();
- String url = resolver.generateItemURL(state, ou, section, ou.getVersion());
-
- return URL.there(state.getRequest(), url).toString();
- }
-
- public static DataCollection getReferingUnits(OrganizationalUnit unit) {
- Session session = SessionManager.getSession();
- DataCollection units = session.retrieve(BASE_DATA_OBJECT_TYPE);
- Filter filter = units.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferingOrgaUnits");
- filter.set("itemID", unit.getID());
-
- return units;
- }
-
- public static DataCollection getUnits(OrganizationalUnit ou) {
- Session session = SessionManager.getSession();
- DataCollection units = session.retrieve(BASE_DATA_OBJECT_TYPE);
- units.addEqualsFilter(UNITOWNER + ".id", ou.getID());
- units.addOrder(UNITORDER);
- return units;
- }
-
- public void swapWithNext() {
- swapWithNext("com.arsdigita.cms.contenttypes.allUnitsOrderForUnit", "com.arsdigita.cms.contenttypes.swapOrgaUnit2OrgaUnitWithNextInGroup");
- }
-
- public void swapWithPrevious() {
- swapWithPrevious("com.arsdigita.cms.contenttypes.allUnitsOrderForUnit", "com.arsdigita.cms.contenttypes.swapOrgaUnit2OrgaUnitWithNextInGroup");
- }
-
- public void swapWithNext(String queryName, String operationName) {
- swapKeys(true, queryName, operationName);
- }
-
- public void swapWithPrevious(String queryName, String operationName) {
- swapKeys(false, queryName, operationName);
- }
-
- protected DataQuery getSwapQuery(String queryName) {
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("ownerID", getUnitOwner().getID());
- return query;
- }
-
- protected DataOperation getSwapOperation(String operationName) {
- DataOperation operation = SessionManager.getSession().retrieveDataOperation(operationName);
- operation.setParameter("ownerID", getUnitOwner().getID());
- return operation;
- }
-
- protected void swapKeys(boolean swapNext, String queryName, String operationName) {
- String methodName = null;
- if (swapNext) {
- methodName = "swapWithNext";
- } else {
- methodName = "swapWithPrevious";
- }
-
- Assert.isTrue(!isNew(), methodName + " cannot be called on an object that is new");
-
- Integer currentKey = (Integer) get(UNITORDER);
-
- if (currentKey == null) {
- alphabetize();
- return;
- }
-
- Assert.isTrue(currentKey != null, methodName + " cannot be " +
- "called on an object that is not currently in the " +
- "list");
-
- int key = currentKey.intValue();
-
- DataQuery query = getSwapQuery(queryName);
-
- int otherKey;
- if (swapNext) {
- otherKey = key + 1;
- query.addOrder("unitOrder ASC");
- query.addFilter(query.getFilterFactory().greaterThan("unitOrder", currentKey, true));
- } else {
- otherKey = key - 1;
- query.addOrder("unitOrder DESC");
- query.addFilter(query.getFilterFactory().lessThan("unitOrder", currentKey, true));
- }
-
- if (query.next()) {
- otherKey = ((Integer) query.get("unitOrder")).intValue();
- query.close();
- }
-
- DataOperation operation = getSwapOperation(operationName);
- operation.setParameter("unitOrder", new Integer(key));
- operation.setParameter("nextUnitOrder", new Integer(otherKey));
- operation.execute();
- }
-
- protected void alphabetize() {
- Session session = SessionManager.getSession();
- DataCollection units = session.retrieve(BASE_DATA_OBJECT_TYPE);
- units.addEqualsFilter(UNITOWNER + ".id", getUnitOwner().getID());
- int sortkey = 0;
- while (units.next()) {
- sortkey++;
- OrgaUnit2OrgaUnit ou2ou = new OrgaUnit2OrgaUnit(units.getDataObject());
- ou2ou.setOrder(sortkey);
- ou2ou.save();
- }
- }
-
- public int maxOrder() {
- OrganizationalUnit unitOwner = getUnitOwner();
- if (unitOwner == null) {
- return 0;
- }
-
- int returnOrder = 0;
- DataQuery query = SessionManager.getSession().retrieveQuery("com.arsdigita.cms.contenttypes.allUnitsOrderForUnit");
- query.setParameter("ownerID", getUnitOwner().getID());
- query.addOrder("unitOrder DESC");
- if (query.next()) {
- Integer unitOrder = ((Integer) query.get("unitOrder"));
- query.close();
- if (unitOrder != null) {
- returnOrder = unitOrder.intValue();
- }
- }
-
- return returnOrder;
- }
-
- @Override
- public void beforeSave() {
- super.beforeSave();
- if (getOrder() == null) {
- setOrder(maxOrder() + 1);
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java
deleted file mode 100644
index b3810d0e8..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnit extends ContentPage{
-
- private final static Logger logger = Logger.getLogger(OrganizationalUnit.class);
-
- public final static String ORGANIZATIONALUNIT_NAME = "organizationalunitName";
- public final static String ORGANIZATIONALUNIT_DESCRIPTION = "organizationalunitDescription";
-
- public final static String DIRECTION = "direction";
- public final static String ASSISTENT_DIRECTION = "assistentDirection";
-
- public final static String MEMBERSHIPS = "memberships";
-
- public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationalUnit";
-
- public OrganizationalUnit() {
- super(BASE_DATA_OBJECT_TYPE);
- }
-
- public OrganizationalUnit(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public OrganizationalUnit(OID id) throws DataObjectNotFoundException {
- super(id);
- }
-
- public OrganizationalUnit(DataObject obj) {
- super(obj);
- }
-
- public OrganizationalUnit(String type) {
- super(type);
- }
-
- /* accessors ***************************************************/
- public String getOrganizationalUnitName() {
- return (String)get(ORGANIZATIONALUNIT_NAME);
- }
-
- public void setOrganizationalUnitName(String name) {
- set(ORGANIZATIONALUNIT_NAME, name);
- }
-
- public String getOrganizationalUnitDescription() {
- return (String) get(ORGANIZATIONALUNIT_DESCRIPTION);
- }
-
- public void setOrganizationalUnitDescription(String description) {
- set(ORGANIZATIONALUNIT_DESCRIPTION, description);
- }
-
- public GenericPerson getDirection() {
- DataObject dobj = (DataObject) get(DIRECTION);
- if (dobj != null) {
- return (GenericPerson) DomainObjectFactory.newInstance(dobj);
- } else {
- return null;
- }
- }
-
- public void setDirection(GenericPerson person) {
- logger.debug("Setting direction...");
- Assert.exists(person, GenericPerson.class);
- setAssociation(DIRECTION, person);
- }
-
- public GenericPerson getAssistentDirection() {
- DataObject dobj = (DataObject) get(ASSISTENT_DIRECTION);
- if (dobj != null) {
- return (GenericPerson) DomainObjectFactory.newInstance(dobj);
- } else {
- return null;
- }
- }
-
- public void setAssistentDirection(GenericPerson person) {
- Assert.exists(person, GenericPerson.class);
- setAssociation(ASSISTENT_DIRECTION, person);
- }
-
- /*public MembershipCollection getMemberships() {
- return new MembershipCollection ((DataCollection) get(MEMBERSHIPS));
- }*/
-
- /*public void addMembership(Membership membership) {
- Assert.exists(membership, Membership.class);
- add(MEMBERSHIPS, membership);
- }*/
-
- /*public void removeMembership(Membership membership) {
- Assert.exists(membership, Membership.class);
- remove(MEMBERSHIPS, membership);
- }*/
-
- /*public boolean hasMemberships() {
- return !this.getMemberships().isEmpty();
- }*/
-
- @Override
- public String getBaseDataObjectType() {
- return BASE_DATA_OBJECT_TYPE;
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitGlobalizationUtil.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitGlobalizationUtil.java
deleted file mode 100644
index 82de693a3..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitGlobalizationUtil.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitGlobalizationUtil {
-
- final public static String BUNDLE_NAME =
- "com.arsdigita.cms.contenttypes.OrganizationalUnitResourceBundle";
-
- /**
- * This returns a globalized message using the type specific bundle,
- * BUNDLE_NAME
- */
- public static GlobalizedMessage globalize(String key) {
- return new GlobalizedMessage(key, BUNDLE_NAME);
- }
-
- /**
- * This returns a globalized message using the type specific bundle,
- * BUNDLE_NAME
- */
- public static GlobalizedMessage globalize(String key, Object[] args) {
- return new GlobalizedMessage(key, BUNDLE_NAME, args);
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitInitializer.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitInitializer.java
deleted file mode 100644
index 429cbd86f..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitInitializer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitInitializer extends ContentTypeInitializer {
-
- private final static Logger logger = Logger.getLogger(
- OrganizationalUnitInitializer.class);
-
- public OrganizationalUnitInitializer() {
- super("ccm-cms-types-organizationalunit.pdl.mf",
- OrganizationalUnit.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xsl"};
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml";
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitLoader.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitLoader.java
deleted file mode 100644
index b88012070..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitLoader.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitLoader extends AbstractContentTypeLoader {
-
- private final static Logger logger = Logger.getLogger(OrganizationalUnitLoader.class);
- private final static String[] TYPES = {"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xml"};
-
- public String[] getTypes() {
- return TYPES;
- }
-
- public OrganizationalUnitLoader() {
- super();
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResourceBundle.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResourceBundle.java
deleted file mode 100644
index 9f7b44b21..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResourceBundle.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.CMSGlobalized;
-import com.arsdigita.globalization.ChainedResourceBundle;
-import java.util.PropertyResourceBundle;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
-
- public final static String ORGANIZATIONAL_UNIT_BUNDLE_NAME =
- "com.arsdigita.cms.contenttypes.OrganizationalUnitResources";
-
- public OrganizationalUnitResourceBundle() {
- super();
- addBundle((PropertyResourceBundle)getBundle(ORGANIZATIONAL_UNIT_BUNDLE_NAME));
- addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
- }
-
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResources.properties b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResources.properties
deleted file mode 100644
index c345bfdd7..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResources.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-cms.contenttypes.ui.membershipstatus.warning_changes_here_significant_for_all=Attention: Changes here are significant for ALL organizational units!
-cms.contenttypes.ui.membershipstatus.statusname=Name of Status
-
-cms.contenttypes.ui.organizatialunit.unitdescription=Description
-cms.contenttypes.ui.organizatialunit.unitname=Name of organizational unit
-cms.contenttypes.ui.organizationalunit.description=Description
-cms.contenttypes.ui.organizationalunit.unitname=Name of organizational unit
-
-cms.contenttypes.ui.organizationalunit=Organizational Unit
-
-cms.contenttypes.ui.organizationalunit.assistentdirector.noPersonsAvailable=No Persons available.
-cms.contenttypes.ui.organizationalunit.assistentdirector.selectThisPerson=Select this person?
-cms.contenttypes.ui.organizationalunit.assistentdirector_givenname=Given name
-cms.contenttypes.ui.organizationalunit.assistentdirector_surname=Surname
-cms.contenttypes.ui.organizationalunit.assistentdirector_title_post=Post title
-cms.contenttypes.ui.organizationalunit.assistentdirector_title_pre=Pre title
-
-cms.contenttypes.ui.organizationalunit.director.noPersonsAvailable=No Persons available.
-cms.contenttypes.ui.organizationalunit.director.selectThisPerson=Select this person?
-cms.contenttypes.ui.organizationalunit.director_givenname=Given name
-cms.contenttypes.ui.organizationalunit.director_surname=Surname
-cms.contenttypes.ui.organizationalunit.director_title_post=Post title
-cms.contenttypes.ui.organizationalunit.director_title_pre=Pre title
-
-cms.contenttypes.ui.orgnizationalunit.membership.Person=Person
-cms.contenttypes.ui.orgnizationalunit.membership.Status=Status
-cms.contenttypes.ui.organizationalunit.membership.from=Member from
-cms.contenttypes.ui.organizationalunit.membership.to=Member to
-cms.contenttypes.ui.organizationalunit.membershipstatus.name=Name
-cms.contenttypes.ui.organizationalunit.membershipstatus.edit=Edit
-cms.contenttypes.ui.organizationalunit.membershipstatus.delete=Delete
-cms.contenttypes.ui.organizationalunit.nomembers=No members available
-cms.contenttypes.ui.organizationalunit.person=Person
-cms.contenttypes.ui.organizationalunit.status=Status
-cms.contenttypes.ui.organizationalunit.edit=Edit
-cms.contenttypes.ui.organizationalunit.noOrgaUnitsAssociatedWithThisOrgaUnit=There are no organizational units associated with this organizational unit.
-cms.contenttypes.ui.organizationalunit.edit.delete=Delete
-cms.contenttypes.ui.organizationalunit.selectAssistentDirector=Select assistent director
-cms.contenttypes.ui.organizationalunit.selectDirector=Select director
-
-organizationalunit.authoring.basic_properties.title=Basic properties
-organizationalunit.authoring.chooseDirector.title=Choose director
-organizationalunit.authoring.chooseAssistentDirector.title=Choose assistent director
-organizationalunit.authoring.subunits.title=Subunits
-organizationalunit.authoring.members.title=Members
-organizationalunit.authoring.membershipstatus.title=Status values for memberships
-
-
-
-
-
-
-
-
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResources_de.properties b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResources_de.properties
deleted file mode 100644
index 0fab661f3..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnitResources_de.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-cms.contenttypes.ui.membershipstatus.warning_changes_here_significant_for_all=AChtung: Die hier vorgenommenen \u00C4nderungen gelten f\u00FCr ALLE Organisationseinheiten!
-cms.contenttypes.ui.membershipstatus.statusname=Bezeichnung des Status
-
-cms.contenttypes.ui.organizatialunit.unitdescription=Beschreibung
-cms.contenttypes.ui.organizatialunit.unitname=Name der Organisationseinheit
-cms.contenttypes.ui.organizationalunit.description=Beschreibung
-cms.contenttypes.ui.organizationalunit.unitname=Name der Organisationseinheit
-
-cms.contenttypes.ui.organizationalunit=Organisationseinheit
-
-cms.contenttypes.ui.organizationalunit.assistentdirector.noPersonsAvailable=Keine Personen verf\u00FCgbar.
-cms.contenttypes.ui.organizationalunit.assistentdirector.selectThisPerson=Diese Person ausw\u00E4hlen?
-cms.contenttypes.ui.organizationalunit.assistentdirector_givenname=Vorname
-cms.contenttypes.ui.organizationalunit.assistentdirector_surname=Nachname
-cms.contenttypes.ui.organizationalunit.assistentdirector_title_post=Dem Namen vorangestellte(r) Titel
-cms.contenttypes.ui.organizationalunit.assistentdirector_title_pre=Dem Name nachgestellte(r) Titel
-
-cms.contenttypes.ui.organizationalunit.director.noPersonsAvailable=Keine Personen verf\u00FCgbar
-cms.contenttypes.ui.organizationalunit.director.selectThisPerson=Diese Person ausw\u00E4hlen
-cms.contenttypes.ui.organizationalunit.director_givenname=Vorname
-cms.contenttypes.ui.organizationalunit.director_surname=Nachname
-cms.contenttypes.ui.organizationalunit.director_title_post=Dem Namen vorangestellte(r) Titel
-cms.contenttypes.ui.organizationalunit.director_title_pre=Dem Name nachgestellte(r) Titel
-
-cms.contenttypes.ui.orgnizationalunit.membership.Person=Person
-cms.contenttypes.ui.orgnizationalunit.membership.Status=Status
-cms.contenttypes.ui.organizationalunit.membership.from=Mitglied seit
-cms.contenttypes.ui.organizationalunit.membership.to=Mitglied bis
-cms.contenttypes.ui.organizationalunit.membershipstatus.name=Name
-cms.contenttypes.ui.organizationalunit.membershipstatus.edit=Bearbeiten
-cms.contenttypes.ui.organizationalunit.membershipstatus.delete=L\u00F6schen
-cms.contenttypes.ui.organizationalunit.nomembers=Keine Mitglieder vorhanden.
-cms.contenttypes.ui.organizationalunit.person=Person
-cms.contenttypes.ui.organizationalunit.status=Status
-cms.contenttypes.ui.organizationalunit.edit=Bearbeiten
-cms.contenttypes.ui.organizationalunit.noOrgaUnitsAssociatedWithThisOrgaUnit=Diese Organisationseinheit hat keine untergeordneten Organisationseinheiten.
-cms.contenttypes.ui.organizationalunit.edit.delete=L\u00F6schen
-cms.contenttypes.ui.organizationalunit.selectAssistentDirector=Stellvertretenden Leiter ausw\u00E4hlen
-cms.contenttypes.ui.organizationalunit.selectDirector=Leiter ausw\u00E4hlen
-
-organizationalunit.authoring.basic_properties.title=Basiseigenschaften
-organizationalunit.authoring.chooseDirector.title=Leiter ausw\u00E4hlen
-organizationalunit.authoring.chooseAssistentDirector.title=Stellvertretenden Leiter ausw\u00E4hlen
-organizationalunit.authoring.subunits.title=Untergeordnete Organisationseinheiten
-organizationalunit.authoring.members.title=Mitglieder
-organizationalunit.authoring.membershipstatus.title=Statuswerte f\u00FCr Mitglieder
-
-
-
-
-
-
-
-
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/ChangeableSingleSelect.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/ChangeableSingleSelect.java
deleted file mode 100644
index 80625e089..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/ChangeableSingleSelect.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.util.Assert;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ChangeableSingleSelect extends SingleSelect {
-
- private ArrayList m_options;
- private ArrayList m_selected;
- private RequestLocal m_requestOptions = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState ps) {
- return new ArrayList();
- }
- };
-
- private final static String TOO_MANY_OPTIONS_SELECTED =
- "Only one option may be selected by default on this option group.";
-
- public ChangeableSingleSelect(String name) {
- super(new StringParameter(name));
- this.m_selected = new ArrayList();
- }
-
- public ChangeableSingleSelect(ParameterModel model) {
- super(model);
- this.m_selected = new ArrayList();
- }
-
- @Override
- public Iterator getOptions() {
- return m_options.iterator();
- }
-
- @Override
- public Iterator getOptions(PageState ps) {
- ArrayList allOptions = new ArrayList();
- allOptions.addAll(m_options);
- ArrayList requestOptions = (ArrayList) m_requestOptions.get(ps);
- for (Iterator i = requestOptions.iterator(); i.hasNext();) {
- Object obj = i.next();
- if (!allOptions.contains(obj)) {
- allOptions.add(obj);
- }
- }
- return allOptions.iterator();
- }
-
- @Override
- public void clearOptions() {
- //Assert.assertNotLocked(this);
- this.m_options = new ArrayList();
- }
-
- @Override
- public void addOption(Option opt, PageState ps) {
- if (this.m_options == null) {
- this.m_options = new ArrayList();
- }
- ArrayList list = m_options;
- if (ps == null) {
- //Assert.assertNotLocked(this);
- } else {
- list = (ArrayList) m_requestOptions.get(ps);
- }
- opt.setGroup(this);
- list.add(opt);
- }
-
- public void removeOption(Option opt, PageState ps) {
- ArrayList list = m_options;
- if (ps == null) {
- //Assert.assertNotLocked(this);
- } else {
- list = (ArrayList) m_requestOptions.get(ps);
- }
- list.remove(opt);
- }
-
- @Override
- public void removeOption(String key) {
- removeOption(key, null);
- }
-
- @Override
- public void removeOption(String key, PageState ps) {
- // This is not an entirely efficient technique. A more
- // efficient solution is to switch to using a HashMap.
- ArrayList list = m_options;
- if (ps == null) {
- //Assert.assertNotLocked(this);
- } else {
- list = (ArrayList) m_requestOptions.get(ps);
- }
-
- Iterator i = list.iterator();
- Option o = null;
- while (i.hasNext()) {
- o = (Option) i.next();
- if (o.getValue().equals(key)) {
- list.remove(o);
- break;
- }
- }
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public void setOptionSelected(String value) {
-// Assert.assertNotLocked(this);
- if (!isMultiple()) {
- // only one option may be selected
- // to this selected list better be empty
-// Assert.assertTrue(m_selected.size() == 0, TOO_MANY_OPTIONS_SELECTED);
- m_selected.add(value);
- getParameterModel().setDefaultValue(value);
- } else {
- m_selected.add(value);
- getParameterModel().setDefaultValue(m_selected.toArray());
- }
- }
-
- public void setOptionSelected(Option option) {
- setOptionSelected(option.getValue());
- }
-
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertiesStep.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertiesStep.java
deleted file mode 100644
index 5828279a9..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertiesStep.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.ui.ResettableContainer;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipPropertiesStep extends ResettableContainer {
-
- private static final Logger logger = Logger.getLogger(MembershipPropertiesStep.class);
- private AuthoringKitWizard m_parent;
- private ItemSelectionModel m_itemModel;
- private BigDecimalParameter m_membershipParam = new BigDecimalParameter("membership");
- private MembershipSelectionModel m_membershipModel; // = new MembershipSelectionModel(m_membershipParam);
-
- public MembershipPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- logger.debug("Creating MembershipPropertiesStep");
- this.m_itemModel = itemModel;
- this.m_parent = parent;
- setMembershipSelectionModel();
- add(getDisplayComponent());
-
- Form form = new Form("membershipEditForm");
- form.add(getEditSheet());
-
- WorkflowLockedContainer edit = new WorkflowLockedContainer(itemModel);
- edit.add(form);
- add(edit);
- }
-
- protected void setMembershipSelectionModel() {
- setMembershipSelectionModel(new MembershipSelectionModel(this.m_membershipParam));
- }
-
- protected void setMembershipSelectionModel(MembershipSelectionModel membershipModel) {
- this.m_membershipModel = membershipModel;
- }
-
- protected MembershipSelectionModel getMembershipSelectionModel() {
- return this.m_membershipModel;
- }
-
- protected BigDecimalParameter getMembershipParam() {
- return this.m_membershipParam;
- }
-
- public Component getDisplayComponent() {
- SimpleContainer container = new SimpleContainer();
- container.add(new MembershipTable(m_itemModel, m_membershipModel));
- return container;
- }
-
- public FormSection getEditSheet() {
- MembershipPropertyForm propertyForm = new MembershipPropertyForm(m_itemModel, m_membershipModel);
- propertyForm.setPropertiesStep(this);
- return propertyForm;
- }
-
- @Override
- public void register(Page p) {
- super.register(p);
- p.addComponentStateParam(this, m_membershipParam);
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java
deleted file mode 100644
index 6ff49aa36..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.bebop.parameters.DateParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.util.GlobalizationUtil;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.Membership;
-import com.arsdigita.cms.contenttypes.MembershipStatus;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-import java.util.Date;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipPropertyForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener {
-
- private final static Logger logger = Logger.getLogger(MembershipPropertyForm.class);
- public final static String ID = "membership_edit";
- private ItemSelectionModel m_itemModel;
- private MembershipSelectionModel m_membershipModel;
- private ItemSearchWidget m_personSearch;
- private final static String PERSON_SEARCH = "membership";
- private ChangeableSingleSelect m_status;
- private com.arsdigita.bebop.form.Date m_from;
- private com.arsdigita.bebop.form.Date m_to;
- private SaveCancelSection m_saveCancelSection;
- private MembershipPropertiesStep propertiesStep;
-
- public MembershipPropertyForm(ItemSelectionModel itemModel, MembershipSelectionModel membershipModel) {
- super(new ColumnPanel(2));
- this.m_itemModel = itemModel;
- this.m_membershipModel = membershipModel;
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(this);
- addValidationListener(this);
- addProcessListener(this);
- addSubmissionListener(this);
- }
-
- protected void setPropertiesStep(MembershipPropertiesStep propertiesStep) {
- this.propertiesStep = propertiesStep;
- }
-
- protected void addWidgets() {
- logger.debug("adding widgets...");
-
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.orgnizationalunit.membership.Person")));
- this.m_personSearch = new ItemSearchWidget(PERSON_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.GenericPerson"));
- add(this.m_personSearch);
-
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.orgnizationalunit.membership.Status")));
- ParameterModel statusParam = new StringParameter((Membership.STATUS));
- this.m_status = new ChangeableSingleSelect(statusParam);
- add(this.m_status);
- //MembershipStatusCollection statusValues = MembershipStatusCollection.getMembershipStatusCollection();
- this.addStatusOptions();
-
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.membership.from")));
- ParameterModel fromParam = new DateParameter(Membership.FROM);
- //fromParam.addParameterListener(new NotNullValidationListener());
- this.m_from = new com.arsdigita.bebop.form.Date(fromParam);
- add(this.m_from);
-
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.membership.to")));
- ParameterModel toParam = new DateParameter(Membership.TO);
- this.m_to = new com.arsdigita.bebop.form.Date(toParam);
- add(this.m_to);
- }
-
- private void addStatusOptions() {
- DataCollection statusValues = SessionManager.getSession().retrieve(MembershipStatus.BASE_DATA_OBJECT_TYPE);
- while (statusValues.next()) {
- //this.m_status.addOption(new Option(statusValues.getMembershipStatusId().toString(), statusValues.getMembershipStatusName()));
- MembershipStatus status = (MembershipStatus) DomainObjectFactory.newInstance(statusValues.getDataObject());
- this.m_status.addOption(new Option(status.getID().toString(), status.getStatusName()));
- }
- }
-
- protected void addSaveCancelSection() {
- this.m_saveCancelSection = new SaveCancelSection();
- try {
- this.m_saveCancelSection.getCancelButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_membershipModel.isSelected(e.getPageState())) {
- target.setButtonLabel(GlobalizationUtil.globalize("cancel"));
- } else {
- target.setButtonLabel(GlobalizationUtil.globalize("reset"));
- }
- }
- });
-
- this.m_saveCancelSection.getSaveButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_membershipModel.isSelected(e.getPageState())) {
- target.setButtonLabel(GlobalizationUtil.globalize("save"));
- } else {
- target.setButtonLabel(GlobalizationUtil.globalize("create"));
- }
- }
- });
- } catch (Exception ex) {
- throw new UncheckedWrapperException("this cannot happen", ex);
- }
- add(this.m_saveCancelSection, ColumnPanel.FULL_WIDTH);
- }
-
- public SaveCancelSection getSaveCancelSection() {
- return this.m_saveCancelSection;
- }
-
- protected MembershipSelectionModel getMembershipSelectionModel() {
- return this.m_membershipModel;
- }
-
- protected OrganizationalUnit getOrganizationalUnit(PageState state) {
- return (OrganizationalUnit) m_itemModel.getSelectedItem(state);
- }
-
- protected Membership createMembership(PageState state) {
- OrganizationalUnit ou = this.getOrganizationalUnit(state);
- logger.debug("Owning ou: " + ou.getOrganizationalUnitName());
- Assert.exists(ou);
- Membership membership = new Membership();
- membership.setMembershipOwner(ou);
- logger.debug("set ou to: " + membership.getMembershipOwner().getOrganizationalUnitName());
- return membership;
- }
-
- protected void setMembershipProperties(Membership membership, FormSectionEvent event) {
- PageState state = event.getPageState();
- FormData data = event.getFormData();
-
- membership.setTargetItem((GenericPerson) data.get(PERSON_SEARCH));
-
- MembershipStatus status = new MembershipStatus(new BigDecimal((String) this.m_status.getValue(state)));
- logger.debug("this.m_status.getValues() = " + this.m_status.getValue(state));
- membership.setStatus(status);
-
- membership.setFrom((Date) this.m_from.getValue(state));
- membership.setTo((Date) this.m_to.getValue(state));
-
- membership.save();
- logger.debug("Adding membership to collection of orgaunit...");
- OrganizationalUnit orgaunit = this.getOrganizationalUnit(state);
- //orgaunit.addMembership(membership);
- logger.debug("saving orgaunit...");
- //this.getOrganizationalUnit(state).save();
- logger.debug("done.");
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- logger.debug("Init listener invoked.");
-
- FormData data = e.getFormData();
- PageState state = e.getPageState();
-
- //Iterator it = this.m_status.getOptions();
- //while(it.hasNext()) {
- // Option o = (Option) it.next();
- // //this.m_status.removeOption(o);
- //}
-
- this.m_status.clearOptions();
- this.addStatusOptions();
-
- setVisible(state, true);
-
- Membership membership;
- if (m_membershipModel.isSelected(state)) {
- membership = m_membershipModel.getSelectedMembership(state);
- try {
- data.put(PERSON_SEARCH, membership.getTargetItem());
- data.put(Membership.STATUS, membership.getStatus());
- data.put(Membership.FROM, membership.getFrom());
- data.put(Membership.TO, membership.getTo());
- } catch (IllegalStateException ex) {
- throw ex;
- }
- } else {
- data.put(PERSON_SEARCH, null);
- }
- logger.debug("init listener finished.");
- }
-
- public void process(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
- Membership membership;
-
- if (this.getSaveCancelSection().getCancelButton().isSelected(state)) {
- this.m_membershipModel.clearSelection(state);
- } else {
- if (this.m_membershipModel.isSelected(state)) {
- membership = m_membershipModel.getSelectedMembership(state);
- } else {
- membership = createMembership(state);
- }
- setMembershipProperties(membership, e);
- }
-
- this.m_membershipModel.clearSelection(state);
- init(e);
- }
-
- public void validate(FormSectionEvent e) throws FormProcessException {
- if (e.getFormData().get(PERSON_SEARCH) == null) {
- throw new FormProcessException("Person selection is required");
- }
-
- if (e.getFormData().get(Membership.STATUS) == null) {
- throw new FormProcessException("Status of membership is required");
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- if (this.m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) {
- m_membershipModel.clearSelection(e.getPageState());
- init(e);
- throw new FormProcessException("cancelled");
- }
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipSelectionModel.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipSelectionModel.java
deleted file mode 100644
index 9853c65f7..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipSelectionModel.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.contenttypes.Membership;
-import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipSelectionModel extends ACSObjectSelectionModel {
-
- public MembershipSelectionModel(BigDecimalParameter param) {
- super(Membership.class.getName(), Membership.BASE_DATA_OBJECT_TYPE, param);
- }
-
- public MembershipSelectionModel(String itemClass, String objectType, BigDecimalParameter param) {
- super(itemClass, objectType, param);
- }
-
- public Membership getSelectedMembership(PageState state) {
- return (Membership) getSelectedObject(state);
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusPropertiesStep.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusPropertiesStep.java
deleted file mode 100644
index c578c2ef2..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusPropertiesStep.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.cms.contenttypes.ui.*;
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatusPropertiesStep extends ResettableContainer {
-
- private Logger logger = Logger.getLogger(MembershipStatusPropertiesStep.class);
-
- private AuthoringKitWizard m_parent;
-
- private ItemSelectionModel m_itemModel;
- private BigDecimalParameter m_statusParam = new BigDecimalParameter(("membershipstatus"));
- private MembershipStatusSelectionModel m_statusModel = new MembershipStatusSelectionModel(m_statusParam);
-
- public MembershipStatusPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- logger.debug("Invoking MembershipStatusPropertiesStep(itemModel, parent)...");
- this.m_itemModel = itemModel;
- this.m_parent = parent;
- setMembershipStatusSelectionModel();
- add(getDisplayComponent());
-
- Form form = form = new Form("membershipStatusEditForm");
- form.add(getEditSheet());
-
- WorkflowLockedContainer edit = new WorkflowLockedContainer(itemModel);
- edit.add(form);
- add(edit);
- logger.debug("finished.");
- }
-
- protected void setMembershipStatusSelectionModel() {
- setMembershipStatusSelectionModel(new MembershipStatusSelectionModel(m_statusParam));
- }
-
- protected void setMembershipStatusSelectionModel(MembershipStatusSelectionModel statusModel) {
- this.m_statusModel = statusModel;
- }
-
- protected MembershipStatusSelectionModel getMembershipStatusSelectionModel() {
- return this.m_statusModel;
- }
-
- protected BigDecimalParameter getStatusParam() {
- return this.m_statusParam;
- }
-
- protected Component getDisplayComponent() {
- SimpleContainer container = new SimpleContainer();
- container.add(new MembershipStatusTable(this.m_itemModel, this.m_statusModel));
- return container;
- }
-
- protected FormSection getEditSheet() {
- return new MembershipStatusPropertyForm((this.m_itemModel), this.m_statusModel);
- }
-
- @Override
- public void register(Page p) {
- this.logger.info("registering...");
- super.register(p);
- p.addComponentStateParam(this, this.m_statusParam);
- this.logger.info("finished...");
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusPropertyForm.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusPropertyForm.java
deleted file mode 100644
index 2f12197c2..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusPropertyForm.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.MembershipStatus;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.util.UncheckedWrapperException;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatusPropertyForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener {
-
- private final static Logger logger = Logger.getLogger(MembershipStatusPropertyForm.class);
-
- public final static String ID = "membershipStatusEditForm_edit";
- private ItemSelectionModel m_itemModel;
- private MembershipStatusSelectionModel m_statusModel;
- private TextField m_statusName;
- private SaveCancelSection m_saveCancelSection;
-
- public MembershipStatusPropertyForm(ItemSelectionModel itemModel, MembershipStatusSelectionModel statusModel) {
- super(new ColumnPanel(2));
- logger.debug("Constructor...");
- this.m_itemModel = itemModel;
- this.m_statusModel = statusModel;
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(this);
- addValidationListener(this);
- addProcessListener(this);
- addSubmissionListener(this);
- logger.debug("Constructor finished...");
- }
-
- protected void addWidgets() {
- logger.debug("Adding widgets...");
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.membershipstatus.warning_changes_here_significant_for_all")), ColumnPanel.FULL_WIDTH);
- this.m_statusName = new TextField("statusName");
- this.m_statusName.addValidationListener(new NotNullValidationListener());
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.membershipstatus.statusname")));
- add(this.m_statusName);
- logger.debug("widgets added");
- }
-
- protected void addSaveCancelSection() {
- logger.debug("adding savecancelsec...");
- this.m_saveCancelSection = new SaveCancelSection();
- try {
- this.m_saveCancelSection.getCancelButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_statusModel.isSelected(e.getPageState())) {
- target.setButtonLabel(GlobalizationUtil.globalize("cancel"));
- } else {
- target.setButtonLabel(GlobalizationUtil.globalize("reset"));
- }
- }
- });
-
- this.m_saveCancelSection.getSaveButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_statusModel.isSelected(e.getPageState())) {
- target.setButtonLabel(GlobalizationUtil.globalize("save"));
- } else {
- target.setButtonLabel(GlobalizationUtil.globalize("create"));
- }
- }
- });
- } catch(Exception ex) {
- throw new UncheckedWrapperException("this cannot happen", ex);
- }
- add(this.m_saveCancelSection, ColumnPanel.FULL_WIDTH);
- logger.debug("savecancelsec added.");
- }
-
- public SaveCancelSection getSaveCancelSection() {
- return this.m_saveCancelSection;
- }
-
- protected MembershipStatusSelectionModel getMembershipStatusSelectionModel() {
- return this.m_statusModel;
- }
-
- protected MembershipStatus createMembershipStatus(PageState state) {
- logger.debug("creating new membership status...");
- MembershipStatus status = new MembershipStatus();
- logger.debug("new membership status created.");
- return status;
- }
-
- protected void setMembershipStatusProperties(MembershipStatus status, FormSectionEvent e) {
- logger.debug("setting properties...");
- PageState state = e.getPageState();
- //FormData data = e.getFormData();
-
- status.setStatusName((String) m_statusName.getValue(state));
- status.save();
- logger.debug("properties set");
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- logger.debug("init Listener invoked.");
- PageState state = e.getPageState();
- //FormData data = e.getFormData();
-
- setVisible(state, true);
-
- MembershipStatus status;
- if (m_statusModel.isSelected(state)) {
- status = m_statusModel.getSelectedMembershipStatus(state);
- try {
- m_statusName.setValue(state, status.getStatusName());
- } catch (IllegalStateException ex) {
- throw ex;
- }
- } else {
- m_statusName.setValue(state, null);
- }
- logger.debug("init Listener finished.");
- }
-
- public void process(FormSectionEvent e) throws FormProcessException {
- logger.debug("process Listener invoked.");
- PageState state = e.getPageState();
- MembershipStatus status;
-
- if (this.getSaveCancelSection().getCancelButton().isSelected(state)) {
- m_statusModel.clearSelection(state);
- } else {
- if (m_statusModel.isSelected(state)) {
- status = m_statusModel.getSelectedMembershipStatus(state);
- } else {
- status = createMembershipStatus(state);
- }
- setMembershipStatusProperties(status, e);
- }
-
- m_statusModel.clearSelection(state);
- init(e);
- logger.debug("process Listener finished.");
- }
-
- public void validate(FormSectionEvent e) throws FormProcessException {
- //Nothing yet
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- logger.debug("submit Listener invoked.");
- if (this.m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) {
- m_statusModel.clearSelection(e.getPageState());
- init(e);
- throw new FormProcessException("cancelled");
- }
- logger.debug("submit Listener finished.");
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusSelectionModel.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusSelectionModel.java
deleted file mode 100644
index 644775c20..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusSelectionModel.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.contenttypes.MembershipStatus;
-import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatusSelectionModel extends ACSObjectSelectionModel {
-
- public MembershipStatusSelectionModel(BigDecimalParameter param) {
- super(MembershipStatus.class.getName(), MembershipStatus.BASE_DATA_OBJECT_TYPE, param);
- }
-
- public MembershipStatusSelectionModel(String itemClass, String objectType, BigDecimalParameter parameter) {
- super(itemClass, objectType, parameter);
- }
-
- public MembershipStatus getSelectedMembershipStatus(PageState state) {
- return (MembershipStatus) getSelectedObject(state);
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusTable.java
deleted file mode 100644
index 1b8e03e24..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusTable.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.MembershipStatus;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatusTable extends Table {
-
- private final static Logger logger = Logger.getLogger(MembershipStatusTable.class);
- private MembershipStatusSelectionModel m_statusModel;
- private ItemSelectionModel m_itemModel;
- private TableColumn m_statusNameCol;
- private TableColumn m_editCol;
- private TableColumn m_delCol;
- private RequestLocal m_size;
- private RequestLocal m_editor;
- protected final static String EDIT_EVENT = "Edit";
- protected final static String DELETE_EVENT = "Delete";
-
- public MembershipStatusTable(ItemSelectionModel itemModel, MembershipStatusSelectionModel statusModel) {
- super();
- this.m_itemModel = itemModel;
- this.m_statusModel = statusModel;
- addColumns();
-
- m_size = new RequestLocal();
- m_editor = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState state) {
- SecurityManager sm = Utilities.getSecurityManager(state);
- ContentItem item = m_itemModel.getSelectedItem(state);
- Boolean val = new Boolean(sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, item));
- return val;
- }
- };
-
- Label empty = new Label("There are no status values available.");
- setEmptyView(empty);
- addTableActionListener(new MembershipStatusTableActionListener());
- setRowSelectionModel(this.m_statusModel);
- setDefaultCellRenderer(new MembershipStatusTableRenderer());
- setModelBuilder(new MembershipStatusTableModelBuilder(itemModel));
- }
-
- protected void addColumns() {
- TableColumnModel model = getColumnModel();
- int i = 0;
- this.m_statusNameCol = new TableColumn(i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.membershipstatus.name"));
- this.m_editCol = new TableColumn(++i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.membershipstatus.edit"));
- this.m_delCol = new TableColumn(++i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.membershipstatus.delete"));
-
- model.add(this.m_statusNameCol);
- model.add(this.m_editCol);
- model.add(this.m_delCol);
- setColumnModel(model);
- }
-
- private class MembershipStatusTableRenderer implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
-
- MembershipStatus status = (MembershipStatus) value;
- boolean isFirst = (row == 0);
- if (m_size.get(state) == null) {
- m_size.set(state, new Long(((MembershipStatusTableModelBuilder.MembershipStatusTableModel) table.getTableModel(state)).size()));
- }
- boolean isLast = (row == ((Long) m_size.get(state)).intValue() - 1);
-
- if (column == m_statusNameCol.getModelIndex()) {
- Label statusNameLabel = new Label(status.getStatusName());
- return statusNameLabel;
- } else if (column == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- if (isSelected) {
- return new Label(EDIT_EVENT, Label.BOLD);
- } else {
- return new ControlLink(EDIT_EVENT);
- }
- } else {
- return new Label(EDIT_EVENT);
- }
- } else if (column == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- return new ControlLink(DELETE_EVENT);
- } else {
- return new Label(DELETE_EVENT);
- }
- } else {
- throw new UncheckedWrapperException("column index out of bounds");
- }
- }
- }
-
- private class MembershipStatusTableActionListener implements TableActionListener {
-
- private MembershipStatus getMembershipStatus(TableActionEvent e) {
- Object o = e.getRowKey();
- BigDecimal id;
- if (o instanceof String) {
- id = new BigDecimal((String) o);
- } else {
- id = (BigDecimal) e.getRowKey();
- }
-
- Assert.exists(id);
- MembershipStatus status;
- try {
- status = (MembershipStatus) DomainObjectFactory.newInstance(new OID(MembershipStatus.BASE_DATA_OBJECT_TYPE, id));
- } catch (DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException(ex);
- }
- return status;
- }
-
- public void cellSelected(TableActionEvent e) {
- int col = e.getColumn().intValue();
- PageState state = e.getPageState();
- MembershipStatus status = getMembershipStatus(e);
- Assert.exists(status);
-
- if (col == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- m_statusModel.setSelectedObject(state, status);
- }
- } else if (col == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- try {
- m_statusModel.clearSelection(state);
- status.delete();
- } catch (Exception ex) {
- throw new UncheckedWrapperException(ex);
- }
- }
- }
- }
-
- public void headSelected(TableActionEvent e) {
- //Nothing
- }
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusTableModelBuilder.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusTableModelBuilder.java
deleted file mode 100644
index c8d944187..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipStatusTableModelBuilder.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.MembershipStatus;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipStatusTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- private final static Logger logger = Logger.getLogger(MembershipStatusTableModelBuilder.class);
- private ItemSelectionModel m_itemModel;
-
- public MembershipStatusTableModelBuilder(ItemSelectionModel itemModel) {
- this.m_itemModel = itemModel;
- }
-
- public TableModel makeModel(Table t, PageState s) {
- DataCollection statusValues = getStatus(s);
-
- if (statusValues == null ||
- statusValues.isEmpty()) {
- return Table.EMPTY_MODEL;
- } else {
- return new MembershipStatusTableModel(statusValues);
- }
- }
-
- public DataCollection getStatus(PageState state) {
- //Assert.isTrue(this.m_itemModel.isSelected(state), "item selected");
- /*try {
- logger.debug("Returning data collection...");
- return (DataCollection) MembershipStatusCollection.getMembershipStatusCollection().getDomainObject();
- } catch (Exception ex) {
- logger.debug("returning null because I got this exception:\n", ex);
- return null;
- }*/
- return SessionManager.getSession().retrieve(MembershipStatus.BASE_DATA_OBJECT_TYPE);
- }
-
- public static class MembershipStatusTableModel implements TableModel {
-
- MembershipStatus m_status;
- DataCollection m_statusValues;
-
- public MembershipStatusTableModel(DataCollection statusValues) {
- m_statusValues = statusValues;
- m_status = null;
- }
-
- public int getColumnCount() {
- return (int) m_statusValues.size();
- }
-
- public boolean nextRow() {
- if (m_statusValues.next()) {
- DataObject obj = m_statusValues.getDataObject();
- m_status = (MembershipStatus) DomainObjectFactory.newInstance(obj);
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- return m_status;
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_status.getID();
- }
-
- public long size() {
- return m_statusValues.size();
- }
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java
deleted file mode 100644
index 8e58f6e75..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.ExternalLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.SecurityManager;
-import org.apache.log4j.Logger;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.Membership;
-import com.arsdigita.cms.contenttypes.MembershipStatus;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipTable extends Table {
-
- private final static Logger logger = Logger.getLogger(MembershipTable.class);
- private MembershipSelectionModel m_membershipModel;
- private ItemSelectionModel m_itemModel;
- private TableColumn m_personCol;
- private TableColumn m_statusCol;
- private TableColumn m_editCol;
- //private TableColumn m_delCol;
- private RequestLocal m_size;
- private RequestLocal m_editor;
-
- protected final static String EDIT_EVENT = "Edit";
- protected final static String DELETE_EVENT = "Delete";
-
- public MembershipTable(ItemSelectionModel itemModel, MembershipSelectionModel membershipModel) {
- super();
- this.m_itemModel = itemModel;
- this.m_membershipModel = membershipModel;
- addColumns();
-
- m_size = new RequestLocal();
- m_editor = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState state) {
- SecurityManager sm = Utilities.getSecurityManager(state);
- ContentItem item = m_itemModel.getSelectedItem(state);
- Boolean val = new Boolean(sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, item));
- return val;
- }
- };
-
- Label empty = new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.nomembers"));
- setEmptyView(empty);
- addTableActionListener(new MembershipTableActionListener());
- setRowSelectionModel(m_membershipModel);
- setDefaultCellRenderer(new MembershipTableRenderer());
- setModelBuilder(new MembershipTableModelBuilder(itemModel));
- }
-
- public void addColumns() {
- TableColumnModel model = getColumnModel();
- int i = 0;
- this.m_personCol = new TableColumn(i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.person"));
- this.m_statusCol = new TableColumn(++i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.status"));
- this.m_editCol = new TableColumn(++i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.edit"));
-
- model.add(this.m_personCol);
- model.add(this.m_statusCol);
- model.add(this.m_editCol);
- setColumnModel(model);
- }
-
- private class MembershipTableRenderer implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- Membership membership = (Membership) value;
- if (m_size.get(state) == null) {
- m_size.set(state, new Long(((MembershipTableModelBuilder.MembershipTableModel) table.getTableModel(state)).size()));
- }
-
- String url = membership.getURI(state);
- if (column == m_personCol.getModelIndex()) {
- GenericPerson person = membership.getTargetItem();
- StringBuilder fullNameBuilder = new StringBuilder();
-
- if(person.getTitlePre() != null) {
- fullNameBuilder.append(person.getTitlePre());
- fullNameBuilder.append(" ");
- }
- if(person.getGivenName() != null) {
- fullNameBuilder.append(person.getGivenName());
- fullNameBuilder.append(" ");
- }
- if(person.getSurname() != null) {
- fullNameBuilder.append(person.getSurname());
- fullNameBuilder.append(" ");
- }
- if(person.getTitlePost() != null) {
- fullNameBuilder.append(person.getTitlePost());
- }
-
- //String fullName = String.format("%s %s %s, %s", person.getTitlePre(), person.getGivenName(), person.getSurname(), person.getTitlePost());
- String fullName = fullNameBuilder.toString();
- ExternalLink extLink = new ExternalLink(fullName, url);
- return extLink;
- } else if(column == m_statusCol.getModelIndex()) {
- MembershipStatus status = membership.getStatus();
- return new Label(status.getStatusName());
- } else if(column == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- if (isSelected) {
- return new Label(EDIT_EVENT, Label.BOLD);
- } else {
- return new ControlLink(EDIT_EVENT);
- }
- } else {
- return new Label(EDIT_EVENT);
- }
- } else {
- throw new UncheckedWrapperException("column out of bounds");
- }
- }
- }
-
- private class MembershipTableActionListener implements TableActionListener {
-
- private Membership getMembership(TableActionEvent event) {
- Object obj = event.getRowKey();
- BigDecimal id;
- if (obj instanceof String) {
- id = new BigDecimal((String) obj);
- } else {
- id = (BigDecimal) obj;
- }
-
- Assert.exists(id);
- Membership membership;
- try {
- membership = (Membership) DomainObjectFactory.newInstance(new OID(Membership.BASE_DATA_OBJECT_TYPE, id));
- } catch (DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException(ex);
- }
- return membership;
- }
-
- public void cellSelected(TableActionEvent e) {
- int col = e.getColumn().intValue();
- PageState state = e.getPageState();
- Membership membership = getMembership(e);
- Assert.exists(membership);
-
- if (col == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- m_membershipModel.setSelectedObject(state, membership);
- }
- }
- }
-
- public void headSelected(TableActionEvent e) {
- }
-
- }
-
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTableModelBuilder.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTableModelBuilder.java
deleted file mode 100644
index dad3a3437..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTableModelBuilder.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Membership;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class MembershipTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- private final static Logger logger = Logger.getLogger(MembershipTableModelBuilder.class);
-
- private ItemSelectionModel m_itemModel;
-
- public MembershipTableModelBuilder(ItemSelectionModel itemModel) {
- this.m_itemModel = itemModel;
- }
-
- public TableModel makeModel(Table t, PageState s) {
- DataCollection members = getMembers(s);
-
- if(members.isEmpty()) {
- return Table.EMPTY_MODEL;
- } else {
- return new MembershipTableModel(members);
- }
- }
-
- public DataCollection getMembers(PageState state) {
- Assert.isTrue(this.m_itemModel.isSelected(state), "item selected");
- OrganizationalUnit unit = (OrganizationalUnit) this.m_itemModel.getSelectedItem(state);
- return Membership.getMemberships(unit);
- //return unit.getMemberships();
- }
-
- public static class MembershipTableModel implements TableModel {
-
- Membership m_membership;
- DataCollection m_memberships;
-
- public MembershipTableModel(DataCollection memberships) {
- m_memberships = memberships;
- m_membership = null;
- }
-
- public int getColumnCount() {
- return (int) m_memberships.size();
- }
-
- public boolean nextRow() {
- if (m_memberships.next()) {
- DataObject obj = m_memberships.getDataObject();
- m_membership = (Membership) DomainObjectFactory.newInstance(obj);
- //m_membership = (Membership) m_memberships.getDataObject();
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- return m_membership;
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_membership.getID();
- }
-
- public long size() {
- return m_memberships.size();
- }
-
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitPropertiesStep.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitPropertiesStep.java
deleted file mode 100644
index 556e305fc..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitPropertiesStep.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.cms.contenttypes.ui.*;
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrgaUnit2OrgaUnitPropertiesStep extends ResettableContainer {
-
- private AuthoringKitWizard m_parent;
- private ItemSelectionModel m_itemModel;
- private BigDecimalParameter m_ou2ouParam = new BigDecimalParameter("orgaunit2orgaunit");
- private OrgaUnit2OrgaUnitSelectionModel m_ou2ouModel = new OrgaUnit2OrgaUnitSelectionModel(m_ou2ouParam);
-
- public OrgaUnit2OrgaUnitPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- this.m_itemModel = itemModel;
- this.m_parent = parent;
- setOrgaUnit2OrgaUnitSelectionModel();
- add(getDisplayComponent());
-
- Form form = new Form("orgaUnit2OrgaUnitEditForm");
- form.add(getEditSheet());
-
- WorkflowLockedContainer edit = new WorkflowLockedContainer(itemModel);
- edit.add(form);
- add(edit);
- }
-
- protected void setOrgaUnit2OrgaUnitSelectionModel() {
- setOrgaUnit2OrgaUnitSelectionModel(new OrgaUnit2OrgaUnitSelectionModel(this.m_ou2ouParam));
- }
-
- protected void setOrgaUnit2OrgaUnitSelectionModel(OrgaUnit2OrgaUnitSelectionModel model) {
- this.m_ou2ouModel = model;
- }
-
- protected OrgaUnit2OrgaUnitSelectionModel getOrgaUnit2OrgaUnitSelectionModel() {
- return this.m_ou2ouModel;
- }
-
- protected BigDecimalParameter getOU2OUParam() {
- return this.m_ou2ouParam;
- }
-
- public Component getDisplayComponent() {
- SimpleContainer container = new SimpleContainer();
- container.add(new OrgaUnit2OrgaUnitTable(this.m_itemModel, this.m_ou2ouModel));
- return container;
- }
-
- public FormSection getEditSheet() {
- return new OrgaUnit2OrgaUnitPropertyForm(this.m_itemModel, this.m_ou2ouModel);
- }
-
- @Override
- public void register(Page page) {
- super.register(page);
- page.addComponentStateParam(this, m_ou2ouParam);
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitPropertyForm.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitPropertyForm.java
deleted file mode 100644
index f605a25f9..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitPropertyForm.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.form.Submit;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.OrgaUnit2OrgaUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrgaUnit2OrgaUnitPropertyForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener {
-
- private final static Logger logger = Logger.getLogger(OrgaUnit2OrgaUnitPropertyForm.class);
- public final static String ID = "orgaUnit2OrgaUnit_edit";
- private ItemSelectionModel m_itemModel;
- private OrgaUnit2OrgaUnitSelectionModel m_ou2ouModel;
- private ItemSearchWidget m_itemSearch;
- private SaveCancelSection m_saveCancelSection;
- private final String ITEM_SEARCH = "orgaUnit2OrgaUnit";
-
- public OrgaUnit2OrgaUnitPropertyForm(ItemSelectionModel itemModel, OrgaUnit2OrgaUnitSelectionModel ou2ouModel) {
- super(new ColumnPanel(2));
- this.m_itemModel = itemModel;
- this.m_ou2ouModel = ou2ouModel;
-
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(this);
- addValidationListener(this);
- addProcessListener(this);
- addSubmissionListener(this);
- }
-
- protected void addWidgets() {
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit")));
- this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.OrganizationalUnit"));
- add(this.m_itemSearch);
- }
-
- protected void addSaveCancelSection() {
- this.m_saveCancelSection = new SaveCancelSection();
- try {
- this.m_saveCancelSection.getCancelButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_ou2ouModel.isSelected(e.getPageState())) {
- target.setButtonLabel(GlobalizationUtil.globalize("cancel"));
- } else {
- target.setButtonLabel(GlobalizationUtil.globalize("reset"));
- }
- }
- });
-
- this.m_saveCancelSection.getSaveButton().addPrintListener(new PrintListener() {
-
- public void prepare(PrintEvent e) {
- Submit target = (Submit) e.getTarget();
- if (m_ou2ouModel.isSelected(e.getPageState())) {
- target.setButtonLabel(GlobalizationUtil.globalize("save"));
- } else {
- target.setButtonLabel(GlobalizationUtil.globalize("create"));
- }
- }
- });
- } catch (Exception ex) {
- throw new UncheckedWrapperException("this cannot happen", ex);
- }
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH);
- }
-
- /**
- * Returns the SavaCancelSection of the form.
- *
- * @return The SavaCancelSection of the form.
- */
- public SaveCancelSection getSaveCancelSection() {
- return this.m_saveCancelSection;
- }
-
- protected OrgaUnit2OrgaUnitSelectionModel getOU2OUSelectionModel() {
- return this.m_ou2ouModel;
- }
-
- protected OrganizationalUnit getOrganizationalUnit(PageState state) {
- return (OrganizationalUnit) this.m_itemModel.getSelectedItem(state);
- }
-
- protected OrgaUnit2OrgaUnit createOrgaUnit2OrgaUnit(PageState state) {
- OrganizationalUnit ou = this.getOrganizationalUnit(state);
- Assert.exists(ou);
- OrgaUnit2OrgaUnit ou2ou = new OrgaUnit2OrgaUnit();
- ou2ou.setUnitOwner(ou);
- return ou2ou;
- }
-
- protected void setOrgaUnit2OrgaUnitProperties(OrgaUnit2OrgaUnit ou2ou, FormSectionEvent event) {
- FormData data = event.getFormData();
-
- ou2ou.setTargetItem((OrganizationalUnit) data.get(ITEM_SEARCH));
-
- ou2ou.save();
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- FormData data = e.getFormData();
- PageState state = e.getPageState();
-
- setVisible(state, true);
-
- OrgaUnit2OrgaUnit ou2ou;
- if (this.m_ou2ouModel.isSelected(state)) {
- ou2ou = this.m_ou2ouModel.getSelectedOU2OU(state);
- try {
- data.put(ITEM_SEARCH, ou2ou.getTargetItem());
- } catch(IllegalStateException ex) {
- throw ex;
- }
- } else {
- data.put(ITEM_SEARCH, null);
- }
- }
-
- public void process(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
- OrgaUnit2OrgaUnit ou2ou;
-
- if (this.m_saveCancelSection.getCancelButton().isSelected(state)) {
- this.m_ou2ouModel.clearSelection(state);
- } else {
- if (this.m_ou2ouModel.isSelected(state)) {
- ou2ou = m_ou2ouModel.getSelectedOU2OU(state);
- } else {
- ou2ou = createOrgaUnit2OrgaUnit(state);
- }
- setOrgaUnit2OrgaUnitProperties(ou2ou, e);
- }
-
- this.m_ou2ouModel.clearSelection(state);
- this.init(e);
- }
-
- public void validate(FormSectionEvent e) throws FormProcessException {
- if (e.getFormData().get(ITEM_SEARCH) == null) {
- throw new FormProcessException("OrganizationalUnit selection is requiered");
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- if (this.m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) {
- this.m_ou2ouModel.clearSelection(e.getPageState());
- this.init(e);
- throw new FormProcessException("cancelled");
- }
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitSelectionModel.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitSelectionModel.java
deleted file mode 100644
index 566ee0d3d..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitSelectionModel.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.cms.contenttypes.OrgaUnit2OrgaUnit;
-import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrgaUnit2OrgaUnitSelectionModel extends ACSObjectSelectionModel {
-
- public OrgaUnit2OrgaUnitSelectionModel(BigDecimalParameter param) {
- super(OrgaUnit2OrgaUnit.class.getName(), OrgaUnit2OrgaUnit.BASE_DATA_OBJECT_TYPE, param);
- }
-
- public OrgaUnit2OrgaUnitSelectionModel(String itemClass, String objectType, BigDecimalParameter param) {
- super(itemClass, objectType, param);
- }
-
- public OrgaUnit2OrgaUnit getSelectedOU2OU(PageState state) {
- return (OrgaUnit2OrgaUnit) getSelectedObject(state);
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitTable.java
deleted file mode 100644
index 5ea425027..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitTable.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.ExternalLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.OrgaUnit2OrgaUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrgaUnit2OrgaUnitTable extends Table {
-
- private final static Logger logger = Logger.getLogger(OrgaUnit2OrgaUnitTable.class);
- private OrgaUnit2OrgaUnitSelectionModel m_ou2ouModel;
- private ItemSelectionModel m_itemModel;
- private TableColumn m_orgaUnitCol;
- private TableColumn m_moveUpCol;
- private TableColumn m_moveDownCol;
- private TableColumn m_editCol;
- private TableColumn m_delCol;
- private RequestLocal m_size;
- private RequestLocal m_editor;
- /**
- * ID String for the "edit" event.
- */
- protected final static String EDIT_EVENT = "Edit";
- /**
- * ID for the "delete" event.
- */
- protected final static String DELETE_EVENT = "Delete";
- /**
- * ID fpr the "up" event.
- */
- protected final static String UP_EVENT = "up";
- /**
- * ID for the "down" event.
- */
- protected final static String DOWN_EVENT = "down";
-
- public OrgaUnit2OrgaUnitTable(ItemSelectionModel itemModel, OrgaUnit2OrgaUnitSelectionModel ou2ouModel) {
- super();
- this.m_itemModel = itemModel;
- this.m_ou2ouModel = ou2ouModel;
- addColumns();
-
- this.m_size = new RequestLocal();
- this.m_editor = new RequestLocal() {
-
- @Override
- public Object initialValue(PageState state) {
- SecurityManager sm = Utilities.getSecurityManager(state);
- ContentItem item = m_itemModel.getSelectedItem(state);
- Boolean val = new Boolean(sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, item));
- return val;
- }
- };
-
- Label empty = new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.noOrgaUnitsAssociatedWithThisOrgaUnit"));
- setEmptyView(empty);
- addTableActionListener(new OrgaUnit2OrgaUnitTableActionListener());
- setRowSelectionModel(this.m_ou2ouModel);
- setDefaultCellRenderer(new OrgaUnit2OrgaUnitTableRenderer());
- setModelBuilder(new OrgaUnit2OrgaUnitTableModelBuilder(itemModel));
- }
-
- public void addColumns() {
- TableColumnModel model = getColumnModel();
- int i = 0;
- this.m_orgaUnitCol = new TableColumn(i, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit"));
- this.m_editCol = new TableColumn(++i, "cms.contenttypes.ui.organizationalunit.edit");
- this.m_delCol = new TableColumn(++i, "cms.contenttypes.ui.organizationalunit.edit.delete");
- this.m_moveUpCol = new TableColumn(++i, "");
- this.m_moveDownCol = new TableColumn(++i, "");
-
- model.add(this.m_orgaUnitCol);
- model.add(this.m_editCol);
- model.add(this.m_delCol);
- model.add(this.m_moveUpCol);
- model.add(this.m_moveDownCol);
- setColumnModel(model);
- }
-
- private class OrgaUnit2OrgaUnitTableRenderer implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- OrgaUnit2OrgaUnit ou2ou = (OrgaUnit2OrgaUnit) value;
- boolean isFirst = (row == 0);
- if (m_size.get(state) == null) {
- m_size.set(state, new Long(((OrgaUnit2OrgaUnitTableModelBuilder.OrgaUnit2OrgaUnitTableModel) table.getTableModel(state)).size()));
- }
- boolean isLast = (row == ((Long) m_size.get(state)).intValue() - 1);
-
- String url = ou2ou.getURI(state);
- if (column == m_orgaUnitCol.getModelIndex()) {
- ExternalLink extLink = new ExternalLink(ou2ou.getTargetItem().getOrganizationalUnitName(), url);
- return extLink;
- } else if (column == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- if (isSelected) {
- return new Label(EDIT_EVENT, Label.BOLD);
- } else {
- return new ControlLink(EDIT_EVENT);
- }
- } else {
- return new Label(EDIT_EVENT);
- }
- } else if (column == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- return new ControlLink(DELETE_EVENT);
- } else {
- return new Label(DELETE_EVENT);
- }
- } else if (column == m_moveUpCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) {
- Label downLabel = new Label(UP_EVENT);
- downLabel.setClassAttr("linkSort");
- return new ControlLink(downLabel);
- } else {
- return new Label("");
- }
- } else if (column == m_moveDownCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) {
- Label downLabel = new Label(DOWN_EVENT);
- downLabel.setClassAttr("linkSort");
- return new ControlLink(downLabel);
- } else {
- return new Label("");
- }
- } else {
- throw new UncheckedWrapperException("column out of bounds");
- }
- }
- }
-
- private class OrgaUnit2OrgaUnitTableActionListener implements TableActionListener {
-
- private OrgaUnit2OrgaUnit getOrgaUnit2OrgaUnit(TableActionEvent event) {
- Object o = event.getRowKey();
- BigDecimal id;
- if (o instanceof String) {
- id = new BigDecimal((String) o);
- } else {
- id = (BigDecimal) event.getRowKey();
- }
-
- Assert.exists(id);
- OrgaUnit2OrgaUnit ou2ou;
- try {
- ou2ou = (OrgaUnit2OrgaUnit) DomainObjectFactory.newInstance(new OID(OrgaUnit2OrgaUnit.BASE_DATA_OBJECT_TYPE, id));
- } catch (Exception ex) {
- throw new UncheckedWrapperException(ex);
- }
- return ou2ou;
- }
-
- public void cellSelected(TableActionEvent e) {
- int col = e.getColumn().intValue();
- PageState state = e.getPageState();
- OrgaUnit2OrgaUnit ou2ou = getOrgaUnit2OrgaUnit(e);
- Assert.exists(ou2ou);
-
- if (col == m_editCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- m_ou2ouModel.setSelectedObject(state, ou2ou);
- }
- } else if (col == m_delCol.getModelIndex()) {
- if (Boolean.TRUE.equals(m_editor.get(state))) {
- try {
- m_ou2ouModel.clearSelection(state);
- ou2ou.delete();
- } catch (Exception ex) {
- throw new UncheckedWrapperException(ex);
- }
- }
- } else if (col == m_moveUpCol.getModelIndex()) {
- m_ou2ouModel.clearSelection(state);
- ou2ou.swapWithPrevious();
- } else if (col == m_moveDownCol.getModelIndex()) {
- m_ou2ouModel.clearSelection(state);
- ou2ou.swapWithNext();
- }
- }
-
- public void headSelected(TableActionEvent e) {
- }
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitTableModelBuilder.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitTableModelBuilder.java
deleted file mode 100644
index 6c07fa78d..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrgaUnit2OrgaUnitTableModelBuilder.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.OrgaUnit2OrgaUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrgaUnit2OrgaUnitTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- private final static Logger logger = Logger.getLogger(OrgaUnit2OrgaUnitTableModelBuilder.class);
-
- private ItemSelectionModel m_itemModel;
-
- public OrgaUnit2OrgaUnitTableModelBuilder(ItemSelectionModel itemModel) {
- this.m_itemModel = itemModel;
- }
-
- public TableModel makeModel(Table t, PageState s) {
- DataCollection units = getUnits(s);
-
- if(units.isEmpty()) {
- return Table.EMPTY_MODEL;
- } else {
- return new OrgaUnit2OrgaUnitTableModel(units);
- }
- }
-
- public DataCollection getUnits(PageState state) {
- Assert.isTrue(this.m_itemModel.isSelected(state), "item selected");
- OrganizationalUnit unit = (OrganizationalUnit) this.m_itemModel.getSelectedItem(state);
- return OrgaUnit2OrgaUnit.getUnits(unit);
- }
-
- public static class OrgaUnit2OrgaUnitTableModel implements TableModel {
-
- OrgaUnit2OrgaUnit m_ou2ou;
- DataCollection m_units;
-
- public OrgaUnit2OrgaUnitTableModel(DataCollection units) {
- this.m_units = units;
- this.m_ou2ou = null;
- }
-
- public int getColumnCount() {
- return (int) this.m_units.size();
- }
-
- public boolean nextRow() {
- if (this.m_units.next()) {
- DataObject obj = this.m_units.getDataObject();
- this.m_ou2ou = (OrgaUnit2OrgaUnit) DomainObjectFactory.newInstance(obj);
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- return this.m_ou2ou;
- }
-
- public Object getKeyAt(int columnIndex) {
- return this.m_ou2ou.getID();
- }
-
- public long size() {
- return this.m_units.size();
- }
-
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorStep.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorStep.java
deleted file mode 100644
index 93295872b..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorStep.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.authoring.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitChooseAssistentDirectorStep extends SimpleEditStep {
-
- private static String EDIT_SHEET_NAME = "edit";
-
- public OrganizationalUnitChooseAssistentDirectorStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- super(itemModel, parent);
-
- OrganizationalUnitChooseAssistentDirectorTable table = new OrganizationalUnitChooseAssistentDirectorTable(itemModel, this);
-
- addComponent(EDIT_SHEET_NAME, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.selectAssistentDirector").localize().toString(), new WorkflowLockedComponentAccess(table, itemModel));
-
- setDisplayComponent(getOrganizationalUnitPropertiesSheet(itemModel));
- }
-
- private Component getOrganizationalUnitPropertiesSheet(ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
-
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.assistentdirector_title_pre"), "assistentDirection.titlepre");
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.assistentdirector_givenname"), "assistentDirection.givenname");
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.assistentdirector_surname"), "assistentDirection.surname");
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.assistentdirector_title_post"), "assistentDirection.titlepost");
-
- return sheet;
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java
deleted file mode 100644
index af06237bf..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2009 Jens Pelzetter, for the Center for Social Policy Research of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- * Table used to select the assistent director of
- * an organizational unit.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitChooseAssistentDirectorTable extends Table implements TableActionListener {
-
- private static final String COL_PERSON = "Person";
- private static final String COL_CHOOSE_PERSON = "Select";
- private ItemSelectionModel m_selOrgaUnit;
- private OrganizationalUnitChooseAssistentDirectorStep m_parent;
-
- public OrganizationalUnitChooseAssistentDirectorTable(ItemSelectionModel selOrgaUnit, OrganizationalUnitChooseAssistentDirectorStep parent) {
-
- super();
-
- this.m_parent = parent;
- this.m_selOrgaUnit = selOrgaUnit;
-
- TableColumnModel model = getColumnModel();
- model.add(new TableColumn(0, COL_PERSON));
- model.add(new TableColumn(1, COL_CHOOSE_PERSON));
-
- setEmptyView(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.assistentdirector.noPersonsAvailable")));
- setModelBuilder(new OrganizationalUnitChooseAssistentDirectorTableModelBuilder());
-
- model.get(1).setCellRenderer(new SelectCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class OrganizationalUnitChooseAssistentDirectorTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- public TableModel makeModel(Table t, PageState s) {
- t.getRowSelectionModel().clearSelection(s);
- DataCollection m_persons = SessionManager.getSession().retrieve(GenericPerson.BASE_DATA_OBJECT_TYPE);
- m_persons.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT);
- return new OrganizationalUnitChooseAssistentDirectorTableModel(t, m_persons);
- }
- }
-
- private class OrganizationalUnitChooseAssistentDirectorTableModel implements TableModel {
-
- private Table m_table;
- private DataCollection m_persons;
- private GenericPerson m_person;
-
- private OrganizationalUnitChooseAssistentDirectorTableModel(Table t, DataCollection persons) {
- m_table = t;
- m_persons = persons;
- }
-
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- if (m_persons.next()) {
- m_person = (GenericPerson) DomainObjectFactory.newInstance(m_persons.getDataObject());
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- StringBuilder personNameBuilder = new StringBuilder();
- if ((m_person.getTitlePre() != null) &&
- m_person.getTitlePre().length() > 0) {
- personNameBuilder.append(m_person.getTitlePre());
- personNameBuilder.append(" ");
- }
- if ((m_person.getGivenName() != null) &&
- m_person.getGivenName().length() > 0) {
- personNameBuilder.append(m_person.getGivenName());
- personNameBuilder.append(" ");
- }
- if ((m_person.getSurname() != null) &&
- m_person.getSurname().length() > 0) {
- personNameBuilder.append(m_person.getSurname());
- personNameBuilder.append(" ");
- }
- if ((m_person.getTitlePost() != null) &&
- m_person.getTitlePost().length() > 0) {
- personNameBuilder.append(m_person.getTitlePost());
- }
- return personNameBuilder.toString();
- case 1:
- return COL_CHOOSE_PERSON;
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_person.getID();
- }
- }
-
- private class SelectCellRenderer extends LockableImpl implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.assistentdirector.selectThisPerson").localize().toString());
- return link;
- }
-
- }
-
- public void cellSelected(TableActionEvent e) {
- PageState state = e.getPageState();
- TableColumn col = getColumnModel().get(e.getColumn().intValue());
- String colName = (String) col.getHeaderValue();
-
- if (COL_CHOOSE_PERSON.equals(colName)) {
- m_parent.showDisplayPane(state);
- BigDecimal personID = new BigDecimal (e.getRowKey().toString());
- OrganizationalUnit orgaunit = (OrganizationalUnit) this.m_selOrgaUnit.getSelectedObject(state);
- GenericPerson person = (GenericPerson) DomainObjectFactory.newInstance(new OID(GenericPerson.BASE_DATA_OBJECT_TYPE, personID));
- orgaunit.setAssistentDirection(person);
- }
- }
-
- public void headSelected(TableActionEvent e) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorStep.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorStep.java
deleted file mode 100644
index 79e6492a8..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorStep.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitChooseDirectorStep extends SimpleEditStep {
-
- private static String EDIT_SHEET_NAME = "edit";
-
- public OrganizationalUnitChooseDirectorStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- super(itemModel, parent);
-
- OrganizationalUnitChooseDirectorTable table = new OrganizationalUnitChooseDirectorTable(itemModel, this);
-
- addComponent(EDIT_SHEET_NAME, OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.selectDirector").localize().toString(), new WorkflowLockedComponentAccess(table, itemModel));
-
- setDisplayComponent(getOrganizationalUnitPropertiesSheet(itemModel));
- }
-
- private Component getOrganizationalUnitPropertiesSheet(ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
-
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.director_title_pre"), "assistentDirection.titlepre");
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.director_givenname"), "assistentDirection.givenname");
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.director_surname"), "assistentDirection.surname");
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.director_title_post"), "assistentDirection.titlepost");
-
- return sheet;
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java
deleted file mode 100644
index 9d91b588d..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2009 Jens Pelzetter, for the Center for Social Policy Research of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Table used to select the Director of
- * an organizational unit.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitChooseDirectorTable extends Table implements TableActionListener {
-
- private final static Logger logger = Logger.getLogger(OrganizationalUnitChooseDirectorTable.class);
- private static final String COL_PERSON = "Person";
- private static final String COL_CHOOSE_PERSON = "Select";
- private ItemSelectionModel m_selOrgaUnit;
- private OrganizationalUnitChooseDirectorStep m_parent;
-
- public OrganizationalUnitChooseDirectorTable(ItemSelectionModel selOrgaUnit, OrganizationalUnitChooseDirectorStep parent) {
-
- super();
-
- this.m_parent = parent;
- this.m_selOrgaUnit = selOrgaUnit;
-
- TableColumnModel model = getColumnModel();
- model.add(new TableColumn(0, COL_PERSON));
- model.add(new TableColumn(1, COL_CHOOSE_PERSON));
-
- setEmptyView(new Label("New Persons available."));
- setModelBuilder(new OrganizationalUnitChooseDirectorTableModelBuilder());
-
- model.get(1).setCellRenderer(new SelectCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class OrganizationalUnitChooseDirectorTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- public TableModel makeModel(Table t, PageState s) {
- t.getRowSelectionModel().clearSelection(s);
- DataCollection m_persons = SessionManager.getSession().retrieve(GenericPerson.BASE_DATA_OBJECT_TYPE);
- m_persons.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT);
- return new OrganizationalUnitChooseDirectorTableModel(t, m_persons);
- }
- }
-
- private class OrganizationalUnitChooseDirectorTableModel implements TableModel {
-
- private Table m_table;
- private DataCollection m_persons;
- private GenericPerson m_person;
-
- private OrganizationalUnitChooseDirectorTableModel(Table t, DataCollection persons) {
- m_table = t;
- m_persons = persons;
- }
-
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- if (m_persons.next()) {
- m_person = (GenericPerson) DomainObjectFactory.newInstance(m_persons.getDataObject());
- return true;
- } else {
- return false;
- }
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- StringBuilder personNameBuilder = new StringBuilder();
- if ((m_person.getTitlePre() != null) &&
- m_person.getTitlePre().length() > 0) {
- personNameBuilder.append(m_person.getTitlePre());
- personNameBuilder.append(" ");
- }
- if ((m_person.getGivenName() != null) &&
- m_person.getGivenName().length() > 0) {
- personNameBuilder.append(m_person.getGivenName());
- personNameBuilder.append(" ");
- }
- if ((m_person.getSurname() != null) &&
- m_person.getSurname().length() > 0) {
- personNameBuilder.append(m_person.getSurname());
- personNameBuilder.append(" ");
- }
- if ((m_person.getTitlePost() != null) &&
- m_person.getTitlePost().length() > 0) {
- personNameBuilder.append(m_person.getTitlePost());
- }
- return personNameBuilder.toString();
- case 1:
- return COL_CHOOSE_PERSON;
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_person.getID();
- }
- }
-
- private class SelectCellRenderer extends LockableImpl implements TableCellRenderer {
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation("Select this person?");
- return link;
- }
-
- }
-
- public void cellSelected(TableActionEvent e) {
- PageState state = e.getPageState();
- TableColumn col = getColumnModel().get(e.getColumn().intValue());
- String colName = (String) col.getHeaderValue();
-
- logger.debug("Cell selected invoked...");
-
- if (COL_CHOOSE_PERSON.equals(colName)) {
- logger.debug ("Col is choose person col...");
- m_parent.showDisplayPane(state);
- BigDecimal personID = new BigDecimal (e.getRowKey().toString());
- OrganizationalUnit orgaunit = (OrganizationalUnit) this.m_selOrgaUnit.getSelectedObject(state);
- GenericPerson person = (GenericPerson) DomainObjectFactory.newInstance(new OID(GenericPerson.BASE_DATA_OBJECT_TYPE, personID));
- orgaunit.setDirection(person);
- }
- }
-
- public void headSelected(TableActionEvent e) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitPropertiesStep.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitPropertiesStep.java
deleted file mode 100644
index c0b2f7434..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitPropertiesStep.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.util.GlobalizationUtil;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-import java.text.DateFormat;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitPropertiesStep extends SimpleEditStep {
-
- private final static Logger logger = Logger.getLogger(OrganizationalUnitPropertiesStep.class);
- public final static String EDIT_SHEET_NAME = "edit";
-
- public OrganizationalUnitPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- super(itemModel, parent);
-
- setDefaultEditKey(EDIT_SHEET_NAME);
- BasicPageForm editSheet;
-
- editSheet = new OrganizationalUnitPropertyForm(itemModel, this);
- add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(getOrganizationalUnitPropertySheet(itemModel));
- }
-
- public static Component getOrganizationalUnitPropertySheet(ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
-
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizatialunit.unitname"), OrganizationalUnit.ORGANIZATIONALUNIT_NAME);
- sheet.add(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizatialunit.unitdescription"), OrganizationalUnit.ORGANIZATIONALUNIT_DESCRIPTION);
-
- if (!ContentSection.getConfig().getHideLaunchDate()) {
- sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
-
- public String format(DomainObject obj, String attribute, PageState state) {
- ContentPage page = (ContentPage) obj;
- if (page.getLaunchDate() != null) {
- return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
- } else {
- return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize();
- }
- }
- });
- }
-
- return sheet;
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitPropertyForm.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitPropertyForm.java
deleted file mode 100644
index 5121e5b6a..000000000
--- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitPropertyForm.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.organizationalunit;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.util.GlobalizationUtil;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.OrganizationalUnit;
-import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class OrganizationalUnitPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
-
- private final static Logger logger = Logger.getLogger(OrganizationalUnitPropertyForm.class);
- private OrganizationalUnitPropertiesStep m_step;
- public final static String ORGANIZATIONALUNIT_NAME = OrganizationalUnit.ORGANIZATIONALUNIT_NAME;
- public final static String ORGANIZATIONALUNIT_DESCRIPTION = OrganizationalUnit.ORGANIZATIONALUNIT_DESCRIPTION;
- public final static String ID = "OrganizationalUnit_edit";
-
- public OrganizationalUnitPropertyForm(ItemSelectionModel itemModel) {
- this(itemModel, null);
- }
-
- public OrganizationalUnitPropertyForm(ItemSelectionModel itemModel, OrganizationalUnitPropertiesStep step) {
- super(ID, itemModel);
- this.m_step = step;
- addSubmissionListener(this);
- }
-
- @Override
- public void addWidgets() {
- super.addWidgets();
-
- add(new Label(OrganizationalUnitGlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.unitname")));
- ParameterModel orgaUnitNameParam = new StringParameter(ORGANIZATIONALUNIT_NAME);
- TextField orgaUnitName = new TextField(orgaUnitNameParam);
- orgaUnitName.addValidationListener(new NotNullValidationListener());
- add(orgaUnitName);
-
- add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.organizationalunit.description")));
- TextArea description = new TextArea(ORGANIZATIONALUNIT_DESCRIPTION);
- description.setRows(5);
- description.setCols(30);
- add(description);
- }
-
- @Override
- public void init(FormSectionEvent e) throws FormProcessException {
- FormData data = e.getFormData();
- OrganizationalUnit orgaUnit = (OrganizationalUnit) super.initBasicWidgets(e);
-
- data.put(ORGANIZATIONALUNIT_NAME, orgaUnit.getOrganizationalUnitName());
- data.put(ORGANIZATIONALUNIT_DESCRIPTION, orgaUnit.getOrganizationalUnitDescription());
- }
-
- @Override
- public void process(FormSectionEvent e) throws FormProcessException {
- FormData data = e.getFormData();
-
- OrganizationalUnit orgaUnit = (OrganizationalUnit) super.processBasicWidgets(e);
-
- if ((orgaUnit != null) && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
- orgaUnit.setOrganizationalUnitName((String) data.get(ORGANIZATIONALUNIT_NAME));
- orgaUnit.setOrganizationalUnitDescription((String) data.get(ORGANIZATIONALUNIT_DESCRIPTION));
-
- orgaUnit.save();
- }
-
- if (this.m_step != null) {
- this.m_step.maybeForwardToNextStep(e.getPageState());
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- if ((this.m_step != null) &&
- (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
- this.m_step.cancelStreamlinedCreation(e.getPageState());
- }
- }
-}
diff --git a/ccm-cms-types-organizationalunit/web/static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xsl b/ccm-cms-types-organizationalunit/web/static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xsl
deleted file mode 100644
index 2d80b2207..000000000
--- a/ccm-cms-types-organizationalunit/web/static/content-types/com/arsdigita/cms/contenttypes/OrganizationalUnit.xsl
+++ /dev/null
@@ -1,83 +0,0 @@
-
-]>
-
-
-
-
-
-