3 Replies Latest reply: Aug 3, 2012 12:09 PM by Ben Rogers RSS

    Setting a default value for an attribute in rulebase - OPM

    953728
      Hi,

      I am trying to set a default value 0 for a numeric attribute.I tried few things but didnt work.
      I was trying to default custom function which will set the default value to "0".
      i am new to OPA and i dont knw java.
      this is the java program that i am planning to deploy as jar.but unfortunately it is not working.

      import com.oracle.determinations.engine.CustomFunction;
      import com.oracle.determinations.engine.EntityInstance;
      import java.util.Random;

      public class DefaultFunction extends CustomFunction
      {
           public Object evaluate(EntityInstance entityInstance, Object[] objects)
           {
                if (objects[0] == null)
                {
                return 0;
                }
           }
           public Object requireKnownParameters(EntityInstance entityInstance, Object[] objects)
           {
                if (objects[0] == null)
                {
                return false;
                }
           }

      }
      Is there any reference material where it has all the functions or sample programs.