JavaDoc for GenericOrganization

git-svn-id: https://svn.libreccm.org/ccm/trunk@189 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2009-06-02 13:47:44 +00:00
parent 92d1dfe87e
commit 4f1a80d506
16 changed files with 589 additions and 80 deletions

View File

@ -16,11 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
@ -28,37 +25,65 @@ import com.arsdigita.persistence.OID;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.arsdigita.persistence.DataCollection; 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; 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 * @author Jens Pelzetter
*/ */
public class GenericOrganization extends ContentPage { 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"; public static final String ORGANIZATIONNAME = "organizationname";
/**
* Addendum for the name of the organization.
*/
public static final String ORGANIZATIONNAMEADDENDUM = "organizationnameaddendum"; 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"; 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"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.GenericOrganization";
private static final GenericOrganizationConfig s_config = new GenericOrganizationConfig(); private static final GenericOrganizationConfig s_config = new GenericOrganizationConfig();
private static final Logger s_log = Logger.getLogger(GenericOrganization.class); private static final Logger s_log = Logger.getLogger(GenericOrganization.class);
/**
* Called when the class is loaded by the Java class loader.
*/
static { static {
s_config.load(); s_config.load();
} }
/**
* Returns a possibly existing configuration object for the class.
*
* @return config object
*/
public static final GenericOrganizationConfig getConfig() { public static final GenericOrganizationConfig getConfig() {
return s_config; return s_config;
} }
@ -70,60 +95,125 @@ public class GenericOrganization extends ContentPage {
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 { 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 { 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) { 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) { public GenericOrganization(String type) {
super(type); super(type);
} }
/* accessors *************************************************/ /* accessors *************************************************/
/**
* Gets the name of the organization.
*
* @return The name of the organization.
*/
public String getOrganizationName() { 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) { public void setOrganizationName(String name) {
set(ORGANIZATIONNAME, name); set(ORGANIZATIONNAME, name);
} }
/**
*
* @return Addendum for the name of the organization.
*/
public String getOrganizationNameAddendum() { 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) { public void setOrganizationNameAddendum(String addendum) {
set(ORGANIZATIONNAMEADDENDUM, addendum); set(ORGANIZATIONNAMEADDENDUM, addendum);
} }
public String getDescription() { /**
*
* @return Description of the organization, if any.
*/
public String getOrganizationDescription() {
return (String) get(DESCRIPTION); return (String) get(DESCRIPTION);
} }
public void setDescription(String description) { /**
* Sets the description of the organization.
*
* @param description The (new) description.
*/
public void setOrganizationDescription(String description) {
set(DESCRIPTION, description); set(DESCRIPTION, description);
} }
/**
*
* @return All roles associated with this organization.
*/
public OrganizationRoleCollection getOrganizationRoles() { 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) { public void addOrganizationRole(OrganizationRole organizationRole) {
Assert.exists(organizationRole, OrganizationRole.class); Assert.exists(organizationRole, OrganizationRole.class);
add(ROLES, organizationRole); add(ROLES, organizationRole);
} }
/**
* Removes a role from a organization.
*
* @param organizationRole The role to remove.
*/
public void removeOrganizationRole(OrganizationRole organizationRole) { public void removeOrganizationRole(OrganizationRole organizationRole) {
Assert.exists(organizationRole, OrganizationRole.class); Assert.exists(organizationRole, OrganizationRole.class);
remove(ROLES, organizationRole); remove(ROLES, organizationRole);
} }
} }

View File

@ -24,6 +24,7 @@ import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.BooleanParameter;
/** /**
* Configuration for GenericOrganization. Not used yet.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */

View File

@ -18,36 +18,54 @@
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.runtime.LegacyInitEvent;
/** /**
* Initializer of the GenericOrganization content type.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class GenericOrganizationInitializer extends ContentTypeInitializer { 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 $" + "$Id: GenericOrganizationInitializer.java 1 2009-04-30 09:32:55Z jensp $" +
"$Author: 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); 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() { public GenericOrganizationInitializer() {
super("ccm-cms-types-genericorganization.pdl.mf", super("ccm-cms-types-genericorganization.pdl.mf",
GenericOrganization.BASE_DATA_OBJECT_TYPE); GenericOrganization.BASE_DATA_OBJECT_TYPE);
} }
/**
*
* @return path of the traversal-adapter XML file.
*/
@Override @Override
public String getTraversalXML() { public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml"; 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() { public String getStylesheet() {
return "static/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xsl"; 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 @Override
public void init(LegacyInitEvent evt) { public void init(LegacyInitEvent evt) {
super.init(evt); super.init(evt);

View File

@ -16,10 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.cms.lifecycle.LifecycleDefinition;
@ -32,6 +30,7 @@ import java.io.InputStream;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Loader for the GenericOrganization content type.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -41,13 +40,20 @@ public class GenericOrganizationLoader extends AbstractContentTypeLoader {
private static final String[] TYPES = { 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() { public String[] getTypes() {
return TYPES; return TYPES;
} }
private ResourceParameter m_template; /**
* Constructor.
*/
public GenericOrganizationLoader() { public GenericOrganizationLoader() {
super(); super();
m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template", m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template",
@ -56,6 +62,13 @@ public class GenericOrganizationLoader extends AbstractContentTypeLoader {
register(m_template); register(m_template);
} }
/**
*
* @param section
* @param type
* @param ld
* @param wf
*/
@Override @Override
protected void prepareSection(final ContentSection section, protected void prepareSection(final ContentSection section,
final ContentType type, final ContentType type,
@ -71,5 +84,4 @@ public class GenericOrganizationLoader extends AbstractContentTypeLoader {
ld, ld,
wf); wf);
} }
} }

View File

@ -3,12 +3,8 @@ package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.TextAsset;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.domain.DataObjectNotFoundException; 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.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
@ -16,28 +12,64 @@ import org.apache.log4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* ContentItem reprenting a role in a organization, e.g. CEO.
*
* @author Jens Pelzetter
*/
public class OrganizationRole extends ContentPage { public class OrganizationRole extends ContentPage {
private static final Logger logger = Logger.getLogger(OrganizationRole.class); private static final Logger logger = Logger.getLogger(OrganizationRole.class);
/**
* Name of the role.
*/
public static final String ROLENAME = "rolename"; public static final String ROLENAME = "rolename";
/**
* Type identifier.
*/
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole";
/**
* Default Constructor
*/
public OrganizationRole() { public OrganizationRole() {
super(BASE_DATA_OBJECT_TYPE); 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 { public OrganizationRole(BigDecimal id) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id)); 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 { public OrganizationRole(OID id) throws DataObjectNotFoundException {
super(id); super(id);
} }
/**
* Creates an OrganizationRole object based on a DataObject
*
* @param obj A object of DataObject class.
*/
public OrganizationRole(DataObject obj) { public OrganizationRole(DataObject obj) {
super(obj); super(obj);
} }
/**
*
* @param type
*/
public OrganizationRole(String type) { public OrganizationRole(String type) {
super(type); super(type);
} }
@ -47,10 +79,20 @@ public class OrganizationRole extends ContentPage {
} }
//Accessors //Accessors
/**
*
* @return The name of the role.
*/
public String getRolename() { public String getRolename() {
return (String) get(ROLENAME); return (String) get(ROLENAME);
} }
/**
* Sets the name of the role.
*
* @param rolename New name of the role.
*/
public void setRolename(String rolename) { public void setRolename(String rolename) {
set(ROLENAME, rolename); set(ROLENAME, rolename);
} }

View File

@ -4,10 +4,20 @@ import com.arsdigita.domain.DomainCollection;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
/**
* Collection containing all roles associated to an organization.
*
* @author Jens Pelzetter
*/
public class OrganizationRoleCollection extends DomainCollection { public class OrganizationRoleCollection extends DomainCollection {
//public static final String versionId = "$Id: OrganizationRoleCollection.java 001 2009-05-28 12:40:00Z jensp $"; //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) { public OrganizationRoleCollection(DataCollection dataCollection) {
super(dataCollection); super(dataCollection);
} }
@ -17,6 +27,9 @@ public class OrganizationRoleCollection extends DomainCollection {
return new OrganizationRole(m_dataCollection.getDataObject()); return new OrganizationRole(m_dataCollection.getDataObject());
} }
/**
* @return the item at the current position
*/
public OrganizationRole getOrganizationRole() { public OrganizationRole getOrganizationRole() {
return (OrganizationRole) getDomainObject(); return (OrganizationRole) getDomainObject();
} }

View File

@ -19,6 +19,7 @@ import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.ui.util.GlobalizationUtil; import com.arsdigita.ui.util.GlobalizationUtil;
/** /**
* Form for creating a new organization.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -26,6 +27,12 @@ public class GenericOrganizationCreate extends GenericOrganizationForm implement
private CreationSelector m_parent; private CreationSelector m_parent;
private ApplyWorkflowFormSection m_workflowSection; private ApplyWorkflowFormSection m_workflowSection;
/**
* Constructor.
*
* @param itemModel
* @param parent
*/
public GenericOrganizationCreate(ItemSelectionModel itemModel, CreationSelector parent) { public GenericOrganizationCreate(ItemSelectionModel itemModel, CreationSelector parent) {
super("GenericOrganizationCreate", itemModel); super("GenericOrganizationCreate", itemModel);
m_parent = parent; m_parent = parent;
@ -35,6 +42,9 @@ public class GenericOrganizationCreate extends GenericOrganizationForm implement
getSaveCancelSection().getSaveButton().setButtonLabel("Create"); getSaveCancelSection().getSaveButton().setButtonLabel("Create");
} }
/**
* Adds all widgets to the form.
*/
@Override @Override
protected void addWidgets() { protected void addWidgets() {
m_workflowSection = new ApplyWorkflowFormSection(); m_workflowSection = new ApplyWorkflowFormSection();

View File

@ -10,11 +10,18 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.ui.util.GlobalizationUtil; import com.arsdigita.ui.util.GlobalizationUtil;
/** /**
* EditStep for editing an organization.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class GenericOrganizationEdit extends SimpleEditStep { public class GenericOrganizationEdit extends SimpleEditStep {
/**
* Constructor.
*
* @param itemModel
* @param parent
*/
public GenericOrganizationEdit(ItemSelectionModel itemModel, AuthoringKitWizard parent) { public GenericOrganizationEdit(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
super(itemModel, parent); super(itemModel, parent);
@ -25,10 +32,20 @@ public class GenericOrganizationEdit extends SimpleEditStep {
setDisplayComponent(getGenericOrganizationPropertiesSheet(itemModel)); setDisplayComponent(getGenericOrganizationPropertiesSheet(itemModel));
} }
/**
*
* @param model
* @return A new instance of this class.
*/
protected GenericOrganizationForm getForm(ItemSelectionModel model) { protected GenericOrganizationForm getForm(ItemSelectionModel model) {
return new GenericOrganizationEditForm(model, this); return new GenericOrganizationEditForm(model, this);
} }
/**
*
* @param model
* @return A sheet with widgets for the properites of GenericOrgnization.
*/
public Component getGenericOrganizationPropertiesSheet(ItemSelectionModel model) { public Component getGenericOrganizationPropertiesSheet(ItemSelectionModel model) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(model); DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(model);

View File

@ -13,6 +13,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
/** /**
* Form for editing a GenericOrganization.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -20,6 +21,12 @@ public class GenericOrganizationEditForm extends GenericOrganizationForm impleme
private SimpleEditStep m_step; private SimpleEditStep m_step;
/**
* Constructor.
*
* @param itemModel
* @param step
*/
public GenericOrganizationEditForm(ItemSelectionModel itemModel, SimpleEditStep step) { public GenericOrganizationEditForm(ItemSelectionModel itemModel, SimpleEditStep step) {
super("GenericOrganizationEditForm", itemModel); super("GenericOrganizationEditForm", itemModel);
addSubmissionListener(this); addSubmissionListener(this);

View File

@ -16,28 +16,49 @@ import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganization; import com.arsdigita.cms.contenttypes.GenericOrganization;
import com.arsdigita.persistence.metadata.Element;
import com.arsdigita.ui.util.GlobalizationUtil; import com.arsdigita.ui.util.GlobalizationUtil;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* A form section for editing an orgnization.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public abstract class GenericOrganizationForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener { public abstract class GenericOrganizationForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener {
/**
* ItemSelectionModel for the form section
*/
protected ItemSelectionModel m_itemModel; protected ItemSelectionModel m_itemModel;
/**
* SaveCancelSection (Save and Cancel buttons) for this sections.
*/
protected SaveCancelSection m_saveCancelSection; protected SaveCancelSection m_saveCancelSection;
private Label m_script = new Label("<script language=\"javascript\" src=\"/javascript/manipulate-input.js\"></script>"); private Label m_script = new Label("<script language=\"javascript\" src=\"/javascript/manipulate-input.js\"></script>");
/**
* Organizationname.
*/
public static final String ORGANIZATIONAME = GenericOrganization.ORGANIZATIONNAME; public static final String ORGANIZATIONAME = GenericOrganization.ORGANIZATIONNAME;
/**
* Addedum
*/
public static final String ORGANIZATIONNAMEADDENDUM = GenericOrganization.ORGANIZATIONNAMEADDENDUM; public static final String ORGANIZATIONNAMEADDENDUM = GenericOrganization.ORGANIZATIONNAMEADDENDUM;
/**
* Description
*/
public static final String DESCRIPTION = GenericOrganization.DESCRIPTION; public static final String DESCRIPTION = GenericOrganization.DESCRIPTION;
private static final Logger logger = Logger.getLogger(GenericOrganizationForm.class); 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) { public GenericOrganizationForm(String formName, ItemSelectionModel itemModel) {
super(new ColumnPanel(2)); super(new ColumnPanel(2));
@ -59,15 +80,25 @@ public abstract class GenericOrganizationForm extends FormSection implements For
addValidationListener(this); addValidationListener(this);
} }
/**
* Adds the SavaCancelSection.
*/
public void addSaveCancelSection() { public void addSaveCancelSection() {
m_saveCancelSection = new SaveCancelSection(); m_saveCancelSection = new SaveCancelSection();
add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
} }
/**
*
* @return The SaveCancelSection of the form section.
*/
public SaveCancelSection getSaveCancelSection() { public SaveCancelSection getSaveCancelSection() {
return m_saveCancelSection; return m_saveCancelSection;
} }
/**
* Adds the widgets to the form.
*/
protected void addWidgets() { protected void addWidgets() {
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationname"))); add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationname")));
TextField organizationName = new TextField(ORGANIZATIONAME); 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 process (FormSectionEvent e) throws FormProcessException;
public abstract void validate (FormSectionEvent e) throws FormProcessException; public abstract void validate (FormSectionEvent e) throws FormProcessException;
/**
* Inits the widgets.
*
* @param e
* @return
*/
public GenericOrganization initBasicWidgets(FormSectionEvent e) { public GenericOrganization initBasicWidgets(FormSectionEvent e) {
Assert.exists(m_itemModel, ItemSelectionModel.class); Assert.exists(m_itemModel, ItemSelectionModel.class);
@ -105,6 +142,12 @@ public abstract class GenericOrganizationForm extends FormSection implements For
return orga; return orga;
} }
/**
* Processes the widgets.
*
* @param e
* @return
*/
public GenericOrganization processBasicWidgets(FormSectionEvent e) { public GenericOrganization processBasicWidgets(FormSectionEvent e) {
Assert.exists(m_itemModel, ItemSelectionModel.class); Assert.exists(m_itemModel, ItemSelectionModel.class);
@ -121,6 +164,13 @@ public abstract class GenericOrganizationForm extends FormSection implements For
return orga; return orga;
} }
/**
* Creates a new organization.
*
* @param state
* @return
* @throws com.arsdigita.bebop.FormProcessException
*/
public GenericOrganization createGenericOrganization(PageState state) throws FormProcessException { public GenericOrganization createGenericOrganization(PageState state) throws FormProcessException {
Assert.exists(m_itemModel, ItemSelectionModel.class); Assert.exists(m_itemModel, ItemSelectionModel.class);

View File

@ -37,27 +37,75 @@ import com.arsdigita.util.Assert;
public class GenericOrganizationViewRoles extends ResettableContainer { public class GenericOrganizationViewRoles extends ResettableContainer {
/* Ids for the editing panels */ /* Ids for the editing panels */
/**
* Identifier for the table of roles
*/
public static final String ROLES_TABLE = "rolesTable"; public static final String ROLES_TABLE = "rolesTable";
/**
* Identifier for the role edit form
*/
public static final String ROLES_EDIT = "rolesEdit"; public static final String ROLES_EDIT = "rolesEdit";
/**
* Identifier for the role delete form
*/
public static final String ROLES_DELETE = "rolesDelete"; public static final String ROLES_DELETE = "rolesDelete";
/* class attributes */ /* class attributes */
/**
* Identifier for the data table
*/
public static final String DATA_TABLE = "dataTable"; public static final String DATA_TABLE = "dataTable";
/**
* Identifier for the action link
*/
public static final String ACTION_LINK = "actionLink"; public static final String ACTION_LINK = "actionLink";
/**
* The authoring wizard
*/
protected AuthoringKitWizard m_wizard; protected AuthoringKitWizard m_wizard;
/**
* ItemSelectionModel for the organization
*/
protected ItemSelectionModel m_selectionOrganization; protected ItemSelectionModel m_selectionOrganization;
/**
* ItemSelection for the role
*/
protected ItemSelectionModel m_selectionRole; protected ItemSelectionModel m_selectionRole;
/**
* ItemSelectionModel for moving the role position (currently not used)
*/
protected ItemSelectionModel m_moveRole; protected ItemSelectionModel m_moveRole;
/**
* Move parameter (not used yet)
*/
protected BigDecimalParameter m_moveParameter; protected BigDecimalParameter m_moveParameter;
/* Visual components doing the word */ /* Visual components doing the word */
/**
* Table with all roles associated with the organization.
*/
protected RoleTable m_roleTable; protected RoleTable m_roleTable;
/**
* Form for editing a role
*/
protected RoleEditForm m_roleEdit; protected RoleEditForm m_roleEdit;
/**
* Form for deleting a role
*/
protected RoleDeleteForm m_roleDelete; protected RoleDeleteForm m_roleDelete;
/**
* Begin link
*/
protected ActionLink m_beginLink; protected ActionLink m_beginLink;
private Label m_moveRoleLabel; private Label m_moveRoleLabel;
private String m_typeIdStr; private String m_typeIdStr;
/**
* Constructor.
*
* @param selOrga
* @param wizard
*/
public GenericOrganizationViewRoles(ItemSelectionModel selOrga, AuthoringKitWizard wizard) { public GenericOrganizationViewRoles(ItemSelectionModel selOrga, AuthoringKitWizard wizard) {
super(); super();
m_selectionOrganization = selOrga; m_selectionOrganization = selOrga;
@ -70,6 +118,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer {
add(buildRoleDelete(), false); add(buildRoleDelete(), false);
} }
/**
* Builds the table of roles.
*
* @return The table of roles.
*/
protected Container buildRoleTable() { protected Container buildRoleTable() {
ColumnPanel c = new ColumnPanel(1); ColumnPanel c = new ColumnPanel(1);
c.setKey(ROLES_TABLE + m_typeIdStr); c.setKey(ROLES_TABLE + m_typeIdStr);
@ -146,6 +199,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer {
return c; return c;
} }
/**
* Builds the edit form.
*
* @return The edit form.
*/
protected Container buildRoleEdit() { protected Container buildRoleEdit() {
ColumnPanel c = new ColumnPanel(1); ColumnPanel c = new ColumnPanel(1);
c.setKey(ROLES_EDIT + m_typeIdStr); c.setKey(ROLES_EDIT + m_typeIdStr);
@ -175,6 +233,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer {
return c; return c;
} }
/**
* Builds the delete form
*
* @return The delete form.
*/
protected Container buildRoleDelete() { protected Container buildRoleDelete() {
ColumnPanel c = new ColumnPanel(1); ColumnPanel c = new ColumnPanel(1);
c.setKey(ROLES_DELETE + m_typeIdStr); c.setKey(ROLES_DELETE + m_typeIdStr);
@ -197,6 +260,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer {
return c; return c;
} }
/**
* Builds the view all roles link.
*
* @return The ViewAllLink.
*/
protected ActionLink buildViewAllLink() { protected ActionLink buildViewAllLink() {
ActionLink viewAllLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.view_all_roles").localize()); ActionLink viewAllLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.view_all_roles").localize());
viewAllLink.setClassAttr(ACTION_LINK); viewAllLink.setClassAttr(ACTION_LINK);
@ -210,6 +278,11 @@ public class GenericOrganizationViewRoles extends ResettableContainer {
return viewAllLink; return viewAllLink;
} }
/**
* Builds the add link.
*
* @return The add link.
*/
protected ActionLink buildAddLink() { protected ActionLink buildAddLink() {
ActionLink addLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorgnization.add_new_role").localize()) { 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() { public String getTypeIdStr() {
return m_typeIdStr; return m_typeIdStr;
} }

View File

@ -19,6 +19,7 @@ import javax.servlet.ServletException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Panel for editing roles.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -30,6 +31,9 @@ public class OrganizationRolePanel extends SimpleComponent {
private boolean m_showAllRoles = false; private boolean m_showAllRoles = false;
//private static final String versionId = "$Id: OrganizationRolePanel.java 2009-06-01T10:42+02:00"; //private static final String versionId = "$Id: OrganizationRolePanel.java 2009-06-01T10:42+02:00";
/**
* Constructor.
*/
public OrganizationRolePanel() { public OrganizationRolePanel() {
super(); super();
} }
@ -41,9 +45,20 @@ public class OrganizationRolePanel extends SimpleComponent {
addGlobalStateParams(p); addGlobalStateParams(p);
} }
/**
* Adds a global state param. Not in use yet.
*
* @param p
*/
public void addGlobalStateParams(Page p) { public void addGlobalStateParams(Page p) {
} }
/**
*
* @param state
* @param item
* @return The XMLGenerator for the panel.
*/
protected XMLGenerator getXMLGenerator(PageState state, ContentItem item) { protected XMLGenerator getXMLGenerator(PageState state, ContentItem item) {
ContentSection section = null; ContentSection section = null;
@ -61,10 +76,21 @@ public class OrganizationRolePanel extends SimpleComponent {
return section.getXMLGenerator(); return section.getXMLGenerator();
} }
/**
* Sets the value of the showAllRoles property.
*
* @param showAll
*/
public void setShowAllRoles(boolean showAll) { public void setShowAllRoles(boolean showAll) {
this.m_showAllRoles = showAll; this.m_showAllRoles = showAll;
} }
/**
* Returns the current ContentItem.
*
* @param state
* @return
*/
protected ContentItem getContentItem(PageState state) { protected ContentItem getContentItem(PageState state) {
CMSContext context = CMS.getContext(); CMSContext context = CMS.getContext();
@ -75,6 +101,12 @@ public class OrganizationRolePanel extends SimpleComponent {
return context.getContentItem(); 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) { protected OrganizationRole[] getOrganizationRoles(ContentItem item, final PageState state) {
GenericOrganization orga = (GenericOrganization) item; GenericOrganization orga = (GenericOrganization) item;
OrganizationRoleCollection roles = orga.getOrganizationRoles(); OrganizationRoleCollection roles = orga.getOrganizationRoles();
@ -102,6 +134,13 @@ public class OrganizationRolePanel extends SimpleComponent {
generateXML(item, parent, state); 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) { public void generateXML(ContentItem item, Element element, PageState state) {
Element content = element.newChildElement("cms:organizationRolePanel", CMS.CMS_XML_NS); Element content = element.newChildElement("cms:organizationRolePanel", CMS.CMS_XML_NS);
exportAttributes(content); 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) { protected void generateRoleXML(final PageState state, final Element parent, final ContentItem role, final XMLGenerator xmlGenerator) {
CMSExcursion excursion = new CMSExcursion() { CMSExcursion excursion = new CMSExcursion() {
@ -133,6 +180,3 @@ public class OrganizationRolePanel extends SimpleComponent {
} }
} }
} }

View File

@ -18,17 +18,33 @@ import com.arsdigita.util.Assert;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Form for deleting a role.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class RoleDeleteForm extends Form implements FormInitListener, FormSubmissionListener, FormProcessListener { public class RoleDeleteForm extends Form implements FormInitListener, FormSubmissionListener, FormProcessListener {
private static final Logger logger = Logger.getLogger(RoleDeleteForm.class); private static final Logger logger = Logger.getLogger(RoleDeleteForm.class);
/**
* ItemSelectionModel for the organization.
*/
protected ItemSelectionModel m_selectionOrganization; protected ItemSelectionModel m_selectionOrganization;
/**
* ItemSelectionModle for the role
*/
protected ItemSelectionModel m_selectionRole; protected ItemSelectionModel m_selectionRole;
/**
* SaveCancelSection of this form
*/
protected SaveCancelSection m_saveCancelSection; protected SaveCancelSection m_saveCancelSection;
private Label m_roleNameLabel; private Label m_roleNameLabel;
/**
* Constructor.
*
* @param selectionOrganization
* @param selectionRole
*/
public RoleDeleteForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) { public RoleDeleteForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) {
super("RoleDeleteForm", new ColumnPanel(2)); super("RoleDeleteForm", new ColumnPanel(2));
@ -51,6 +67,11 @@ public class RoleDeleteForm extends Form implements FormInitListener, FormSubmis
addProcessListener(this); addProcessListener(this);
} }
/**
* Adds the SaveCancelSection of this form.
*
* @return
*/
protected SaveCancelSection addSaveCancelSection() { protected SaveCancelSection addSaveCancelSection() {
m_saveCancelSection = new SaveCancelSection(); m_saveCancelSection = new SaveCancelSection();
m_saveCancelSection.getSaveButton().setButtonLabel("Delete"); m_saveCancelSection.getSaveButton().setButtonLabel("Delete");

View File

@ -25,6 +25,7 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Form for editing a role.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -40,12 +41,28 @@ public class RoleEditForm extends Form {
private SaveCancelSection m_saveCancelSection; 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) { public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) {
this(selectionOrganization, selectionRole, null); this(selectionOrganization, selectionRole, null);
} }
/**
* Constructor.
*
* @param selectionOrganization
* @param selectionRole
* @param container
*/
public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole, GenericOrganizationViewRoles container) { public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole, GenericOrganizationViewRoles container) {
super("RoleEditForm", new ColumnPanel(2)); super("RoleEditForm", new ColumnPanel(2));
@ -71,16 +88,28 @@ public class RoleEditForm extends Form {
addProcessListener(new RoleProcessListener()); addProcessListener(new RoleProcessListener());
} }
/**
* Adds the SaveCancelSection to the form.
*
* @return
*/
protected SaveCancelSection addSaveCancelSection() { protected SaveCancelSection addSaveCancelSection() {
m_saveCancelSection = new SaveCancelSection(); m_saveCancelSection = new SaveCancelSection();
add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
return m_saveCancelSection; return m_saveCancelSection;
} }
/**
*
* @return The SaveCancelSection of this form.
*/
public SaveCancelSection getSaveCancelSection() { public SaveCancelSection getSaveCancelSection() {
return m_saveCancelSection; return m_saveCancelSection;
} }
/**
* Adds the widgets to the form.
*/
protected void addWidgets() { protected void addWidgets() {
logger.info("Adding widgets for role form..."); logger.info("Adding widgets for role form...");
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.rolename"))); 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) { protected OrganizationRole createRole(FormSectionEvent event, GenericOrganization orga) {
logger.info("creating new role..."); logger.info("creating new role...");

View File

@ -26,6 +26,7 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Table listing all Roles associated with a organization.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
@ -34,14 +35,32 @@ public class RoleTable extends Table {
private final static Logger logger = Logger.getLogger(RoleTable.class); private final static Logger logger = Logger.getLogger(RoleTable.class);
// columns headings // columns headings
/**
* Heading for first column
*/
public static final String COL_TITLE = "Role"; public static final String COL_TITLE = "Role";
/**
* Heading for second column
*/
public static final String COL_EDIT = "Edit"; public static final String COL_EDIT = "Edit";
/**
* Heading for third column
*/
public static final String COL_MOVE = "Move"; public static final String COL_MOVE = "Move";
/**
* Heading for last column
*/
public static final String COL_DEL = "Delete"; public static final String COL_DEL = "Delete";
private ItemSelectionModel m_selectionOrganization; private ItemSelectionModel m_selectionOrganization;
private ItemSelectionModel m_selectionRole; private ItemSelectionModel m_selectionRole;
private ItemSelectionModel m_moveRole; private ItemSelectionModel m_moveRole;
/**
* Constructor.
*
* @param selOrga
* @param moveRole
*/
public RoleTable(ItemSelectionModel selOrga, ItemSelectionModel moveRole) { public RoleTable(ItemSelectionModel selOrga, ItemSelectionModel moveRole) {
super(); super();
m_selectionOrganization = selOrga; m_selectionOrganization = selOrga;
@ -91,6 +110,11 @@ public class RoleTable extends Table {
} }
/**
* Sets the ItemSelectionModel.
*
* @param itemModel
*/
public void setRoleModel(ItemSelectionModel itemModel) { public void setRoleModel(ItemSelectionModel itemModel) {
if (itemModel == null) { if (itemModel == null) {
logger.warn("null item model"); logger.warn("null item model");
@ -98,11 +122,26 @@ public class RoleTable extends Table {
m_selectionRole = itemModel; m_selectionRole = itemModel;
} }
/**
* Builder class for the table model.
*/
protected class RoleTableModelBuilder extends LockableImpl implements TableModelBuilder { protected class RoleTableModelBuilder extends LockableImpl implements TableModelBuilder {
/**
* ItemSelectionModel for the organization.
*/
protected ItemSelectionModel m_selectionOrganization; protected ItemSelectionModel m_selectionOrganization;
/**
* ItemSelectionModel for moving the role (feature not implemented yet)
*/
protected ItemSelectionModel m_moveRole; protected ItemSelectionModel m_moveRole;
/**
* Constructor.
*
* @param selectionOrganization
* @param moveRole
*/
public RoleTableModelBuilder(ItemSelectionModel selectionOrganization, ItemSelectionModel moveRole) { public RoleTableModelBuilder(ItemSelectionModel selectionOrganization, ItemSelectionModel moveRole) {
m_selectionOrganization = selectionOrganization; m_selectionOrganization = selectionOrganization;
m_moveRole = moveRole; m_moveRole = moveRole;
@ -117,6 +156,9 @@ public class RoleTable extends Table {
} }
} }
/**
* TableModel for the RoleTable.
*/
protected class RoleTableModel implements TableModel { protected class RoleTableModel implements TableModel {
private TableColumnModel m_colModel; private TableColumnModel m_colModel;
@ -126,6 +168,14 @@ public class RoleTable extends Table {
private ItemSelectionModel m_moveRole; private ItemSelectionModel m_moveRole;
private OrganizationRole m_role; private OrganizationRole m_role;
/**
* Constructor.
*
* @param table
* @param state
* @param orga
* @param moveRole
*/
public RoleTableModel(Table table, PageState state, GenericOrganization orga, ItemSelectionModel moveRole) { public RoleTableModel(Table table, PageState state, GenericOrganization orga, ItemSelectionModel moveRole) {
m_colModel = table.getColumnModel(); m_colModel = table.getColumnModel();
m_table = (RoleTable) table; 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 { public class RoleTableCellRenderer extends LockableImpl implements TableCellRenderer {
private boolean m_active; private boolean m_active;
/**
* Constructor.
*/
public RoleTableCellRenderer() { public RoleTableCellRenderer() {
this(false); this(false);
} }
/**
* Constructor.
*
* @param active
*/
public RoleTableCellRenderer(boolean active) { public RoleTableCellRenderer(boolean active) {
m_active = active; m_active = active;
} }

View File

@ -793,6 +793,16 @@ public final class ContentSectionConfig extends AbstractConfig {
return (String)get(m_categoryTreeOrdering); 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() { public boolean getHasContactsAuthoringStep() {
return ((Boolean) get(m_hasContactsAuthoringStep)).booleanValue(); return ((Boolean) get(m_hasContactsAuthoringStep)).booleanValue();
} }