Removed DOCUMENT ME comments that were generated and applied source code
[utils] / security / src / main / java / org / wamblee / security / authorization / UrlAuthorizationRule.java
index b3103fb15fa36f2ff6dda01e2e9216028d31b345..d5b48a16d06b4dc3abb53c5449561e609f6fc48e 100644 (file)
@@ -25,33 +25,29 @@ import static org.wamblee.security.authorization.AuthorizationResult.UNSUPPORTED
 
 import org.wamblee.usermgt.User;
 
-
 /**
- * Utility base class for implementation of authentication rules based on
- * the
- *  <ul>
- *      <li>The path of the resource. To obtain the path of a resource,
- *      subclasses must implement {@link #getResourcePath(Object)}.  Whether a
- *      path is appropriate is determined by a  {@link
- *      org.wamblee.security.authorization.PathCondition}.</li>
- *      <li>The user identity with which the resource is accessed.
- *      Whether a user is appropriate is determined by a {@link
- *      org.wamblee.security.authorization.UserCondition}.</li>
- *      <li>The operation that is requested.  Whether the operation is
- *      appropriate is determined by a  {@link
- *      org.wamblee.security.authorization.OperationCondition}.</li>
- *  </ul>
- *  In case all three conditions match, the condition returns the
- * configured result passed at construction (GRANTED or DENIED). If the
- * resource is not of the specified type, the result is UNSUPPORTED_RESOURCE,
- * otherwise, the result is UNDECIDED.
+ * Utility base class for implementation of authentication rules based on the
+ * <ul>
+ * <li>The path of the resource. To obtain the path of a resource, subclasses
+ * must implement {@link #getResourcePath(Object)}. Whether a path is
+ * appropriate is determined by a
+ * {@link org.wamblee.security.authorization.PathCondition}.</li>
+ * <li>The user identity with which the resource is accessed. Whether a user is
+ * appropriate is determined by a
+ * {@link org.wamblee.security.authorization.UserCondition}.</li>
+ * <li>The operation that is requested. Whether the operation is appropriate is
+ * determined by a {@link org.wamblee.security.authorization.OperationCondition}
+ * .</li>
+ * </ul>
+ * In case all three conditions match, the condition returns the configured
+ * result passed at construction (GRANTED or DENIED). If the resource is not of
+ * the specified type, the result is UNSUPPORTED_RESOURCE, otherwise, the result
+ * is UNDECIDED.
  */
-public abstract class UrlAuthorizationRule extends AbstractPersistent
-    implements AuthorizationRule {
-    /**
-     * DOCUMENT ME!
-     */
-    private static final Logger LOGGER = Logger.getLogger(UrlAuthorizationRule.class);
+public abstract class UrlAuthorizationRule extends AbstractPersistent implements
+    AuthorizationRule {
+    private static final Logger LOGGER = Logger
+        .getLogger(UrlAuthorizationRule.class);
 
     /**
      * Result that the rule will return in case there is a match.
@@ -78,14 +74,20 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
      */
     private OperationCondition operationCondition;
 
-/**
-     * Constructs an authorization rule. 
-     * IF the group and path match, then the provided result will be returned. 
-     * @param aResult Result of the authorization when the path and group match. 
-     * @param aUserCondition Condition to match users.  
-     * @param aPathCondition Condition to match paths with.  
-     * @param aResourceClass Supported resource class this is for.
-     * @param aOperationCondition Condition to match the operation with.  
+    /**
+     * Constructs an authorization rule. IF the group and path match, then the
+     * provided result will be returned.
+     * 
+     * @param aResult
+     *            Result of the authorization when the path and group match.
+     * @param aUserCondition
+     *            Condition to match users.
+     * @param aPathCondition
+     *            Condition to match paths with.
+     * @param aResourceClass
+     *            Supported resource class this is for.
+     * @param aOperationCondition
+     *            Condition to match the operation with.
      */
     protected UrlAuthorizationRule(AuthorizationResult aResult,
         UserCondition aUserCondition, PathCondition aPathCondition,
@@ -95,46 +97,42 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
                 "Only GRANTED or DENIED may be used: " + aResult);
         }
 
-        result                 = aResult;
-        userCondition          = aUserCondition;
-        pathCondition          = aPathCondition;
-        resourceClass          = aResourceClass;
-        operationCondition     = aOperationCondition;
+        result = aResult;
+        userCondition = aUserCondition;
+        pathCondition = aPathCondition;
+        resourceClass = aResourceClass;
+        operationCondition = aOperationCondition;
     }
 
-/**
-     * For OR mapping. 
-     *
+    /**
+     * For OR mapping.
+     * 
      */
     protected UrlAuthorizationRule(Class aResourceClass) {
-        result                 = null;
-        userCondition          = null;
-        pathCondition          = null;
-        resourceClass          = aResourceClass;
-        operationCondition     = null;
+        result = null;
+        userCondition = null;
+        pathCondition = null;
+        resourceClass = aResourceClass;
+        operationCondition = null;
     }
 
-/**
-     * For OR mapping. 
-     *
+    /**
+     * For OR mapping.
+     * 
      */
     protected UrlAuthorizationRule() {
-        result                 = null;
-        userCondition          = null;
-        pathCondition          = null;
-        resourceClass          = null;
-        operationCondition     = null;
+        result = null;
+        userCondition = null;
+        pathCondition = null;
+        resourceClass = null;
+        operationCondition = null;
     }
 
     /*
      * (non-Javadoc)
-     *
-     * @see org.wamblee.security.authorization.AuthorizationRule#getSupportedTypes()
-     */
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
+     * 
+     * @see
+     * org.wamblee.security.authorization.AuthorizationRule#getSupportedTypes()
      */
     public Class[] getSupportedTypes() {
         return new Class[] { resourceClass };
@@ -142,18 +140,10 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
 
     /*
      * (non-Javadoc)
-     *
-     * @see org.wamblee.security.authorization.AuthorizationRule#isAllowed(java.lang.Object,
-     *      org.wamblee.security.authorization.Operation)
-     */
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aResource DOCUMENT ME!
-     * @param anOperation DOCUMENT ME!
-     * @param aUser DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
+     * 
+     * @see
+     * org.wamblee.security.authorization.AuthorizationRule#isAllowed(java.lang
+     * .Object, org.wamblee.security.authorization.Operation)
      */
     public AuthorizationResult isAllowed(Object aResource,
         Operation anOperation, User aUser) {
@@ -168,11 +158,14 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
 
     /**
      * Determines if the operation is allowed on the resource.
-     *
-     * @param aPath Path of the resource.
-     * @param aOperation Operation to be done.
-     * @param aUser Currently logged in user or null if no user is logged in.
-     *
+     * 
+     * @param aPath
+     *            Path of the resource.
+     * @param aOperation
+     *            Operation to be done.
+     * @param aUser
+     *            Currently logged in user or null if no user is logged in.
+     * 
      * @return Authorization result,
      */
     protected AuthorizationResult isAllowed(String aPath, Operation aOperation,
@@ -194,32 +187,30 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
 
     /**
      * Gets the path of the resource.
-     *
-     * @param aResource Resource, guaranteed to be an instance of  {@link
-     *        #resourceClass}.
-     *
+     * 
+     * @param aResource
+     *            Resource, guaranteed to be an instance of
+     *            {@link #resourceClass}.
+     * 
      * @return Path of the resource.
      */
     protected abstract String getResourcePath(Object aResource);
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see java.lang.Object#toString()
      */
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
     @Override
     public String toString() {
-        return "UrlAUthorizationRule(result = " + result + ", pathCondition = "
-        + pathCondition + ", userCondition = " + userCondition
-        + ", resourceClass = " + resourceClass + ")";
+        return "UrlAUthorizationRule(result = " + result +
+            ", pathCondition = " + pathCondition + ", userCondition = " +
+            userCondition + ", resourceClass = " + resourceClass + ")";
     }
 
     /**
      * Gets the authorization result for OR mapping.
-     *
+     * 
      * @return Result.
      */
     protected String getAuthorizationResultString() {
@@ -232,18 +223,14 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
 
     /**
      * Sets the authorization result, for OR mapping.
-     *
-     * @param aResult Result.
+     * 
+     * @param aResult
+     *            Result.
      */
     protected void setAuthorizationResultString(String aResult) {
         result = AuthorizationResult.valueOf(aResult);
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
     protected String getResourceClassName() {
         if (resourceClass == null) {
             return "";
@@ -252,13 +239,6 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
         return resourceClass.getName();
     }
 
-    /**
-     * DOCUMENT ME!
-     *
-     * @param aResourceClass DOCUMENT ME!
-     *
-     * @throws IllegalArgumentException DOCUMENT ME!
-     */
     protected void setResourceClassName(String aResourceClass) {
         try {
             resourceClass = Class.forName(aResourceClass);
@@ -270,8 +250,7 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
     }
 
     /**
-     * DOCUMENT ME!
-     *
+     * 
      * @return Returns the operationCondition.
      */
     public OperationCondition getOperationCondition() {
@@ -279,17 +258,16 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
     }
 
     /**
-     * DOCUMENT ME!
-     *
-     * @param aOperationCondition The operationCondition to set.
+     * 
+     * @param aOperationCondition
+     *            The operationCondition to set.
      */
     protected void setOperationCondition(OperationCondition aOperationCondition) {
         operationCondition = aOperationCondition;
     }
 
     /**
-     * DOCUMENT ME!
-     *
+     * 
      * @return Returns the pathCondition.
      */
     public PathCondition getPathCondition() {
@@ -297,17 +275,16 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
     }
 
     /**
-     * DOCUMENT ME!
-     *
-     * @param aPathCondition The pathCondition to set.
+     * 
+     * @param aPathCondition
+     *            The pathCondition to set.
      */
     protected void setPathCondition(PathCondition aPathCondition) {
         pathCondition = aPathCondition;
     }
 
     /**
-     * DOCUMENT ME!
-     *
+     * 
      * @return Returns the userCondition.
      */
     public UserCondition getUserCondition() {
@@ -315,9 +292,9 @@ public abstract class UrlAuthorizationRule extends AbstractPersistent
     }
 
     /**
-     * DOCUMENT ME!
-     *
-     * @param aUserCondition The userCondition to set.
+     * 
+     * @param aUserCondition
+     *            The userCondition to set.
      */
     protected void setUserCondition(UserCondition aUserCondition) {
         userCondition = aUserCondition;