From c2e48682b30be86c1b576877b31247ac4f443074 Mon Sep 17 00:00:00 2001 From: jensp Date: Sat, 13 Jun 2009 08:44:16 +0000 Subject: [PATCH] =?UTF-8?q?JavaDoc=20f=C3=BCr=20GenericOrganization=20und?= =?UTF-8?q?=20OrganizationRole=20und=20zugehoeriges=20AuthoringKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@194 8810af33-2d31-482b-a856-94f89814c4df --- .../cms/contenttypes/GenericOrganization.java | 3 +- .../GenericOrganizationConfig.java | 2 - .../cms/contenttypes/OrganizationRole.java | 144 ++++++++++++++++++ .../ui/GenericOrganizationPropertiesStep.java | 19 +++ .../ui/GenericOrganizationPropertyForm.java | 15 ++ .../ui/OrganizationRolePropertiesStep.java | 32 ++++ .../ui/OrganizationRolePropertyForm.java | 63 +++++++- .../ui/OrganizationRoleSelectionModel.java | 18 +++ .../ui/OrganizationRoleTable.java | 24 ++- .../ui/OrganizationRoleTableModelBuilder.java | 23 ++- 10 files changed, 329 insertions(+), 14 deletions(-) diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java index 32d6f2983..b2a346f9e 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java @@ -35,10 +35,9 @@ import org.apache.log4j.Logger; * * It is also possible to add roles to the organization, e.g. CEO, mayor or others. * The following features are planned to implement in one of the next commits: - * - Ability to add persons (ccm-cms-types-person) to a role * - Adding OrganizationUnits * - * The current version of this contenttype is modeled on base on the MultipartArticle + * The current version of this contenttype is modeled on base of the MultipartArticle * contenttype. * * @author Jens Pelzetter diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java index 0c226ffd2..3c8f42d50 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationConfig.java @@ -20,8 +20,6 @@ package com.arsdigita.cms.contenttypes; import com.arsdigita.runtime.AbstractConfig; -import com.arsdigita.util.parameter.Parameter; -import com.arsdigita.util.parameter.BooleanParameter; /** * Configuration for GenericOrganization. Not used yet. diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java index df01eb37f..6fe84978a 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java @@ -20,46 +20,101 @@ import java.math.BigDecimal; import org.apache.log4j.Logger; /** + * This class represents an role in a organization. Examples for roles + * are CEO, chairmen, mayor, speaker etc. * * @author Jens Pelzetter */ public class OrganizationRole extends ACSObject { private static final Logger logger = Logger.getLogger(OrganizationRole.class); + /** + * PDL identifier of the name property of the role + */ public static final String ROLENAME = "roleName"; + /** + * PDL identifier for the targetItem - the person assoicated with the role. + */ public static final String TARGETITEM = "targetItem"; + /** + * PDL for identifier for the organization associated with this role. + */ public static final String ROLEOWNER = "roleOwner"; + /** + * PDL id for the property for ordering the roles of an organization. + */ public static final String ORDER = "roleOrder"; + /** + * Type of this object. + */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole"; + /** + * Empty construtor creating a new role + */ public OrganizationRole() { this(BASE_DATA_OBJECT_TYPE); } + /** + * Tries to get the role with @id from the database. + * + * @param id + * @throws com.arsdigita.domain.DataObjectNotFoundException + */ public OrganizationRole(BigDecimal id) throws DataObjectNotFoundException { this(new OID(BASE_DATA_OBJECT_TYPE, id)); } + /** + * Tries to get the role with @id from the database. + * + * @param id + * @throws com.arsdigita.domain.DataObjectNotFoundException + */ public OrganizationRole(OID id) throws DataObjectNotFoundException { super(id); } + /** + * Tries to find obj in the database. + * + * @param obj + */ public OrganizationRole(DataObject obj) { super(obj); } + /** + * Creates a new role. + * + * @param type + */ public OrganizationRole(String type) { super(type); } + /** + * + * @return The name of the role. + */ public String getRolename() { return (String) get(ROLENAME); } + /** + * Sets the name of the role + * + * @param rolename + */ public void setRolename(String rolename) { set(ROLENAME, rolename); } + /** + * + * @return The owning organization. + */ public GenericOrganization getRoleOwner() { DataObject obj = (DataObject) get(ROLEOWNER); if (obj == null) { @@ -69,30 +124,58 @@ public class OrganizationRole extends ACSObject { } } + /** + * Sets the owing organization. + * + * @param orga + */ public void setRoleOwner(GenericOrganization orga) { Assert.exists(orga, GenericOrganization.class); logger.debug(String.format("Setting role owner to %s", orga.getOrganizationName())); setAssociation(ROLEOWNER, orga); } + /** + * + * @return The person associated with the role. + */ public Person getTargetItem() { DataObject object = (DataObject) get(TARGETITEM); return (Person) DomainObjectFactory.newInstance(object); } + /** + * Sets the person associated with the role + * + * @param item + */ public void setTargetItem(Person item) { setAssociation(TARGETITEM, item); } + /** + * + * @return The order of the role. + */ public Integer getOrder() { return (Integer) get(ORDER); } + /** + * Sets the order of the role + * + * @param order + */ public void setOrder(Integer order) { Assert.exists(order); set(ORDER, order); } + /* + * + * @param s Current PageState + * @return The URI of the target item. + */ public String getURI(PageState s) { Person item = getTargetItem(); @@ -108,6 +191,11 @@ public class OrganizationRole extends ACSObject { return URL.there(s.getRequest(), url).toString(); } + /** + * + * @param person + * @return All roles a person is associated with. + */ public static DataCollection getReferingRoles(Person person) { Session session = SessionManager.getSession(); DataCollection roles = session.retrieve(BASE_DATA_OBJECT_TYPE); @@ -117,6 +205,11 @@ public class OrganizationRole extends ACSObject { return roles; } + /** + * + * @param orga + * @return all roles an organization is associated with. + */ public static DataCollection getRoles(GenericOrganization orga) { logger.debug("Getting roles for an organization..."); Session session = SessionManager.getSession(); @@ -126,34 +219,75 @@ public class OrganizationRole extends ACSObject { return roles; } + /** + * Swaps an role with the next in the order. + * + * @throws java.lang.UnsupportedOperationException + */ public void swapWithNext() throws UnsupportedOperationException { swapWithNext("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrganizationRoleWithNextInGroup"); } + /** + * Swaps a role with the previous in the order. + * + * @throws java.lang.UnsupportedOperationException + */ public void swapWithPrevious() throws UnsupportedOperationException { swapWithNext("com.arsdigita.cms.contenttypes.allRoleOrderForOrganization", "com.arsdigita.cms.contenttypes.swapOrganizationRoleWithNextInGroup"); } + /** + * Swaps an role with the next in the order. + * + * @param queryName + * @param operationName + */ public void swapWithNext(String queryName, String operationName) { swapKeys(true, queryName, operationName); } + /** + * Swaps a role with the previous in the order. + * + * @param queryName + * @param operationName + */ public void swapWithPrevious(String queryName, String operationName) { swapKeys(false, queryName, operationName); } + /** + * Returns the query for swaping roles definied in the PDL. + * + * @param queryName + * @return + */ protected DataQuery getSwapQuery(String queryName) { DataQuery query = SessionManager.getSession().retrieveQuery(queryName); query.setParameter("ownerID", getRoleOwner().getID()); return query; } + /** + * Gets the PDL operation for swaping. + * + * @param operationName + * @return + */ protected DataOperation getSwapOperation(String operationName) { DataOperation operation = SessionManager.getSession().retrieveDataOperation(operationName); operation.setParameter("ownerID", getRoleOwner().getID()); return operation; } + /** + * Swaps the keys of two roles. + * + * @param swapNext + * @param queryName + * @param operationName + */ protected void swapKeys(boolean swapNext, String queryName, String operationName) { String methodName = null; if (swapNext) { @@ -202,6 +336,9 @@ public class OrganizationRole extends ACSObject { operation.execute(); } + /** + * + */ protected void alphabetize() { Session session = SessionManager.getSession(); DataCollection roles = session.retrieve(BASE_DATA_OBJECT_TYPE); @@ -216,6 +353,10 @@ public class OrganizationRole extends ACSObject { } } + /** + * + * @return + */ public int maxOrder() { GenericOrganization roleOwner = getRoleOwner(); if (roleOwner == null) { @@ -236,6 +377,9 @@ public class OrganizationRole extends ACSObject { return returnOrder; } + /** + * Called before the object is saved to the database. + */ @Override public void beforeSave() { super.beforeSave(); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java index f9fff3b13..e3f0e6b29 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertiesStep.java @@ -18,6 +18,8 @@ import java.text.DateFormat; import org.apache.log4j.Logger; /** + * AuthoringStep for the basic properties of an organization (name, name addendum and + * a short description). * * @author Jens Pelzetter */ @@ -25,8 +27,18 @@ public class GenericOrganizationPropertiesStep extends SimpleEditStep { private static final Logger logger = Logger.getLogger(GenericOrganizationPropertiesStep.class); + /** + * Name of the this edit sheet (Don't know if this this really needed. + * It has the same value in almost all PropertiesStep classes) + */ public static final String EDIT_SHEET_NAME = "edit"; + /** + * Constructor for the PropertiesStep. + * + * @param itemModel + * @param parent + */ public GenericOrganizationPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { super(itemModel, parent); @@ -39,6 +51,13 @@ public class GenericOrganizationPropertiesStep extends SimpleEditStep { setDisplayComponent(getGenericOrganizationPropertySheet(itemModel)); } + /** + * Creates and returns the sheet for editing the basic properties + * of an organization. (@see GenericOrganizationPropertyForm). + * + * @param itemModel + * @return The sheet for editing the properties of the organization. + */ public static Component getGenericOrganizationPropertySheet(ItemSelectionModel itemModel) { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java index e12765e8d..7332a0e3b 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationPropertyForm.java @@ -20,6 +20,7 @@ import com.arsdigita.bebop.parameters.StringParameter; import org.apache.log4j.Logger; /** + * Form for editing the basic properties of an organization. * * @author Jens Pelzetter */ @@ -42,12 +43,26 @@ public class GenericOrganizationPropertyForm extends BasicPageForm implements Fo */ public static final String DESCRIPTION = GenericOrganization.DESCRIPTION; + /** + * ID of the form + */ public static final String ID = "GenericOrganization_edit"; + /** + * Constrctor taking an ItemSelectionModel + * + * @param itemModel + */ public GenericOrganizationPropertyForm(ItemSelectionModel itemModel) { this(itemModel, null); } + /** + * Constrctor taking an ItemSelectionModel and an instance of GenericOrganizationPropertiesStep. + * + * @param itemModel + * @param step + */ public GenericOrganizationPropertyForm(ItemSelectionModel itemModel, GenericOrganizationPropertiesStep step) { super(ID, itemModel); m_step = step; diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java index 0b3ffc586..ce96bfc78 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java @@ -11,6 +11,7 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer; /** + * Authoring step for adding roles (e.g. chairmen) to an organization. * * @author Jens Pelzetter */ @@ -22,6 +23,12 @@ public class OrganizationRolePropertiesStep extends ResettableContainer { private BigDecimalParameter m_roleParam = new BigDecimalParameter("organizationrole"); private OrganizationRoleSelectionModel m_roleModel = new OrganizationRoleSelectionModel(m_roleParam); + /** + * Constructor for creating an new instance of this authoring step. + * + * @param itemModel + * @param parent + */ public OrganizationRolePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { this.m_itemModel = itemModel; this.m_parent = parent; @@ -36,28 +43,53 @@ public class OrganizationRolePropertiesStep extends ResettableContainer { add(edit); } + /** + * Creates an new instance of OrganizationRoleSelectionModel and calls + * setOrganizationRole(OrganizationRoleSelectionModel model) with the new + * instance. + */ protected void setOrganizationRoleSelectionModel() { setOrganizationRoleSelectionModel(new OrganizationRoleSelectionModel(m_roleParam)); } + /** + * Sets the OrganizationRoleSelectionModel. + * + * @param model + */ protected void setOrganizationRoleSelectionModel(OrganizationRoleSelectionModel model) { m_roleModel = model; } + /** + * @return The OrganizationRoleSelectionModel instance of this authoring step. + */ protected OrganizationRoleSelectionModel getOrganizationRoleSelectionModel() { return m_roleModel; } + /** + * + * @return The value of the m_roleParam property. + */ protected BigDecimalParameter getRoleParam() { return this.m_roleParam; } + /** + * + * @return The component displaying the authoring step + */ public Component getDisplayComponent() { SimpleContainer container = new SimpleContainer(); container.add(new OrganizationRoleTable(m_itemModel, m_roleModel)); return container; } + /** + * + * @return The form for editing the roles of the organization + */ protected FormSection getEditSheet() { return new OrganizationRolePropertyForm(this.m_itemModel, this.m_roleModel); } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java index 67b643ae3..e85184ab8 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java @@ -29,12 +29,19 @@ import com.arsdigita.util.UncheckedWrapperException; import org.apache.log4j.Logger; /** + * Form for editing a role. * * @author Jens Pelzetter */ public class OrganizationRolePropertyForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener { + /** + * Logger for this class. + */ public final static Logger logger = Logger.getLogger(OrganizationRolePropertyForm.class); + /** + * ID of the form + */ public final static String ID = "organizationrole_edit"; //public final static String SSL_PROTOCOL = "https://"; //public final static String HTTP_PROTOCOL = "http://"; @@ -45,6 +52,12 @@ public class OrganizationRolePropertyForm extends FormSection implements FormIni private SaveCancelSection m_saveCancelSection; private final String ITEM_SEARCH = "organizationRole"; + /** + * Creates an new instance of the form. + * + * @param itemModel + * @param roleModel + */ public OrganizationRolePropertyForm(ItemSelectionModel itemModel, OrganizationRoleSelectionModel roleModel) { super(new ColumnPanel(2)); this.m_itemModel = itemModel; @@ -59,6 +72,10 @@ public class OrganizationRolePropertyForm extends FormSection implements FormIni addSubmissionListener(this); } + /** + * Adds the widgets to the form. For choosing the associated person, + * an ItemSearchWidget is used. + */ protected void addWidgets() { this.m_rolename = new TextField("rolename"); this.m_rolename.addValidationListener(new NotNullValidationListener()); @@ -66,12 +83,18 @@ public class OrganizationRolePropertyForm extends FormSection implements FormIni add(this.m_rolename); add(new Label("Person")); - //logger.error(String.format("Person.CONTENT_TYPE = %s", Person.CONTENT_TYPE)); - //logger.error(String.format("Article.CONTENT_TYPE = %s", Article.CONTENT_TYPE)); - this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.Person")); + /* Create the ItemSearchWidget. The ContentType.findByAssociatedObjecType + * gets the ContentType of com.arsdigita.cms.contenttypes.Person and passes + * it to the constructor of the ItemSearchWidget. The ItemSearchWidget will only + * display object of type Person or derivated types. + */ + this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.Person")); add(this.m_itemSearch); } + /** + * Adds the Save and Cancel buttons. + */ public void addSaveCancelSection() { this.m_saveCancelSection = new SaveCancelSection(); try { @@ -104,22 +127,40 @@ public class OrganizationRolePropertyForm extends FormSection implements FormIni add(m_saveCancelSection, ColumnPanel.FULL_WIDTH); } + /** + * + * @return The section with the Save and Cancel buttons. + */ public SaveCancelSection getSaveCancelSection() { return this.m_saveCancelSection; } + /** + * + * @return The RoleSelectionModel of the form. + */ protected OrganizationRoleSelectionModel getRoleSelectionModel() { return this.m_roleModel; } /*protected Person getPerson(PageState s) { - return (Person) m_itemModel.getSelectedObject(s); + return (Person) m_itemModel.getSelectedObject(s); }*/ - + /** + * + * @param s + * @return * The organization which roles are edited. + */ protected GenericOrganization getOrganization(PageState s) { - return (GenericOrganization)m_itemModel.getSelectedObject(s); + return (GenericOrganization) m_itemModel.getSelectedObject(s); } + /** + * Creates a new OrganizationRole. + * + * @param s + * @return Newly created OrganizationRole. + */ protected OrganizationRole createOrganizationRole(PageState s) { //Person person = this.getPerson(s); //Assert.exists(person); @@ -130,12 +171,18 @@ public class OrganizationRolePropertyForm extends FormSection implements FormIni return role; } + /** + * Sets the properties of an instance of OrganizationRole. + * + * @param role + * @param e + */ protected void setOrganizationRoleProperties(OrganizationRole role, FormSectionEvent e) { PageState state = e.getPageState(); FormData data = e.getFormData(); - role.setRolename((String)m_rolename.getValue(state)); - role.setTargetItem((Person)data.get(ITEM_SEARCH)); + role.setRolename((String) m_rolename.getValue(state)); + role.setTargetItem((Person) data.get(ITEM_SEARCH)); role.save(); } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java index cba4f3f2e..dc7a44984 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleSelectionModel.java @@ -6,19 +6,37 @@ import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.cms.contenttypes.OrganizationRole; /** + * SelectionModel for OrganizationRole. * * @author Jens Pelzetter */ public class OrganizationRoleSelectionModel extends ACSObjectSelectionModel { + /** + * Constructor taking a parameter. + * + * @param param + */ public OrganizationRoleSelectionModel(BigDecimalParameter param) { super(OrganizationRole.class.getName(), OrganizationRole.BASE_DATA_OBJECT_TYPE, param); } + /** + * Constructor taking an itemClass, an objectType and a parameter. + * + * @param itemClass + * @param objectType + * @param parameter + */ public OrganizationRoleSelectionModel(String itemClass, String objectType, BigDecimalParameter parameter) { super(itemClass, objectType, parameter); } + /** + * + * @param state + * @return The selected role. + */ public OrganizationRole getSelectedRole(PageState state) { return (OrganizationRole) getSelectedObject(state); } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java index 67d0bf0f3..d5c8b9982 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTable.java @@ -26,6 +26,7 @@ import java.math.BigDecimal; import org.apache.log4j.Logger; /** + * Table for displaying the existings roles associated with an organization. * * @author Jens Pelzetter */ @@ -41,11 +42,29 @@ public class OrganizationRoleTable extends Table { private TableColumn m_delCol; private RequestLocal m_size; private RequestLocal m_editor; + /** + * Identifier for an Edit event. + */ protected final static String EDIT_EVENT = "Edit"; + /** + * ID for an Delete event. + */ protected final static String DELETE_EVENT = "Delete"; + /** + * ID for an Up event. + */ protected final static String UP_EVENT = "up"; + /** + * ID for an down event. + */ protected final static String DOWN_EVENT = "down"; + /** + * Constructor. Creates a new table a sets the column headers. + * + * @param itemModel + * @param roleModel + */ public OrganizationRoleTable(ItemSelectionModel itemModel, OrganizationRoleSelectionModel roleModel) { super(); this.m_itemModel = itemModel; @@ -72,6 +91,9 @@ public class OrganizationRoleTable extends Table { setModelBuilder(new OrganizationRoleTableModelBuilder(itemModel)); } + /** + * Called by the constructor to add the columns of the table. + */ protected void addColumns() { TableColumnModel model = getColumnModel(); int i = 0; @@ -181,7 +203,7 @@ public class OrganizationRoleTable extends Table { try { logger.debug("About to delete"); m_roleModel.clearSelection(state); - role.delete();; + role.delete(); } catch(Exception ex) { throw new UncheckedWrapperException(ex); } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java index 4da936afa..f678bdea9 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/OrganizationRoleTableModelBuilder.java @@ -7,7 +7,6 @@ import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.GenericOrganization; import com.arsdigita.cms.contenttypes.OrganizationRole; -import com.arsdigita.cms.contenttypes.Person; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; @@ -16,6 +15,7 @@ import com.arsdigita.util.LockableImpl; import org.apache.log4j.Logger; /** + * TableModelBuilder for the OrganizationRoleTable. * * @author Jens Pelzetter */ @@ -25,6 +25,11 @@ public class OrganizationRoleTableModelBuilder extends LockableImpl implements T private ItemSelectionModel m_itemModel; + /** + * Constructor to create a new instance. Needs an ItemSelectionModel instance. + * + * @param itemModel + */ public OrganizationRoleTableModelBuilder(ItemSelectionModel itemModel) { this.m_itemModel = itemModel; } @@ -41,17 +46,29 @@ public class OrganizationRoleTableModelBuilder extends LockableImpl implements T } } + /** + * + * @param s + * @return + */ public DataCollection getRoles(PageState s) { Assert.isTrue(this.m_itemModel.isSelected(s), "item selected"); GenericOrganization orga = (GenericOrganization) m_itemModel.getSelectedItem(s); return OrganizationRole.getRoles(orga); } + /** + * TableModel for the OrganizationRoleTable. + */ public static class OrganizationRoleTableModel implements TableModel { OrganizationRole m_role; DataCollection m_roles; + /** + * + * @param roles + */ public OrganizationRoleTableModel(DataCollection roles) { m_roles = roles; m_role = null; @@ -79,6 +96,10 @@ public class OrganizationRoleTableModelBuilder extends LockableImpl implements T return m_role.getID(); } + /** + * + * @return Number of roles in the table. + */ public long size() { return m_roles.size(); }