From ab9f8323f4ace4b01dd482d0f8a63c3e8ad343f4 Mon Sep 17 00:00:00 2001 From: jensp Date: Sat, 25 Feb 2017 17:06:13 +0000 Subject: [PATCH] CCM NG: Fixed several JavaDoc warnings. git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4601 8810af33-2d31-482b-a856-94f89814c4df --- ccm-core/pom.xml | 2 +- .../bebop/AbstractSingleSelectionModel.java | 3 +- .../java/com/arsdigita/bebop/BaseLink.java | 305 ++++++++++-------- .../java/com/arsdigita/bebop/ControlLink.java | 86 ++--- .../arsdigita/bebop/DescriptiveComponent.java | 2 +- .../com/arsdigita/bebop/SimpleComponent.java | 141 ++++---- .../arsdigita/bebop/SingleSelectionModel.java | 7 +- .../kernel/security/SecurityHelper.java | 4 +- .../kernel/ui/ACSObjectSelectionModel.java | 61 +--- .../java/com/arsdigita/util/Lockable.java | 2 +- .../tests/categories/IntegrationTest.java | 2 + .../libreccm/tests/categories/UnitTest.java | 2 + .../libreccm/testutils/DatasetsVerifier.java | 3 +- .../libreccm/testutils/EqualsVerifier.java | 6 +- .../libreccm/testutils/ToStringVerifier.java | 6 +- 15 files changed, 327 insertions(+), 305 deletions(-) diff --git a/ccm-core/pom.xml b/ccm-core/pom.xml index 08042a16f..b4516bbd1 100644 --- a/ccm-core/pom.xml +++ b/ccm-core/pom.xml @@ -934,7 +934,7 @@ - + diff --git a/ccm-core/src/main/java/com/arsdigita/bebop/AbstractSingleSelectionModel.java b/ccm-core/src/main/java/com/arsdigita/bebop/AbstractSingleSelectionModel.java index dca4ae8e1..5dd69ade0 100755 --- a/ccm-core/src/main/java/com/arsdigita/bebop/AbstractSingleSelectionModel.java +++ b/ccm-core/src/main/java/com/arsdigita/bebop/AbstractSingleSelectionModel.java @@ -26,7 +26,6 @@ import com.arsdigita.bebop.event.EventListenerList; import com.arsdigita.util.Assert; import com.arsdigita.util.Lockable; -import java.util.stream.Stream; /** * A standard implementation of SingleSelectionModel and @@ -35,7 +34,7 @@ import java.util.stream.Stream; * * jensp: Added generics and Java 8 streams instead of using an iterator. * - * @param + * @param The type managed by the parameter model. * * @author Unknown * @author Jens Pelzetter (jensp) diff --git a/ccm-core/src/main/java/com/arsdigita/bebop/BaseLink.java b/ccm-core/src/main/java/com/arsdigita/bebop/BaseLink.java index 7f0127a9e..a09484ace 100755 --- a/ccm-core/src/main/java/com/arsdigita/bebop/BaseLink.java +++ b/ccm-core/src/main/java/com/arsdigita/bebop/BaseLink.java @@ -30,70 +30,76 @@ import java.util.TooManyListenersException; * The parent of all Bebop Link classes, this class represents a URL on a page. * It may contain a label, an image, or any other component. * - *

The following table lists all Bebop Link classes and suggests - * when they might be used. + *

+ * The following table lists all Bebop Link classes and suggests when they might + * be used. *

* * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * * * - * - * + * + * * *
Link ClassUsageLink ClassUsage
{@link BaseLink}Parent class of Bebop Link classes. Extend this class to - * build your own Link class.{@link BaseLink}Parent class of Bebop Link classes. Extend this class to build your own + * Link class.
{@link Link}Link class that manages its own URL variables. Session information - * is added to the target URL for this type.{@link Link}Link class that manages its own URL variables. Session information is + * added to the target URL for this type.
{@link ExternalLink}Link that does not encode the URL with any session information. - * Used for a link to a page outside the site.{@link ExternalLink}Link that does not encode the URL with any session information. Used for + * a link to a page outside the site.
{@link ControlLink} Used for references within its own page (often - * as fields in a table header for sorting a column).{@link ControlLink} Used for references within its own page (often as fields in a table + * header for sorting a column).
{@link ActionLink}Sets its own control event and runs its own + * {@link ActionLink}Sets its own control event and runs its own * {@link com.arsdigita.bebop.event.ActionListener}s. When the link is clicked, * the code in the Listener's actionPerformed method runs.
{@link ToggleLink}A link that turns into label when it is selected and - * turns back into a link when it is unselected.{@link ToggleLink}A link that turns into label when it is selected and turns back into a + * link when it is unselected.
* * @version $Id: BaseLink.java 998 2005-11-15 22:27:13Z sskracic $ */ public abstract class BaseLink extends DescriptiveComponent - implements Cloneable { + implements Cloneable { - /** The name of the attribute used in XML to indicate which type of link - * this link represents. */ + /** + * The name of the attribute used in XML to indicate which type of link this + * link represents. + */ private final static String TYPE_ATTR = "type"; private final static String HREF_NO_JAVASCRIPT = "href_no_javascript"; private final static String HREF = "href"; - /** Component used to display the link. Typically a Label, may be - * e.g. an image as well. */ + /** + * Component used to display the link. Typically a Label, may be e.g. an + * image as well. + */ protected Component m_child; - /** Property to store the url the Link points to. */ + /** + * Property to store the url the Link points to. + */ protected String m_url; // Use the parent class' property! // /** Property to store informational text for the user about the Link, e.g. // * how to use it, or when to use it (or not to use it). */ // private GlobalizedMessage m_hint; - protected String m_noJavascriptURL = null; private PrintListener m_printListener; @@ -102,15 +108,16 @@ public abstract class BaseLink extends DescriptiveComponent private GlobalizedMessage m_confirmMsg; /** - * Constructor creates a link taking url as the target and display it to - * the user at the same time. It is the only allowed way to present the - * user with a not globlized information. The implementation currently - * miss-uses the Label component to display just a not globalized String - * which is deprecated. + * Constructor creates a link taking url as the target and display it to the + * user at the same time. It is the only allowed way to present the user + * with a not globlized information. The implementation currently miss-uses + * the Label component to display just a not globalized String which is + * deprecated. * * @param url + * * @deprecated use BaseLink(Component,url) instead with a Label using a - * GlobalizedMessage instead + * GlobalizedMessage instead */ public BaseLink(final String url) { this(new Label(url), url); @@ -120,7 +127,7 @@ public abstract class BaseLink extends DescriptiveComponent * Constructor * * @param child display component (Label, Image, etc.) - * @param url URL to point at + * @param url URL to point at */ public BaseLink(final Component child, final String url) { super(); @@ -131,7 +138,7 @@ public abstract class BaseLink extends DescriptiveComponent /** * Constructor. * - * @param child display component (Label, Image, etc.) + * @param child display component (Label, Image, etc.) * @param listener PrintListener, may be used to change either the Display * text or the url within a locked page. */ @@ -141,7 +148,8 @@ public abstract class BaseLink extends DescriptiveComponent addPrintListener(listener); } catch (TooManyListenersException e) { // Can't happen - throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e); + throw new UncheckedWrapperException("Too many listeners: " + e + .getMessage(), e); } } @@ -155,14 +163,14 @@ public abstract class BaseLink extends DescriptiveComponent } // DEPRECATED constructors - /** * Constructor. * * @param label as text * @param url + * * @deprecated use BaseLink(Component,url) instead with a Label using a - * GlobalizedMessage instead + * GlobalizedMessage instead */ public BaseLink(final String label, final String url) { this(new Label(label), url); @@ -171,22 +179,24 @@ public abstract class BaseLink extends DescriptiveComponent /** * Constructor. * - * @param label as text + * @param label as text * @param listener PrintListener, may be used to change either the Display * text or the url within a locked page. - * @deprecated use BaseLink(Component,listener) instead with a Label using - * a GlobalizedMessage instead + * + * @deprecated use BaseLink(Component,listener) instead with a Label using a + * GlobalizedMessage instead */ public BaseLink(final String label, final PrintListener listener) { this(new Label(label), listener); } // Class Methods - /** - * Clone. - * @return - * @throws CloneNotSupportedException + * Clone. + * + * @return The clone of the object. + * + * @throws CloneNotSupportedException If cloning is not supported. */ @Override public Object clone() throws CloneNotSupportedException { @@ -196,54 +206,61 @@ public abstract class BaseLink extends DescriptiveComponent } /** - * Adds a print listener. - * Since the PrintListener is expected to modify the target - * of the PrintEvent, only one print listener can be set - * for a link. - * + * Adds a print listener. Since the PrintListener is expected + * to modify the target of the PrintEvent, only one print + * listener can be set for a link. + * * @param listener The print listener. Must not null. - * @throws IllegalArgumentException if listener is null. + * + * @throws IllegalArgumentException if listener is null. * @throws TooManyListenersException if a print listener has previously been - * added. + * added. */ public void addPrintListener(final PrintListener listener) - throws IllegalStateException, TooManyListenersException { + throws IllegalStateException, TooManyListenersException { if (listener == null) { - throw new IllegalArgumentException("Argument listener can not be null"); + throw new IllegalArgumentException( + "Argument listener can not be null"); } if (m_printListener != null) { - throw new TooManyListenersException("Too many listeners. Can only have one"); + throw new TooManyListenersException( + "Too many listeners. Can only have one"); } m_printListener = listener; } /** * Removes a previously added print listener. If the passed in - * listener is not the listener that was added with - * {@link #addPrintListener addPrintListener}, an IllegalArgumentException + * listener is not the listener that was added with + * {@link #addPrintListener addPrintListener}, an IllegalArgumentException * will be thrown. * - * @param listener The listener that was previously added with - * addPrintListener. - * Must not be null. - * @throws IllegalArgumentException if listener is not the - * currently registered print listener or is null. + * @param listener The listener that was previously added with + * addPrintListener. Must not be + * null. + * + * @throws IllegalArgumentException if listener is not the + * currently registered print listener or + * is null. */ public void removePrintListener(final PrintListener listener) - throws IllegalArgumentException { + throws IllegalArgumentException { if (listener == null) { throw new IllegalArgumentException("listener can not be null"); } if (listener != m_printListener) { - throw new IllegalArgumentException("listener is not registered with this widget"); + throw new IllegalArgumentException( + "listener is not registered with this widget"); } m_printListener = null; } /** - * - * @param state - * @return + * Execute the {@link PrintListener} assigned to the link. + * + * @param state The current page state + * + * @return The base link after all {@link PrintListener} have been executed. */ protected BaseLink firePrintEvent(final PageState state) { BaseLink l = this; @@ -260,9 +277,9 @@ public abstract class BaseLink extends DescriptiveComponent } /** - * Retrieves the label component used to display the Link. Typically a Label, - * but may be an other type, e.g. an Image, as well. - * + * Retrieves the label component used to display the Link. Typically a + * Label, but may be an other type, e.g. an Image, as well. + * * @return Component used to display the Link. */ public final Component getChild() { @@ -275,24 +292,26 @@ public abstract class BaseLink extends DescriptiveComponent } /** - * Use a GlobalizedMessage to be used to display the link. It's primary - * purpose is to hide the parent class' method to prevent its usage because - * Labels and GlobalizedMessages are used here differently (a + * Use a GlobalizedMessage to be used to display the link. It's primary + * purpose is to hide the parent class method to prevent its usage because + * Labels and GlobalizedMessages are used here differently (a * GlobalizedMessage is here not directly used as a Label by specifying it - * as an attribugte, inside a Label component). - * @param message + * as an attribute, inside a Label component). + * + * @param message The text to show. */ @Override - public void setLabel(final GlobalizedMessage message) { + public void setLabel(final GlobalizedMessage message) { Assert.isUnlocked(this); Label label = new Label(message); - setChild( (Component)label); + setChild((Component) label); } /** - * - * @return + * Get the target of the link. + * + * @return The target URL of the link. */ public final String getTarget() { return m_url; @@ -315,40 +334,42 @@ public abstract class BaseLink extends DescriptiveComponent } /** - * - * @param state - * @param parent + * Generate the URL for the link. + * + * @param state The current {@link PageState}. + * @param parent The parent element of the link. */ - protected abstract void generateURL(final PageState state, final Element parent); + protected abstract void generateURL(final PageState state, + final Element parent); /** - *

Generates a DOM fragment: - *

-     * <bebop:link href="..." type="..." %bebopAttr;/>
+     * Generates a DOM fragment:
+     *
+     * 
+     * <bebop:link href="..." type="..." %bebopAttr;/>
      * 
- * The href attribute contains the target the link should point - * to. The type attribute is used to give more fine grained - * control over which kind of link this element represents. The types are - * link for a Link, control for a - * {@link ControlLink}, and toggle for a {@link ToggleLink}. - * There may be additional attributes depending on what type of link this - * link represents. - * + * + * The {@code href} attribute contains the target the link should point to. + * The {@code type} attribute is used to give more fine grained control over + * which kind of link this element represents. The types are {@code link} + * for a {@code Link}, {@code control} for a {@link ControlLink}. There may + * be additional attributes depending on what type of link this link + * represents. + * * @see ControlLink#generateXML - * @see ToggleLink#generateXML - * - * @param state The current {@link PageState}. + * + * @param state The current {@link PageState}. * @param parent The XML element to attach the XML to. */ @Override public void generateXML(final PageState state, final Element parent) { if (isVisible(state)) { BaseLink target = firePrintEvent(state); - + Element link = parent.newChildElement("bebop:link", BEBOP_XML_NS); - + target.generateURL(state, link); - target.exportConfirmAttributes(state, link); + target.exportConfirmAttributes(state, link); //setup the link without javascript target.setupNoJavascriptURL(state, link); target.exportAttributes(link); @@ -359,10 +380,11 @@ public abstract class BaseLink extends DescriptiveComponent } /** - * + * * @param state * @param sUrl - * @return + * + * @return */ private String getAbsoluteUrl(final PageState state, final String sUrl) { String sReturn = ""; @@ -397,14 +419,16 @@ public abstract class BaseLink extends DescriptiveComponent /** * Sets up no-JavaScript fallback HTML * - * @param state The current {@link PageState}. - * @param link The link element. + * @param state The current {@link PageState}. + * @param link The link element. */ - protected void setupNoJavascriptURL(final PageState state, final Element link) { + protected void setupNoJavascriptURL(final PageState state, + final Element link) { String sURL = null; if (m_sConfirmMsg.length() > 0 - || (m_confirmMsg != null && m_confirmMsg.localize().toString().length() > 0)) { + || (m_confirmMsg != null && m_confirmMsg.localize().toString() + .length() > 0)) { //if we want the confirm link, create the link String sOkUrl = getAbsoluteUrl(state, link.getAttribute(HREF)); @@ -416,9 +440,11 @@ public abstract class BaseLink extends DescriptiveComponent } if (m_sConfirmMsg.length() > 0) { - sURL = ConfirmPage.getConfirmUrl(m_sConfirmMsg, sOkUrl, sCancelUrl); + sURL = ConfirmPage.getConfirmUrl(m_sConfirmMsg, sOkUrl, + sCancelUrl); } else if (m_confirmMsg != null) { - sURL = ConfirmPage.getConfirmUrl(m_confirmMsg.localize().toString(), sOkUrl, sCancelUrl); + sURL = ConfirmPage.getConfirmUrl(m_confirmMsg.localize() + .toString(), sOkUrl, sCancelUrl); } } else { @@ -435,15 +461,16 @@ public abstract class BaseLink extends DescriptiveComponent } /** - * Adds type-specific XML attributes to the XML element representing - * this link. Subclasses should override this method if they introduce - * more attributes than the ones {@link #generateXML generateXML} - * produces by default. + * Adds type-specific XML attributes to the XML element representing this + * link. Subclasses should override this method if they introduce more + * attributes than the ones {@link #generateXML generateXML} produces by + * default. * * @param state The current request - * @param link The XML element representing this link + * @param link The XML element representing this link */ - protected void generateExtraXMLAttributes(final PageState state, final Element link) { + protected void generateExtraXMLAttributes(final PageState state, + final Element link) { } /** @@ -451,8 +478,8 @@ public abstract class BaseLink extends DescriptiveComponent * protection for this link. Not for confirmation messages; Should call * setConfirmation for that. * - * @param value The confirmation link. To not use the value {@code return confirm(} with this - * method. + * @param value The confirmation link. To not use the value + * {@code return confirm(} with this method. * * @see #setConfirmation */ @@ -461,8 +488,8 @@ public abstract class BaseLink extends DescriptiveComponent //use setConfirmation() instead, or else the javascript will break if (value != null) { Assert.isTrue(!value.toLowerCase().startsWith("return confirm("), - "Do not use setOnClick() to set confirmation messages. " - + "Use setCofirmation() instead."); + "Do not use setOnClick() to set confirmation messages. " + + "Use setCofirmation() instead."); } setAttribute(ON_CLICK, value); @@ -470,17 +497,17 @@ public abstract class BaseLink extends DescriptiveComponent /** * Forces the user to click through a confirmation dialog before this link - * is followed. The user is prompted with the specified message. If the - * user does not does not confirm, the link is not followed. The current + * is followed. The user is prompted with the specified message. If the user + * does not does not confirm, the link is not followed. The current * implementation uses the JavaScript confirm function and the onClick - * attribute. - * If JavaScript is not enabled in the client browser, this method will - * redirect the browser to a Bebop confirmation page rather than use - * a JavaScript confirmation. - * Subsequent calls to setOnClick will undo the effect of this method. + * attribute. If JavaScript is not enabled in the client browser, this + * method will redirect the browser to a Bebop confirmation page rather than + * use a JavaScript confirmation. Subsequent calls to setOnClick will undo + * the effect of this method. * * @param message the confirmation message presented to the user. This - * message cannot have an apostrophe or back slash. + * message cannot have an apostrophe or back slash. + * * @deprecated Use setConfirmation(final GlobalizedMessage msg) instead */ public void setConfirmation(final String message) { @@ -488,9 +515,10 @@ public abstract class BaseLink extends DescriptiveComponent //or back slashes if (Assert.isEnabled()) { - final boolean isGoodMessage = message.indexOf("'") == -1 && message.indexOf("\\") == -1; + final boolean isGoodMessage = message.indexOf("'") == -1 && message + .indexOf("\\") == -1; Assert.isTrue(isGoodMessage, - "confirmation message cannot contain apostrophe or back slash"); + "confirmation message cannot contain apostrophe or back slash"); } m_sConfirmMsg = message; @@ -498,7 +526,8 @@ public abstract class BaseLink extends DescriptiveComponent /** * Set a GlobalizedMessage as confirmation message - * @param msg + * + * @param msg The text to show for confirming. */ public void setConfirmation(final GlobalizedMessage msg) { m_confirmMsg = msg; @@ -506,11 +535,12 @@ public abstract class BaseLink extends DescriptiveComponent /** * Generate XML output for confirmation links - * + * * @param state PageState - * @param link Parent element + * @param link Parent element */ - private void exportConfirmAttributes(final PageState state, final Element link) { + private void exportConfirmAttributes(final PageState state, + final Element link) { // If a confirmation message is set if (m_sConfirmMsg.length() > 0 || m_confirmMsg != null) { @@ -522,13 +552,15 @@ public abstract class BaseLink extends DescriptiveComponent if (m_sConfirmMsg.length() > 0) { // then set the onclick attribute for the link with the static message - link.addAttribute(ON_CLICK, "return confirm(\\'" + m_sConfirmMsg + "\\');"); + link.addAttribute(ON_CLICK, "return confirm(\\'" + m_sConfirmMsg + + "\\');"); - // else if m_configMsg is set + // else if m_configMsg is set } else if (m_confirmMsg != null) { //then set the onclick attribute for the link with a globalized message - link.addAttribute(ON_CLICK, "return confirm(\\'" + m_confirmMsg.localize() + "\\');"); + link.addAttribute(ON_CLICK, "return confirm(\\'" + m_confirmMsg + .localize() + "\\');"); } } @@ -542,4 +574,5 @@ public abstract class BaseLink extends DescriptiveComponent public final String getNoJavascriptTarget() { return m_noJavascriptURL; } + } diff --git a/ccm-core/src/main/java/com/arsdigita/bebop/ControlLink.java b/ccm-core/src/main/java/com/arsdigita/bebop/ControlLink.java index 0e844ae1e..df578523a 100755 --- a/ccm-core/src/main/java/com/arsdigita/bebop/ControlLink.java +++ b/ccm-core/src/main/java/com/arsdigita/bebop/ControlLink.java @@ -34,16 +34,18 @@ import com.arsdigita.xml.Element; * com.arsdigita.bebop.table.TableCellRenderer}, where the list or table has * already set up the events 'tight' for the control link to do the right thing. * - *

Warning: Even though a control link lets you add action - * listeners, they are not run unless you override {@link #setControlEvent + *

+ * Warning: Even though a control link lets you add action listeners, + * they are not run unless you override {@link #setControlEvent * setControlEvent}. If you need this behavior, you should use an {@link - * ActionLink}. A control link is hardly ever useful unless it is contained - * in an event-generating component like {@link List} or {@link Table}. + * ActionLink}. A control link is hardly ever useful unless it is contained in + * an event-generating component like {@link List} or {@link Table}. * - *

Example: A control link is mainly useful to send events to other + *

+ * Example: A control link is mainly useful to send events to other * components. For example, the following control link will cause a control - * event delete with associated value 42 to be sent to - * the component fooComponent when the user clicks on it: + * event delete with associated value 42 to be sent to the + * component fooComponent when the user clicks on it: * *

  *    ControlLink l = new ControlLink("click here") {
@@ -53,17 +55,18 @@ import com.arsdigita.xml.Element;
  *    };
  * 
* - *

This requires that fooComponent is part of the page - * hierarchy. The control link l does not have to be part of the - * page hierarchy, and may be generated on the fly. (See - * {@link PageState} for details on control events.) + *

+ * This requires that fooComponent is part of the page hierarchy. The + * control link l does not have to be part of the page hierarchy, and + * may be generated on the fly. (See {@link PageState} for details on control + * events.) * - *

See {@link BaseLink} for a description - * of all Bebop Link classes. + *

+ * See {@link BaseLink} for a description of all Bebop Link classes. * - * @author Stanislav Freidin - * @author David Lutterkort - * @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $ + * @author Stanislav Freidin + * @author David Lutterkort + * @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $ */ public class ControlLink extends BaseLink { @@ -73,14 +76,14 @@ public class ControlLink extends BaseLink { protected final String TYPE_CONTROL = "control"; /** - * A list of all action listeners. The list is instantiated lazily, and - * will therefore be null in most applications. + * A list of all action listeners. The list is instantiated lazily, and will + * therefore be null in most applications. */ private ArrayList m_actionListeners; /** - * Constructs a new ControlLink. The link will encapsulates - * the child component (which should be a label or an image). + * Constructs a new ControlLink. The link will encapsulates the child + * component (which should be a label or an image). * * @param child the component that will be turned into a link */ @@ -99,41 +102,43 @@ public class ControlLink extends BaseLink { } /** - * Adds an ActionListener, which will be run when {@link - * #respond respond} is called. - * @param 1 a listener to add + * Adds an ActionListener, which will be run when + * {@link#respond respond} is called. + * + * @param listener The listener to add. * - * @pre l != null - * @pre ! isLocked() * @see #respond respond */ - public void addActionListener(ActionListener l) { + public void addActionListener(ActionListener listener) { Assert.isUnlocked(this); - if ( m_actionListeners == null ) { + if (m_actionListeners == null) { m_actionListeners = new ArrayList(); } - m_actionListeners.add(l); + m_actionListeners.add(listener); } /** * Removes a previously added ActionListener. - * @param 1 the listener to remove + * + * @param listener The listener to remove. + * * @see #addActionListener addActionListener */ - public void removeActionListener(ActionListener l) { + public void removeActionListener(ActionListener listener) { Assert.isUnlocked(this); - if ( m_actionListeners == null ) { + if (m_actionListeners == null) { return; } - m_actionListeners.remove(l); + m_actionListeners.remove(listener); } /** * Fires an ActionEvent, which causes all registered - * ActionListeners to be run. The source of the event - * is the TabbedPane. + * ActionListeners to be run. The source of the event is the + * TabbedPane. + * * @param state the current page state - * @pre state != null + * * @see #respond respond */ protected void fireActionEvent(PageState state) { @@ -141,8 +146,8 @@ public class ControlLink extends BaseLink { if (m_actionListeners == null) { return; } - for (int i=0; i < m_actionListeners.size(); i++ ) { - if ( e == null ) { + for (int i = 0; i < m_actionListeners.size(); i++) { + if (e == null) { e = new ActionEvent(this, state); } ((ActionListener) m_actionListeners.get(i)).actionPerformed(e); @@ -151,6 +156,7 @@ public class ControlLink extends BaseLink { /** * Responds to the incoming request. Fires the ActionEvent. + * * @param state the current page state */ @Override @@ -159,10 +165,10 @@ public class ControlLink extends BaseLink { } /** - * Generates the URL for a link and sets it as the "href" attribute - * of the parent. + * Generates the URL for a link and sets it as the "href" attribute of the + * parent. * - * @param state the current page state + * @param state the current page state * @param parent the parent element */ @Override diff --git a/ccm-core/src/main/java/com/arsdigita/bebop/DescriptiveComponent.java b/ccm-core/src/main/java/com/arsdigita/bebop/DescriptiveComponent.java index 48773a323..6e9ff74eb 100755 --- a/ccm-core/src/main/java/com/arsdigita/bebop/DescriptiveComponent.java +++ b/ccm-core/src/main/java/com/arsdigita/bebop/DescriptiveComponent.java @@ -89,7 +89,7 @@ abstract public class DescriptiveComponent extends SimpleComponent { * Generates a (J)DOM fragment for clients to include into their generated * XML. * - * @param state + * @param state The current page state. * @param parent the XML Element instance to add the attributes managed by * by this class */ diff --git a/ccm-core/src/main/java/com/arsdigita/bebop/SimpleComponent.java b/ccm-core/src/main/java/com/arsdigita/bebop/SimpleComponent.java index 794b5c8bd..a1ef15c6f 100755 --- a/ccm-core/src/main/java/com/arsdigita/bebop/SimpleComponent.java +++ b/ccm-core/src/main/java/com/arsdigita/bebop/SimpleComponent.java @@ -38,15 +38,15 @@ import com.arsdigita.xml.Element; * @version $Id: SimpleComponent.java 1498 2007-03-19 16:22:15Z apevec $ */ public class SimpleComponent extends Completable - implements Component, Cloneable { + implements Component, Cloneable { private boolean m_locked; /** - * The Attribute object is protected to make it easier for the Form Builder - * service to persist the SimpleComponent. - * Locking violation is not a problem since if the SimpleComponent is locked - * then the Attribute object will also be locked. + * The Attribute object is protected to make it easier for the Form Builder + * service to persist the SimpleComponent. Locking violation is not a + * problem since if the SimpleComponent is locked then the Attribute object + * will also be locked. */ protected Attributes m_attr; @@ -55,14 +55,15 @@ public class SimpleComponent extends Completable /** * Clones a component. The clone is not locked and has its own set of * attributes. + * * @return the clone of a component. - * @throws java.lang.CloneNotSupportedException - * @post ! ((SimpleComponent) return).isLocked() + * + * @throws java.lang.CloneNotSupportedException If cloning is not supported. */ @Override public Object clone() throws CloneNotSupportedException { SimpleComponent result = (SimpleComponent) super.clone(); - if ( m_attr != null ) { + if (m_attr != null) { result.m_attr = (Attributes) m_attr.clone(); } result.m_locked = false; @@ -73,15 +74,15 @@ public class SimpleComponent extends Completable * Registers state parameters for the page with its model. Documentation * from Interface Componment: * - * A simple component with a state parameter param would do - * the following in the body of this method: + * A simple component with a state parameter param would do the + * following in the body of this method: *

      *   p.addComponent(this);
      *   p.addComponentStateParam(this, param);
      * 
* - * You should override this method to set the default visibility - * of your component: + * You should override this method to set the default visibility of your + * component: * *
      * public void register(Page p) {
@@ -92,12 +93,10 @@ public class SimpleComponent extends Completable
      * 
* * Always call super.register when you override - * register. Otherwise your component may - * malfunction and produce errors like "Widget ... isn't - * associated with any Form" + * register. Otherwise your component may malfunction and + * produce errors like "Widget ... isn't associated with any Form" * - * @pre p != null - * @param p + * @param p */ @Override public void register(Page p) { @@ -105,16 +104,15 @@ public class SimpleComponent extends Completable } /** - * Registers form parameters with the form model for this form. - * This method is only important for {@link FormSection form sections} - * and {@link com.arsdigita.bebop.form.Widget widgets} (components that - * have a connection to an HTML form). Other components can implement it - * as a no-op. + * Registers form parameters with the form model for this form. This method + * is only important for {@link FormSection form sections} and + * {@link com.arsdigita.bebop.form.Widget widgets} (components that have a + * connection to an HTML form). Other components can implement it as a + * no-op. + * + * @param f The form the register. + * @param m The form model to use with the form. * - * @param f - * @param m - * @pre f != null - * @pre m != null */ @Override public void register(Form f, FormModel m) { @@ -122,24 +120,29 @@ public class SimpleComponent extends Completable } /** - * Does processing that is special to the component - * receiving the click. - * - * @param state the current page state - * @throws javax.servlet.ServletException + * Does processing that is special to the component receiving the click. + * + * @param state The current page state + * + * @throws javax.servlet.ServletException If an error occurs. */ @Override public void respond(PageState state) - throws javax.servlet.ServletException { } + throws javax.servlet.ServletException { + } @Override public Iterator children() { return Collections.EMPTY_LIST.iterator(); } - /** Adds [J]DOM nodes for this component. Specifically for - * base class SimpleComponent, does nothing. - * @param p + /** + * Adds [J]DOM nodes for this component. Specifically for base class + * SimpleComponent, does nothing. + * + * @param state The current page state. + * @param p The parent element. All elements generated in the method will + * be child elements of {@code p}. */ @Override public void generateXML(PageState state, Element p) { @@ -152,7 +155,7 @@ public class SimpleComponent extends Completable } @Override - public void lock () { + public void lock() { if (m_attr != null) { m_attr.lock(); } @@ -160,10 +163,10 @@ public class SimpleComponent extends Completable } /** - * Unlocks this component. Package visibility is intentional; the - * only time a component should be unlocked is when it's pooled and - * gets locked because it's put into a page. It needs to be unlocked - * when the instance is recycled. + * Unlocks this component. Package visibility is intentional; the only time + * a component should be unlocked is when it's pooled and gets locked + * because it's put into a page. It needs to be unlocked when the instance + * is recycled. */ void unlock() { m_locked = false; @@ -171,9 +174,9 @@ public class SimpleComponent extends Completable } /* Working with standard component attributes */ - /** * Gets the class attribute. + * * @return the class attribute. */ @Override @@ -183,6 +186,7 @@ public class SimpleComponent extends Completable /** * Sets the class attribute. + * * @param theClass a valid XML name */ @@ -194,6 +198,7 @@ public class SimpleComponent extends Completable /** * Gets the style attribute. + * * @return the style attribute. */ @Override @@ -202,13 +207,13 @@ public class SimpleComponent extends Completable } /** - * Sets the style attribute. style should be a valid CSS - * style, since its value will be copied verbatim to the output and - * appear as a style attribute in the top level XML or HTML - * output element. + * Sets the style attribute. style should be a valid CSS style, + * since its value will be copied verbatim to the output and appear as a + * style attribute in the top level XML or HTML output element. * * @param style a valid CSS style description for use in the - * style attribute of an HTML tag + * style attribute of an HTML tag + * * @see Standard Attributes */ @Override @@ -219,7 +224,9 @@ public class SimpleComponent extends Completable /** * Gets the id attribute. + * * @return the id attribute. + * * @see #setIdAttr(String id) */ @Override @@ -228,14 +235,14 @@ public class SimpleComponent extends Completable } /** - * Sets the id attribute. id - * should be an id attribute. id should be an XML name * that is unique within the {@link Page Page} in which this component is - * contained. The value of id is copied literally to the - * output and not used for internal processing. + * contained. The value of id is copied literally to the output + * and not used for internal processing. * * @param id a valid XML identifier + * * @see Standard Attributes */ @Override @@ -245,16 +252,12 @@ public class SimpleComponent extends Completable } /* Methods for attribute management */ - /** * Sets an attribute. Overwrites any old values. These values are used to - * generate attributes for the top level XML or HTML element that is - * output from this component with {@link #generateXML generateXML}. + * generate attributes for the top level XML or HTML element that is output + * from this component with {@link #generateXML generateXML}. * - * @pre name != null - * @post getAttribute(name) == value - * - * @param name attribute name, case insensitive + * @param name attribute name, case insensitive * @param value new attribute value */ final protected void setAttribute(String name, String value) { @@ -268,11 +271,12 @@ public class SimpleComponent extends Completable /** * Gets the value of an attribute. * - * @pre name != null * * @param name attribute name, case insensitive + * * @return the string value previously set with {@link #setAttribute * setAttribute}, or null if none was set. + * * @see #setAttribute */ final protected String getAttribute(String name) { @@ -285,17 +289,16 @@ public class SimpleComponent extends Completable * exportAttributes overwrite attributes with identical names * that target might already have. * - * @pre target != null - * * @param target element to which attributes are added + * * @see #setAttribute */ final protected void exportAttributes(com.arsdigita.xml.Element target) { if (m_attr != null) { m_attr.exportAttributes(target); } - if (KernelConfig.getConfig().isDebugEnabled() || - BebopConfig.getConfig().getShowClassName()) { + if (KernelConfig.getConfig().isDebugEnabled() || BebopConfig.getConfig() + .getShowClassName()) { target.addAttribute("bebop:classname", getClass().getName(), BEBOP_XML_NS); } @@ -303,8 +306,9 @@ public class SimpleComponent extends Completable /** * Returns true if any attributes have been set. + * * @return true if any attributes have been set; - * false otherwise. + * false otherwise. */ final protected boolean hasAttributes() { return m_attr != null; @@ -325,15 +329,17 @@ public class SimpleComponent extends Completable /** * Supplies a key for parameter name mangling. - * + * * @param key the key to mangle - * @return + * + * @return This component. */ @Override public Component setKey(String key) { Assert.isUnlocked(this); if (key.charAt(0) >= 0 && key.charAt(0) <= 9) { - throw new IllegalArgumentException("key \"" + key + "\" must not start with a digit."); + throw new IllegalArgumentException("key \"" + key + + "\" must not start with a digit."); } m_key = key; return this; @@ -341,6 +347,7 @@ public class SimpleComponent extends Completable /** * Retrieves a key for parameter name mangling. + * * @return a key for parameter name mangling. */ @Override @@ -354,7 +361,7 @@ public class SimpleComponent extends Completable } @Override - public void setVisible(PageState s, boolean v) { + public void setVisible(PageState s, boolean v) { s.setVisible(this, v); } diff --git a/ccm-core/src/main/java/com/arsdigita/bebop/SingleSelectionModel.java b/ccm-core/src/main/java/com/arsdigita/bebop/SingleSelectionModel.java index da5ca9eb5..b6088f45f 100755 --- a/ccm-core/src/main/java/com/arsdigita/bebop/SingleSelectionModel.java +++ b/ccm-core/src/main/java/com/arsdigita/bebop/SingleSelectionModel.java @@ -80,7 +80,6 @@ public interface SingleSelectionModel { * Clears the selection. * * @param state the state of the current request - * @post ! isSelected(state) */ void clearSelection(PageState state); @@ -102,8 +101,10 @@ public interface SingleSelectionModel { /** * Returns the state parameter that will be used to keep track * of the currently selected key. Typically, the implementing - * class will simply call:
- *
return new StringParameter("foo");

+ * class will simply call: + * + * {@code return new StringParameter("foo");} + * * This method may return null if a state parameter is not * appropriate in the context of the implementing class. * diff --git a/ccm-core/src/main/java/com/arsdigita/kernel/security/SecurityHelper.java b/ccm-core/src/main/java/com/arsdigita/kernel/security/SecurityHelper.java index 169b746a7..d4b63b271 100755 --- a/ccm-core/src/main/java/com/arsdigita/kernel/security/SecurityHelper.java +++ b/ccm-core/src/main/java/com/arsdigita/kernel/security/SecurityHelper.java @@ -57,8 +57,10 @@ public interface SecurityHelper { /** * Determines where to redirect the client to log in. The system calls * this method if the user fails to log in and - * requiresLogin(req) is true. + * {@code requiresLogin(req)} is true. * + * @param req The request for which the login URL is determined. + * * @return the URL to which the client should be redirected to log in, * never null. **/ diff --git a/ccm-core/src/main/java/com/arsdigita/kernel/ui/ACSObjectSelectionModel.java b/ccm-core/src/main/java/com/arsdigita/kernel/ui/ACSObjectSelectionModel.java index 6ea6ca9d5..0b9756697 100755 --- a/ccm-core/src/main/java/com/arsdigita/kernel/ui/ACSObjectSelectionModel.java +++ b/ccm-core/src/main/java/com/arsdigita/kernel/ui/ACSObjectSelectionModel.java @@ -40,7 +40,7 @@ import org.libreccm.core.CcmObjectRepository; /** * Loads a subclass of an ACSObject from the database. By default, uses a - * BigDecimal {@code Long} state parameter in order to store and + * {@code Long} state parameter in order to store and * retrieve the item id. * * @@ -95,24 +95,6 @@ import org.libreccm.core.CcmObjectRepository; * {@link SingleSelectionModel} may be wrapped. Thus, it becomes possible to use * the ACSObjectSelectionModel even if the currently selected ID is * not stored in a state parameter. - *

- * Persistence Details: The default constructor of - * ACSObjectSelectionModel will attempt to use the - * {@link DomainObjectFactory} to automatically instantiate the correct Java - * subclass of {@link ACSObject}. However, it is also possible to use an - * alternate constructor in order to force the - * ACSObjectSelectionModel to manually instantiate the objects: - * - *


- * ACSObjectSelectionModel model =
- *     new ACSObjectSelectionModel("com.arsdigita.cms.Article",
- *                                 "com.arsdigita.cms.Article", "item_id");
- * 
- * - * In this case, the model will attempt to use reflection to instantiate the - * correct subclass of ACSObject. In addition, the supplementary - * constructor makes it possible to create new objects in the database using the - * {@link #createACSObject(BigDecimal)} method. * * @see com.arsdigita.bebop.SingleSelectionModel * @see com.arsdigita.bebop.ParameterSingleSelectionModel @@ -129,10 +111,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { private SingleSelectionModel selectionModel; /** - * Construct a new ACSObjectSelectionModel. This model will - * produce instances of ACSObject by automatically - * instantiating the correct Java subclass using the - * {@link DomainObjectFactory}. + * Construct a new ACSObjectSelectionModel. * * @param parameter The state parameter which should be used to store the * object ID @@ -142,10 +121,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { } /** - * Construct a new ACSObjectSelectionModel. This model will - * produce instances of ACSObject by automatically - * instantiating the correct Java subclass using the - * {@link DomainObjectFactory}. + * Construct a new ACSObjectSelectionModel. * * @param parameterName The name of the state parameter which will be used * to store the object ID. @@ -155,13 +131,10 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { } /** - * Construct a new ACSObjectSelectionModel. This model will - * produce instances of ACSObject by automatically - * instantiating the correct Java subclass using the - * {@link DomainObjectFactory}. + * Construct a new ACSObjectSelectionModel. * * @param model The {@link SingleSelectionModel} which will supply a - * {@link BigDecimal} ID of the currently selected object + * {@link Long} ID of the currently selected object */ public ACSObjectSelectionModel(final SingleSelectionModel model) { this(null, null, model); @@ -171,8 +144,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * Construct a new ACSObjectSelectionModel * * @param javaClass The name of the Java class which represents the object. - * Must be a subclass of {@link ACSObject}. In addition, the class must have - * a constructor with a single {@link OID} parameter. + * Must be a subclass of {@link CcmObject}. In addition, the class must have + * a constructor with a single {@code id} parameter. * @param objectType The name of the persistence metadata object type which * represents the ACS object. In practice, will often be the same as the * javaClass. @@ -189,8 +162,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * Construct a new ACSObjectSelectionModel * * @param javaClass The name of the Java class which represents the object. - * Must be a subclass of {@link ACSObject}. In addition, the class must have - * a constructor with a single {@link OID} parameter. + * Must be a subclass of {@link CcmObject}. In addition, the class must have + * a constructor with a single {@code id} parameter. * @param objectType The name of the persistence metadata object type which * represents the ACS object. In practice, will often be the same as the * javaClass. @@ -209,8 +182,8 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * Construct a new ACSObjectSelectionModel * * @param javaClass The name of the Java class which represents the object. - * Must be a subclass of {@link ACSObject}. In addition, the class must have - * a constructor with a single {@link OID} parameter. + * Must be a subclass of {@link CcmObject}. In addition, the class must have + * a constructor with a single {@code id} parameter. * @param objectType The name of the persistence metadata object type which * represents the ACS object. In practice, will often be the same as the * javaClass. @@ -282,7 +255,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { /** * Load the selected object for the first time. Child classes may choose to * override this method in order to load the object in nonstandard ways. The - * default implementation merely instantiates an {@link ACSObject} whose ID + * default implementation merely instantiates an {@link CcmObject} whose ID * is the passed-in key. * * @param state the current page state @@ -345,8 +318,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * @param id The id of the new item - this is ignored and the object will * have a different id * @return The newly created item - * @throws javax.servlet.ServletException - * @post return != null + * @throws javax.servlet.ServletException If an error occurs. * @deprecated This ignores the ID since ACSObject.setID is a no-op */ public CcmObject createACSObject(final Long id) throws ServletException { @@ -360,8 +332,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * name was supplied in the constructor, an assertion failure will occur. * * @return The newly created item - * @throws javax.servlet.ServletException - * @post return != null + * @throws javax.servlet.ServletException If an error occurs. */ public CcmObject createACSObject() throws ServletException { Assert.exists(javaClassName, Class.class); @@ -415,7 +386,7 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * Return the key that identifies the selected object. * * @param state the current page state - * @return the {@link BigDecimal} {@link Long} ID of the + * @return the {@link Long} ID of the * currently selected object, or null if no object is selected. * */ @@ -429,8 +400,6 @@ public class ACSObjectSelectionModel implements SingleSelectionModel { * Clear the selection. * * @param state the current page state. - * @post ! isSelected(state) - * @post ! isInitialized(state) */ @Override public void clearSelection(final PageState state) { diff --git a/ccm-core/src/main/java/com/arsdigita/util/Lockable.java b/ccm-core/src/main/java/com/arsdigita/util/Lockable.java index 45bcec656..5a03ba944 100644 --- a/ccm-core/src/main/java/com/arsdigita/util/Lockable.java +++ b/ccm-core/src/main/java/com/arsdigita/util/Lockable.java @@ -78,7 +78,7 @@ public interface Lockable { * Return whether an object is locked and thus immutable, or can still be * modified. * - * @return + * @return {@code true} if the object is immutable, {@code false} otherwise. */ boolean isLocked(); diff --git a/ccm-testutils/src/main/java/org/libreccm/tests/categories/IntegrationTest.java b/ccm-testutils/src/main/java/org/libreccm/tests/categories/IntegrationTest.java index 1a10148ef..4de21a89d 100644 --- a/ccm-testutils/src/main/java/org/libreccm/tests/categories/IntegrationTest.java +++ b/ccm-testutils/src/main/java/org/libreccm/tests/categories/IntegrationTest.java @@ -18,6 +18,8 @@ */ package org.libreccm.tests.categories; +import org.junit.experimental.categories.Category; + /** * A marker interface for use with JUnit's {@link Category} annotation to mark * the tests which should be only executed when using one of the Arquillian diff --git a/ccm-testutils/src/main/java/org/libreccm/tests/categories/UnitTest.java b/ccm-testutils/src/main/java/org/libreccm/tests/categories/UnitTest.java index bccfb4a79..9bbcf1723 100644 --- a/ccm-testutils/src/main/java/org/libreccm/tests/categories/UnitTest.java +++ b/ccm-testutils/src/main/java/org/libreccm/tests/categories/UnitTest.java @@ -18,6 +18,8 @@ */ package org.libreccm.tests.categories; +import org.junit.experimental.categories.Category; + /** * A marker interface for use with JUnit's {@link Category} annotation to mark * the tests which should be executed in every case. diff --git a/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java b/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java index ae7143def..c2ee911f7 100644 --- a/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java +++ b/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java @@ -84,7 +84,8 @@ public class DatasetsVerifier { * Overwrite this method if you are using another schema than the default * one. * - * @return + * @return An string array contains the names of the database schemata used + * by the datasets the test. */ public String[] getSchemas() { return new String[]{}; diff --git a/ccm-testutils/src/main/java/org/libreccm/testutils/EqualsVerifier.java b/ccm-testutils/src/main/java/org/libreccm/testutils/EqualsVerifier.java index bb0d58d32..d0d64d076 100644 --- a/ccm-testutils/src/main/java/org/libreccm/testutils/EqualsVerifier.java +++ b/ccm-testutils/src/main/java/org/libreccm/testutils/EqualsVerifier.java @@ -39,14 +39,14 @@ import org.junit.runners.Parameterized; * public class FooBarTest extends EqualsVerifier { * * @Parameterized.Parameters(name = "{0}") - * public static Collection> data() { - * return Arrays.asList(new Class[] { + * public static Collection<Class<?>> data() { + * return Arrays.asList(new Class<?>[] { * Foo.class, * Bar.class * }); * } * - * public FooBarTest(final Class entityClass) { + * public FooBarTest(final Class<?> entityClass) { * super(entityClass); * } * } diff --git a/ccm-testutils/src/main/java/org/libreccm/testutils/ToStringVerifier.java b/ccm-testutils/src/main/java/org/libreccm/testutils/ToStringVerifier.java index a9c26ccb1..48192afbd 100644 --- a/ccm-testutils/src/main/java/org/libreccm/testutils/ToStringVerifier.java +++ b/ccm-testutils/src/main/java/org/libreccm/testutils/ToStringVerifier.java @@ -44,11 +44,11 @@ import java.lang.reflect.Modifier; * @RunWith(Parameterized.class) * @Category(UnitTest.class) public class FooBarTest extends ToStringVerifier { * - * @Parameterized.Parameters(name = "{0}") public static Collection> data() { - * return Arrays.asList(new Class[] { Foo.class, Bar.class }); + * @Parameterized.Parameters(name = "{0}") public static Collection<Class<?>> data() { + * return Arrays.asList(new Class<?>[] { Foo.class, Bar.class }); * } * - * public FooBarTest(final Class entityClass) { + * public FooBarTest(final Class<?> entityClass) { * super(entityClass); * } * }