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 37c4831f7..ac1863fa5 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 @@ -16,11 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.ContentType; -import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.persistence.DataObject; @@ -28,102 +25,195 @@ import com.arsdigita.persistence.OID; import com.arsdigita.util.Assert; import java.math.BigDecimal; import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.DataAssociation; -import com.arsdigita.persistence.DataAssociationCursor; -import com.arsdigita.persistence.DataOperation; -import com.arsdigita.persistence.DataQuery; -import com.arsdigita.persistence.SessionManager; import org.apache.log4j.Logger; - /** - * An very generic type to represent an organization. + * This represents an organization. It is designed to be suitable + * for most organizations. Currently, it offers the following properties: + * - name of the organization + * - an addendum for the name + * - a short description of the organization. + * + * 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 + * contenttype. * * @author Jens Pelzetter */ public class GenericOrganization extends ContentPage { + /** + * The name of the organization (name can't be used as shorter name here + * because name is already used in one of parent classes, and is used for + * internal purposes also. + */ public static final String ORGANIZATIONNAME = "organizationname"; + /** + * Addendum for the name of the organization. + */ public static final String ORGANIZATIONNAMEADDENDUM = "organizationnameaddendum"; - public static final String DESCRIPTION = "description"; + /** + * A short description of the organization. + */ + public static final String ORGANIZATIONDESCRIPTION = "description"; + /** + * Roles associated with the organization. + */ public static final String ROLES = "roles"; - + /** + * Type of this class (used for internal purposed). + */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.GenericOrganization"; - private static final GenericOrganizationConfig s_config = new GenericOrganizationConfig(); - private static final Logger s_log = Logger.getLogger(GenericOrganization.class); - static { - s_config.load(); - } + /** + * Called when the class is loaded by the Java class loader. + */ + static { + s_config.load(); + } - public static final GenericOrganizationConfig getConfig () { - return s_config; - } + /** + * Returns a possibly existing configuration object for the class. + * + * @return config object + */ + public static final GenericOrganizationConfig getConfig() { + return s_config; + } /** * Default constructor. This creates a new (empty) organization */ public GenericOrganization() { - this(BASE_DATA_OBJECT_TYPE); + this(BASE_DATA_OBJECT_TYPE); } + /** + * Trys to find an organization in the database by its id. + * + * @param id ID of the object to (re-)create + * @throws DataObjectNotFoundException if no object with the given id is found in the database. + */ public GenericOrganization(BigDecimal id) throws DataObjectNotFoundException { - this(new OID(BASE_DATA_OBJECT_TYPE, id)); + this(new OID(BASE_DATA_OBJECT_TYPE, id)); } + /** + * Trys to find an organization in the database by its OID. + * + * @param id ID of the object to (re-)create + * @throws DataObjectNotFoundException if no object with the given OID is found in the database. + */ public GenericOrganization(OID id) throws DataObjectNotFoundException { - super(id); + super(id); } + /** + * Create an new GenericOrganization object from a DataObject + * + * @param obj The data object + */ public GenericOrganization(DataObject obj) { - super(obj); + super(obj); } + /** + * Not sure for what this constructor is. + * + * @param type The type of the object to create (?) + */ public GenericOrganization(String type) { - super(type); + super(type); } /* accessors *************************************************/ + + /** + * Gets the name of the organization. + * + * @return The name of the organization. + */ public String getOrganizationName() { - return (String)get(ORGANIZATIONNAME); + return (String) get(ORGANIZATIONNAME); } + /** + * Sets the name of the organization. + * + * @param name The (new) name of the organization. + */ public void setOrganizationName(String name) { - set(ORGANIZATIONNAME, name); + set(ORGANIZATIONNAME, name); } + + /** + * + * @return Addendum for the name of the organization. + */ public String getOrganizationNameAddendum() { - return (String)get(ORGANIZATIONNAMEADDENDUM); + return (String) get(ORGANIZATIONNAMEADDENDUM); } + /** + * Sets the the addenum property of the organization. + * + * @param addendum The new value for the addendum property. + */ public void setOrganizationNameAddendum(String addendum) { - set(ORGANIZATIONNAMEADDENDUM, addendum); + set(ORGANIZATIONNAMEADDENDUM, addendum); } - public String getDescription() { - return (String)get(DESCRIPTION); + /** + * + * @return Description of the organization, if any. + */ + public String getOrganizationDescription() { + return (String) get(DESCRIPTION); } - public void setDescription(String description) { - set(DESCRIPTION, description); + /** + * Sets the description of the organization. + * + * @param description The (new) description. + */ + public void setOrganizationDescription(String description) { + set(DESCRIPTION, description); } + /** + * + * @return All roles associated with this organization. + */ public OrganizationRoleCollection getOrganizationRoles() { - return new OrganizationRoleCollection((DataCollection) get(ROLES)); + return new OrganizationRoleCollection((DataCollection) get(ROLES)); } + /** + * Adds a role to a organization. + * + * @param organizationRole The role to add. + */ public void addOrganizationRole(OrganizationRole organizationRole) { - Assert.exists(organizationRole, OrganizationRole.class); - add(ROLES, organizationRole); + Assert.exists(organizationRole, OrganizationRole.class); + add(ROLES, organizationRole); } + /** + * Removes a role from a organization. + * + * @param organizationRole The role to remove. + */ public void removeOrganizationRole(OrganizationRole organizationRole) { - Assert.exists(organizationRole, OrganizationRole.class); - remove(ROLES, organizationRole); + Assert.exists(organizationRole, OrganizationRole.class); + remove(ROLES, organizationRole); } - } \ No newline at end of file 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 312e1d032..0c226ffd2 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 @@ -24,6 +24,7 @@ import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.BooleanParameter; /** + * Configuration for GenericOrganization. Not used yet. * * @author Jens Pelzetter */ diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java index 4120b3f96..461973d46 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java @@ -18,36 +18,54 @@ */ package com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.contenttypes.ContentTypeInitializer; import org.apache.log4j.Logger; import com.arsdigita.runtime.LegacyInitEvent; /** + * Initializer of the GenericOrganization content type. * * @author Jens Pelzetter */ public class GenericOrganizationInitializer extends ContentTypeInitializer { - public final static String versionId = + /*public final static String versionId = "$Id: GenericOrganizationInitializer.java 1 2009-04-30 09:32:55Z jensp $" + "$Author: jensp $" + - "$DateTime: 2009/04/30 11:33:39 $"; + "$DateTime: 2009/04/30 11:33:39 $";*/ private static final Logger s_log = Logger.getLogger(GenericOrganizationInitializer.class); + /** + * Constructor. calls only the constructor of the parent class with name of + * the pdl.mf file of the content type an the BASIC_DATA_OBJECT_TYPE. + */ public GenericOrganizationInitializer() { super("ccm-cms-types-genericorganization.pdl.mf", GenericOrganization.BASE_DATA_OBJECT_TYPE); } + /** + * + * @return path of the traversal-adapter XML file. + */ @Override public String getTraversalXML() { return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml"; } + /** + * + * @return path of the XSL stylesheet file. The stylesheet is very generic, because this + * contenttype will be used with the new mandalay theme only. + */ public String getStylesheet() { return "static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl"; } + /** + * Calls the init method of the parent class. + * + * @param evt The init event. LegacyInitEvent is marked deprecated. What should be used insted? + */ @Override public void init(LegacyInitEvent evt) { super.init(evt); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java index 37dbd4180..a57fb5cc1 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java @@ -16,10 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.lifecycle.LifecycleDefinition; @@ -32,44 +30,58 @@ import java.io.InputStream; import org.apache.log4j.Logger; /** + * Loader for the GenericOrganization content type. * * @author Jens Pelzetter */ public class GenericOrganizationLoader extends AbstractContentTypeLoader { - + private static final Logger s_log = Logger.getLogger(GenericOrganizationLoader.class); private static final String[] TYPES = { - "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml" + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml" }; + private ResourceParameter m_template; + /** + * Returns the value of the type string. + * + * @return The type string. + */ public String[] getTypes() { - return TYPES; + return TYPES; } - private ResourceParameter m_template; - + /** + * Constructor. + */ public GenericOrganizationLoader() { super(); - m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template", - Parameter.REQUIRED, - "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp"); - register(m_template); + m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template", + Parameter.REQUIRED, + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp"); + register(m_template); } + /** + * + * @param section + * @param type + * @param ld + * @param wf + */ @Override - protected void prepareSection(final ContentSection section, - final ContentType type, - final LifecycleDefinition ld, - final WorkflowTemplate wf) { - super.prepareSection(section, type, ld, wf); - - setDefaultTemplate("GenericOrganization-genericorganization-item", - "genericorganization-item", - (InputStream)get(m_template), - section, - type, - ld, - wf); + protected void prepareSection(final ContentSection section, + final ContentType type, + final LifecycleDefinition ld, + final WorkflowTemplate wf) { + super.prepareSection(section, type, ld, wf); + + setDefaultTemplate("GenericOrganization-genericorganization-item", + "genericorganization-item", + (InputStream) get(m_template), + section, + type, + ld, + wf); } - } \ No newline at end of file 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 3d7bd019d..7221f8824 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 @@ -3,12 +3,8 @@ package com.arsdigita.cms.contenttypes; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; -import com.arsdigita.cms.ImageAsset; -import com.arsdigita.cms.TextAsset; import com.arsdigita.kernel.ACSObject; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -16,28 +12,64 @@ import org.apache.log4j.Logger; import java.math.BigDecimal; + +/** + * ContentItem reprenting a role in a organization, e.g. CEO. + * + * @author Jens Pelzetter + */ public class OrganizationRole extends ContentPage { private static final Logger logger = Logger.getLogger(OrganizationRole.class); + /** + * Name of the role. + */ public static final String ROLENAME = "rolename"; + /** + * Type identifier. + */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole"; + /** + * Default Constructor + */ public OrganizationRole() { super(BASE_DATA_OBJECT_TYPE); } + /** + * Trys to find the role with the given id in the database. + * + * @param id of the role to find. + * @throws com.arsdigita.domain.DataObjectNotFoundException + */ public OrganizationRole(BigDecimal id) throws DataObjectNotFoundException { this(new OID(BASE_DATA_OBJECT_TYPE, id)); } + /** + * Trys to find the role with the given id in the database. + * + * @param id + * @throws com.arsdigita.domain.DataObjectNotFoundException + */ public OrganizationRole(OID id) throws DataObjectNotFoundException { super(id); } + /** + * Creates an OrganizationRole object based on a DataObject + * + * @param obj A object of DataObject class. + */ public OrganizationRole(DataObject obj) { super(obj); } + /** + * + * @param type + */ public OrganizationRole(String type) { super(type); } @@ -47,10 +79,20 @@ public class OrganizationRole extends ContentPage { } //Accessors + + /** + * + * @return The name of the role. + */ public String getRolename() { return (String) get(ROLENAME); } + /** + * Sets the name of the role. + * + * @param rolename New name of the role. + */ public void setRolename(String rolename) { set(ROLENAME, rolename); } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java index 31f05f6f5..7e7e0ef26 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java @@ -4,10 +4,20 @@ import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataCollection; +/** + * Collection containing all roles associated to an organization. + * + * @author Jens Pelzetter + */ public class OrganizationRoleCollection extends DomainCollection { //public static final String versionId = "$Id: OrganizationRoleCollection.java 001 2009-05-28 12:40:00Z jensp $"; + /** + * Creates an object of this class from an DataCollection object. + * + * @param dataCollection + */ public OrganizationRoleCollection(DataCollection dataCollection) { super(dataCollection); } @@ -17,6 +27,9 @@ public class OrganizationRoleCollection extends DomainCollection { return new OrganizationRole(m_dataCollection.getDataObject()); } + /** + * @return the item at the current position + */ public OrganizationRole getOrganizationRole() { return (OrganizationRole) getDomainObject(); } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java index f78bd786e..1fb8ece28 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java @@ -19,6 +19,7 @@ import com.arsdigita.cms.ui.authoring.CreationSelector; import com.arsdigita.ui.util.GlobalizationUtil; /** + * Form for creating a new organization. * * @author Jens Pelzetter */ @@ -26,6 +27,12 @@ public class GenericOrganizationCreate extends GenericOrganizationForm implement private CreationSelector m_parent; private ApplyWorkflowFormSection m_workflowSection; + /** + * Constructor. + * + * @param itemModel + * @param parent + */ public GenericOrganizationCreate(ItemSelectionModel itemModel, CreationSelector parent) { super("GenericOrganizationCreate", itemModel); m_parent = parent; @@ -35,6 +42,9 @@ public class GenericOrganizationCreate extends GenericOrganizationForm implement getSaveCancelSection().getSaveButton().setButtonLabel("Create"); } + /** + * Adds all widgets to the form. + */ @Override protected void addWidgets() { m_workflowSection = new ApplyWorkflowFormSection(); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java index 3fa359f16..a29546175 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java @@ -10,11 +10,18 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.ui.util.GlobalizationUtil; /** + * EditStep for editing an organization. * * @author Jens Pelzetter */ public class GenericOrganizationEdit extends SimpleEditStep { + /** + * Constructor. + * + * @param itemModel + * @param parent + */ public GenericOrganizationEdit(ItemSelectionModel itemModel, AuthoringKitWizard parent) { super(itemModel, parent); @@ -25,10 +32,20 @@ public class GenericOrganizationEdit extends SimpleEditStep { setDisplayComponent(getGenericOrganizationPropertiesSheet(itemModel)); } + /** + * + * @param model + * @return A new instance of this class. + */ protected GenericOrganizationForm getForm(ItemSelectionModel model) { return new GenericOrganizationEditForm(model, this); } + /** + * + * @param model + * @return A sheet with widgets for the properites of GenericOrgnization. + */ public Component getGenericOrganizationPropertiesSheet(ItemSelectionModel model) { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(model); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java index f33869d34..83e9955eb 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java @@ -13,6 +13,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.util.Assert; /** + * Form for editing a GenericOrganization. * * @author Jens Pelzetter */ @@ -20,6 +21,12 @@ public class GenericOrganizationEditForm extends GenericOrganizationForm impleme private SimpleEditStep m_step; + /** + * Constructor. + * + * @param itemModel + * @param step + */ public GenericOrganizationEditForm(ItemSelectionModel itemModel, SimpleEditStep step) { super("GenericOrganizationEditForm", itemModel); addSubmissionListener(this); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java index 0adfb25df..b703597a4 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java @@ -16,28 +16,49 @@ import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.GenericOrganization; -import com.arsdigita.persistence.metadata.Element; import com.arsdigita.ui.util.GlobalizationUtil; import com.arsdigita.util.Assert; import javax.servlet.ServletException; import org.apache.log4j.Logger; /** + * A form section for editing an orgnization. * * @author Jens Pelzetter */ public abstract class GenericOrganizationForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener { + /** + * ItemSelectionModel for the form section + */ protected ItemSelectionModel m_itemModel; + /** + * SaveCancelSection (Save and Cancel buttons) for this sections. + */ protected SaveCancelSection m_saveCancelSection; private Label m_script = new Label(""); + /** + * Organizationname. + */ public static final String ORGANIZATIONAME = GenericOrganization.ORGANIZATIONNAME; + /** + * Addedum + */ public static final String ORGANIZATIONNAMEADDENDUM = GenericOrganization.ORGANIZATIONNAMEADDENDUM; + /** + * Description + */ public static final String DESCRIPTION = GenericOrganization.DESCRIPTION; private static final Logger logger = Logger.getLogger(GenericOrganizationForm.class); + /** + * Creates the columnpanel, adds the widgets, the SaveCancelSection and the listeners. + * + * @param formName + * @param itemModel + */ public GenericOrganizationForm(String formName, ItemSelectionModel itemModel) { super(new ColumnPanel(2)); @@ -59,15 +80,25 @@ public abstract class GenericOrganizationForm extends FormSection implements For addValidationListener(this); } + /** + * Adds the SavaCancelSection. + */ public void addSaveCancelSection() { m_saveCancelSection = new SaveCancelSection(); add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); } + /** + * + * @return The SaveCancelSection of the form section. + */ public SaveCancelSection getSaveCancelSection() { return m_saveCancelSection; } + /** + * Adds the widgets to the form. + */ protected void addWidgets() { add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationname"))); TextField organizationName = new TextField(ORGANIZATIONAME); @@ -89,6 +120,12 @@ public abstract class GenericOrganizationForm extends FormSection implements For public abstract void process (FormSectionEvent e) throws FormProcessException; public abstract void validate (FormSectionEvent e) throws FormProcessException; + /** + * Inits the widgets. + * + * @param e + * @return + */ public GenericOrganization initBasicWidgets(FormSectionEvent e) { Assert.exists(m_itemModel, ItemSelectionModel.class); @@ -105,6 +142,12 @@ public abstract class GenericOrganizationForm extends FormSection implements For return orga; } + /** + * Processes the widgets. + * + * @param e + * @return + */ public GenericOrganization processBasicWidgets(FormSectionEvent e) { Assert.exists(m_itemModel, ItemSelectionModel.class); @@ -121,6 +164,13 @@ public abstract class GenericOrganizationForm extends FormSection implements For return orga; } + /** + * Creates a new organization. + * + * @param state + * @return + * @throws com.arsdigita.bebop.FormProcessException + */ public GenericOrganization createGenericOrganization(PageState state) throws FormProcessException { Assert.exists(m_itemModel, ItemSelectionModel.class); diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java index 60bffaee0..16ccaa9d1 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java @@ -37,27 +37,75 @@ import com.arsdigita.util.Assert; public class GenericOrganizationViewRoles extends ResettableContainer { /* Ids for the editing panels */ + /** + * Identifier for the table of roles + */ public static final String ROLES_TABLE = "rolesTable"; + /** + * Identifier for the role edit form + */ public static final String ROLES_EDIT = "rolesEdit"; + /** + * Identifier for the role delete form + */ public static final String ROLES_DELETE = "rolesDelete"; /* class attributes */ + /** + * Identifier for the data table + */ public static final String DATA_TABLE = "dataTable"; + /** + * Identifier for the action link + */ public static final String ACTION_LINK = "actionLink"; + /** + * The authoring wizard + */ protected AuthoringKitWizard m_wizard; + /** + * ItemSelectionModel for the organization + */ protected ItemSelectionModel m_selectionOrganization; + /** + * ItemSelection for the role + */ protected ItemSelectionModel m_selectionRole; + /** + * ItemSelectionModel for moving the role position (currently not used) + */ protected ItemSelectionModel m_moveRole; + /** + * Move parameter (not used yet) + */ protected BigDecimalParameter m_moveParameter; /* Visual components doing the word */ + /** + * Table with all roles associated with the organization. + */ protected RoleTable m_roleTable; + /** + * Form for editing a role + */ protected RoleEditForm m_roleEdit; + /** + * Form for deleting a role + */ protected RoleDeleteForm m_roleDelete; + /** + * Begin link + */ protected ActionLink m_beginLink; private Label m_moveRoleLabel; private String m_typeIdStr; + /** + * Constructor. + * + * @param selOrga + * @param wizard + */ public GenericOrganizationViewRoles(ItemSelectionModel selOrga, AuthoringKitWizard wizard) { super(); m_selectionOrganization = selOrga; @@ -70,6 +118,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer { add(buildRoleDelete(), false); } + /** + * Builds the table of roles. + * + * @return The table of roles. + */ protected Container buildRoleTable() { ColumnPanel c = new ColumnPanel(1); c.setKey(ROLES_TABLE + m_typeIdStr); @@ -146,6 +199,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer { return c; } + /** + * Builds the edit form. + * + * @return The edit form. + */ protected Container buildRoleEdit() { ColumnPanel c = new ColumnPanel(1); c.setKey(ROLES_EDIT + m_typeIdStr); @@ -175,6 +233,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer { return c; } + /** + * Builds the delete form + * + * @return The delete form. + */ protected Container buildRoleDelete() { ColumnPanel c = new ColumnPanel(1); c.setKey(ROLES_DELETE + m_typeIdStr); @@ -197,6 +260,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer { return c; } + /** + * Builds the view all roles link. + * + * @return The ViewAllLink. + */ protected ActionLink buildViewAllLink() { ActionLink viewAllLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.view_all_roles").localize()); viewAllLink.setClassAttr(ACTION_LINK); @@ -210,6 +278,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer { return viewAllLink; } + /** + * Builds the add link. + * + * @return The add link. + */ protected ActionLink buildAddLink() { ActionLink addLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorgnization.add_new_role").localize()) { @@ -244,6 +317,10 @@ public class GenericOrganizationViewRoles extends ResettableContainer { } + /** + * + * @return The typeIdStr. + */ public String getTypeIdStr() { return m_typeIdStr; } diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java index 9e136d0b5..6452fe8ee 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java @@ -19,6 +19,7 @@ import javax.servlet.ServletException; import org.apache.log4j.Logger; /** + * Panel for editing roles. * * @author Jens Pelzetter */ @@ -30,6 +31,9 @@ public class OrganizationRolePanel extends SimpleComponent { private boolean m_showAllRoles = false; //private static final String versionId = "$Id: OrganizationRolePanel.java 2009-06-01T10:42+02:00"; + /** + * Constructor. + */ public OrganizationRolePanel() { super(); } @@ -41,9 +45,20 @@ public class OrganizationRolePanel extends SimpleComponent { addGlobalStateParams(p); } + /** + * Adds a global state param. Not in use yet. + * + * @param p + */ public void addGlobalStateParams(Page p) { } + /** + * + * @param state + * @param item + * @return The XMLGenerator for the panel. + */ protected XMLGenerator getXMLGenerator(PageState state, ContentItem item) { ContentSection section = null; @@ -61,10 +76,21 @@ public class OrganizationRolePanel extends SimpleComponent { return section.getXMLGenerator(); } + /** + * Sets the value of the showAllRoles property. + * + * @param showAll + */ public void setShowAllRoles(boolean showAll) { this.m_showAllRoles = showAll; } + /** + * Returns the current ContentItem. + * + * @param state + * @return + */ protected ContentItem getContentItem(PageState state) { CMSContext context = CMS.getContext(); @@ -75,6 +101,12 @@ public class OrganizationRolePanel extends SimpleComponent { return context.getContentItem(); } + /** + * + * @param item + * @param state + * @return An array with all roles associated with the organization. + */ protected OrganizationRole[] getOrganizationRoles(ContentItem item, final PageState state) { GenericOrganization orga = (GenericOrganization) item; OrganizationRoleCollection roles = orga.getOrganizationRoles(); @@ -102,6 +134,13 @@ public class OrganizationRolePanel extends SimpleComponent { generateXML(item, parent, state); } + /** + * Creates the XML for the panel. + * + * @param item + * @param element + * @param state + */ public void generateXML(ContentItem item, Element element, PageState state) { Element content = element.newChildElement("cms:organizationRolePanel", CMS.CMS_XML_NS); exportAttributes(content); @@ -114,6 +153,14 @@ public class OrganizationRolePanel extends SimpleComponent { } } + /** + * Creates the XML for a role. + * + * @param state + * @param parent + * @param role + * @param xmlGenerator + */ protected void generateRoleXML(final PageState state, final Element parent, final ContentItem role, final XMLGenerator xmlGenerator) { CMSExcursion excursion = new CMSExcursion() { @@ -132,7 +179,4 @@ public class OrganizationRolePanel extends SimpleComponent { throw new UncheckedWrapperException("excursion failed", e); } } -} - - - +} \ No newline at end of file diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java index 0ab3eeb4a..93a1ac79f 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java @@ -18,17 +18,33 @@ import com.arsdigita.util.Assert; import org.apache.log4j.Logger; /** + * Form for deleting a role. * * @author Jens Pelzetter */ public class RoleDeleteForm extends Form implements FormInitListener, FormSubmissionListener, FormProcessListener { private static final Logger logger = Logger.getLogger(RoleDeleteForm.class); + /** + * ItemSelectionModel for the organization. + */ protected ItemSelectionModel m_selectionOrganization; + /** + * ItemSelectionModle for the role + */ protected ItemSelectionModel m_selectionRole; + /** + * SaveCancelSection of this form + */ protected SaveCancelSection m_saveCancelSection; private Label m_roleNameLabel; + /** + * Constructor. + * + * @param selectionOrganization + * @param selectionRole + */ public RoleDeleteForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) { super("RoleDeleteForm", new ColumnPanel(2)); @@ -51,6 +67,11 @@ public class RoleDeleteForm extends Form implements FormInitListener, FormSubmis addProcessListener(this); } + /** + * Adds the SaveCancelSection of this form. + * + * @return + */ protected SaveCancelSection addSaveCancelSection() { m_saveCancelSection = new SaveCancelSection(); m_saveCancelSection.getSaveButton().setButtonLabel("Delete"); @@ -92,4 +113,4 @@ public class RoleDeleteForm extends Form implements FormInitListener, FormSubmis logger.info(String.format("role %s delete", m_selectionRole.getSelectedKey(state))); } -} +} \ No newline at end of file diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java index 5436164fc..c7c9d1b6a 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java @@ -25,6 +25,7 @@ import java.math.BigDecimal; import org.apache.log4j.Logger; /** + * Form for editing a role. * * @author Jens Pelzetter */ @@ -40,12 +41,28 @@ public class RoleEditForm extends Form { private SaveCancelSection m_saveCancelSection; - public static final String ROLENAME = "rolename"; + /** + * Rolename identifier string. + */ + public static final String ROLENAME = OrganizationRole.ROLENAME; + /** + * Constructor. + * + * @param selectionOrganization + * @param selectionRole + */ public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) { this(selectionOrganization, selectionRole, null); } + /** + * Constructor. + * + * @param selectionOrganization + * @param selectionRole + * @param container + */ public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole, GenericOrganizationViewRoles container) { super("RoleEditForm", new ColumnPanel(2)); @@ -71,16 +88,28 @@ public class RoleEditForm extends Form { addProcessListener(new RoleProcessListener()); } + /** + * Adds the SaveCancelSection to the form. + * + * @return + */ protected SaveCancelSection addSaveCancelSection() { m_saveCancelSection = new SaveCancelSection(); add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); return m_saveCancelSection; } + /** + * + * @return The SaveCancelSection of this form. + */ public SaveCancelSection getSaveCancelSection() { return m_saveCancelSection; } + /** + * Adds the widgets to the form. + */ protected void addWidgets() { logger.info("Adding widgets for role form..."); add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.rolename"))); @@ -149,6 +178,13 @@ public class RoleEditForm extends Form { } } + /** + * Creates a new role. + * + * @param event + * @param orga + * @return The role. + */ protected OrganizationRole createRole(FormSectionEvent event, GenericOrganization orga) { logger.info("creating new role..."); @@ -168,4 +204,4 @@ public class RoleEditForm extends Form { public void register(Page page) { super.register(page); } -} +} \ No newline at end of file diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java index 5290eb121..7da7ada2c 100644 --- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java +++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java @@ -26,6 +26,7 @@ import java.math.BigDecimal; import org.apache.log4j.Logger; /** + * Table listing all Roles associated with a organization. * * @author Jens Pelzetter */ @@ -34,14 +35,32 @@ public class RoleTable extends Table { private final static Logger logger = Logger.getLogger(RoleTable.class); // columns headings + /** + * Heading for first column + */ public static final String COL_TITLE = "Role"; + /** + * Heading for second column + */ public static final String COL_EDIT = "Edit"; + /** + * Heading for third column + */ public static final String COL_MOVE = "Move"; + /** + * Heading for last column + */ public static final String COL_DEL = "Delete"; private ItemSelectionModel m_selectionOrganization; private ItemSelectionModel m_selectionRole; private ItemSelectionModel m_moveRole; + /** + * Constructor. + * + * @param selOrga + * @param moveRole + */ public RoleTable(ItemSelectionModel selOrga, ItemSelectionModel moveRole) { super(); m_selectionOrganization = selOrga; @@ -91,6 +110,11 @@ public class RoleTable extends Table { } + /** + * Sets the ItemSelectionModel. + * + * @param itemModel + */ public void setRoleModel(ItemSelectionModel itemModel) { if (itemModel == null) { logger.warn("null item model"); @@ -98,11 +122,26 @@ public class RoleTable extends Table { m_selectionRole = itemModel; } + /** + * Builder class for the table model. + */ protected class RoleTableModelBuilder extends LockableImpl implements TableModelBuilder { + /** + * ItemSelectionModel for the organization. + */ protected ItemSelectionModel m_selectionOrganization; + /** + * ItemSelectionModel for moving the role (feature not implemented yet) + */ protected ItemSelectionModel m_moveRole; + /** + * Constructor. + * + * @param selectionOrganization + * @param moveRole + */ public RoleTableModelBuilder(ItemSelectionModel selectionOrganization, ItemSelectionModel moveRole) { m_selectionOrganization = selectionOrganization; m_moveRole = moveRole; @@ -117,6 +156,9 @@ public class RoleTable extends Table { } } + /** + * TableModel for the RoleTable. + */ protected class RoleTableModel implements TableModel { private TableColumnModel m_colModel; @@ -126,6 +168,14 @@ public class RoleTable extends Table { private ItemSelectionModel m_moveRole; private OrganizationRole m_role; + /** + * Constructor. + * + * @param table + * @param state + * @param orga + * @param moveRole + */ public RoleTableModel(Table table, PageState state, GenericOrganization orga, ItemSelectionModel moveRole) { m_colModel = table.getColumnModel(); m_table = (RoleTable) table; @@ -176,14 +226,25 @@ public class RoleTable extends Table { } } + /** + * Renderer for the cells of the RoleTable. + */ public class RoleTableCellRenderer extends LockableImpl implements TableCellRenderer { private boolean m_active; + /** + * Constructor. + */ public RoleTableCellRenderer() { this(false); } + /** + * Constructor. + * + * @param active + */ public RoleTableCellRenderer(boolean active) { m_active = active; } @@ -212,4 +273,4 @@ public class RoleTable extends Table { return ret; } } -} +} \ No newline at end of file diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java b/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java index 4f94667c0..6d4fd8099 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java @@ -793,6 +793,16 @@ public final class ContentSectionConfig extends AbstractConfig { return (String)get(m_categoryTreeOrdering); } + /** + * I'am not sure for what this method is. I found it here when I tried + * figure out how add multiple parts to an ContentType, like ccm-cms-types-contact + * and the Multipart article do. I think this method should not be here because + * it is only needed by one specific contenttype. Because of this, I think that + * this method and the contact are violating many rules of modern software design. + * Jens Pelzetter, 2009-06-02. + * + * @return + */ public boolean getHasContactsAuthoringStep() { return ((Boolean) get(m_hasContactsAuthoringStep)).booleanValue(); }