Author: pboy Date: 2012-12-17 08:45:13 +0000 (Mon, 17 Dec 2012) New Revision: 2399 Modified: releases/2.0.0/ccm-cms-types-image/src/com/arsdigita/cms/contenttypes/ui/ImagePropertyForm.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEdit.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java Log: Backport trunk revision r2389, r2393 (super.validate for classes inheriting from BasicPageForm) (on behalf of JensP) Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -149,6 +149,9 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { + //Calling super.validate(e) here causes an exception because the super method checks things which not available + //here. + final PageState state = e.getPageState(); final FormData data = e.getFormData(); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -179,6 +179,9 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { + //Calling super.validate(e) here causes an exception because the super method checks things which not available + //here. + final PageState state = e.getPageState(); final FormData data = e.getFormData(); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -125,8 +125,10 @@ } @Override - public void validate(final FormSectionEvent fse) - throws FormProcessException { + public void validate(final FormSectionEvent fse) throws FormProcessException { + //We don't call super.validate(fse) here because the super method checks for things which are not available + //here, causing an exception. + final PageState state = fse.getPageState(); final FormData data = fse.getFormData(); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -72,7 +72,11 @@ } } - // Validate: ensure name uniqueness + /** + * Ensure name uniqueness. Note: We can't call {@code super.validate(FormSectionEvent)} here + * because the super method {@link BasicPageForm#validate(com.arsdigita.bebop.event.FormSectionEvent)} tries + * to access things which on existing yet. + */ @Override public void validate(FormSectionEvent e) throws FormProcessException { Folder f = m_parent.getFolder(e.getPageState()); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -34,7 +34,6 @@ import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.util.Assert; import java.util.Date; - import org.apache.log4j.Logger; /** @@ -48,8 +47,6 @@ public class PageCreate extends BasicPageForm implements FormSubmissionListener, CreationComponent { - private static final Logger s_log = Logger.getLogger(PageCreate.class); - protected final CreationSelector m_parent; protected ApplyWorkflowFormSection m_workflowSection; @@ -105,13 +102,17 @@ return m_workflowSection; } - // Init: create a new item id + /** create a new item id + * + */ public void init(FormSectionEvent e) throws FormProcessException { // this is currently a no-op } - // Submission: If the Cancel button was pressed, hide self and - // show the display component + /** + * If the Cancel button was pressed, hide self and + * show the display component + */ public void submitted(FormSectionEvent e) throws FormProcessException { PageState state = e.getPageState(); @@ -124,12 +125,18 @@ } } - // Validate: ensure name uniqueness + /** + * Validate inputs to ensure name uniqueness. Note: We can't call {@code super.validate(FormSectionEvent)} here + * because the super method {@link BasicPageForm#validate(com.arsdigita.bebop.event.FormSectionEvent)} tries + * to access things which on existing yet. + * + * @param event + */ @Override - public void validate(FormSectionEvent e) throws FormProcessException { - Folder f = m_parent.getFolder(e.getPageState()); - Assert.exists(f); - validateNameUniqueness(f, e); + public void validate(final FormSectionEvent event) throws FormProcessException { + final Folder folder = m_parent.getFolder(event.getPageState()); + Assert.exists(folder); + validateNameUniqueness(folder, event); } // Process: save fields to the database Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEdit.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEdit.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEdit.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -135,6 +135,8 @@ } public void validate(FormSectionEvent event) throws FormProcessException { + super.validate(event); + PageState state = event.getPageState(); FormData data = event.getFormData(); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -582,6 +582,8 @@ * confirms this was the same item to be edited */ public void validate(FormSectionEvent event) throws FormProcessException { + super.validate(event); + PageState state = event.getPageState(); FormData data = event.getFormData(); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -18,7 +18,6 @@ */ package com.arsdigita.cms.ui.templates; - import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; @@ -133,7 +132,8 @@ } public void validate(FormSectionEvent event) throws FormProcessException { - super.validate(event); + //Calling super.validate(e) here causes an exception because the super method checks things which not available + //here. PageState state = event.getPageState(); FormData data = event.getFormData(); @@ -155,6 +155,6 @@ Assert.exists(t); return t; } + } - } Modified: releases/2.0.0/ccm-cms-types-image/src/com/arsdigita/cms/contenttypes/ui/ImagePropertyForm.java =================================================================== --- releases/2.0.0/ccm-cms-types-image/src/com/arsdigita/cms/contenttypes/ui/ImagePropertyForm.java 2012-12-17 08:13:51 UTC (rev 2398) +++ releases/2.0.0/ccm-cms-types-image/src/com/arsdigita/cms/contenttypes/ui/ImagePropertyForm.java 2012-12-17 08:45:13 UTC (rev 2399) @@ -206,6 +206,8 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { + super.validate(e); + FormData d = e.getFormData(); } |