[java-identity-provider] branch master updated: IDP-1168 - Collapse duplicated scripted implementations

Scott Cantor cantor.2 at osu.edu
Mon May 8 14:17:13 EDT 2017


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=dce9afac218ce13fdcd6a709b014dffe8952a6d0

The following commit(s) were added to refs/heads/master by this push:
       new  dce9afa   IDP-1168 -  Collapse duplicated scripted implementations
dce9afa is described below

commit dce9afac218ce13fdcd6a709b014dffe8952a6d0
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon May 8 14:17:11 2017 -0400

    IDP-1168 -  Collapse duplicated scripted implementations
    
    https://issues.shibboleth.net/jira/browse/IDP-1168
    
    Re-base ScriptedPredicate on java-support version.
---
 .../idp/profile/logic/ScriptedPredicate.java       | 29 +++-------------------
 1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
index 54d9615..07c9e77 100644
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
@@ -28,7 +28,6 @@ import javax.script.ScriptException;
 
 import net.shibboleth.utilities.java.support.annotation.ParameterName;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator;
 import net.shibboleth.utilities.java.support.scripting.EvaluableScript;
 
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -41,7 +40,8 @@ import com.google.common.base.Predicate;
 /**
  * A {@link Predicate} which calls out to a supplied script.
  */
-public class ScriptedPredicate extends AbstractScriptEvaluator implements Predicate<ProfileRequestContext> {
+public class ScriptedPredicate
+        extends net.shibboleth.utilities.java.support.logic.ScriptedPredicate<ProfileRequestContext> {
     
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ScriptedPredicate.class);
@@ -54,10 +54,7 @@ public class ScriptedPredicate extends AbstractScriptEvaluator implements Predic
      */
     public ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") final EvaluableScript theScript,
             @Nullable @NotEmpty @ParameterName(name="extraInfo") final String extraInfo) {
-        super(theScript);
-        setOutputType(Boolean.class);
-        setReturnOnError(false);
-        setLogPrefix("Scripted Predicate from " + extraInfo + ":");
+        super(theScript, extraInfo);
     }
 
     /**
@@ -67,30 +64,12 @@ public class ScriptedPredicate extends AbstractScriptEvaluator implements Predic
      */
     public ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") final EvaluableScript theScript) {
         super(theScript);
-        setLogPrefix("Anonymous Scripted Predicate:");
-        setOutputType(Boolean.class);
-        setReturnOnError(false);
-    }
-    
-    /**
-     * Set value to return if an error occurs.
-     * 
-     * @param flag value to return
-     */
-    public void setReturnOnError(final boolean flag) {
-        setReturnOnError(Boolean.valueOf(flag));
-    }
-    
-    /** {@inheritDoc} */
-    public boolean apply(@Nullable final ProfileRequestContext input) {
-        
-        final Object result = evaluate(input);
-        return (boolean) (result != null ? result : getReturnOnError());
     }
     
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final ScriptContext scriptContext, @Nullable final Object... input) {
+        super.prepareContext(scriptContext, input);
         scriptContext.setAttribute("profileContext", input[0], ScriptContext.ENGINE_SCOPE);
     }
     

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list