Package org.olat.course.condition.interpreter

Examples of org.olat.course.condition.interpreter.ArgumentParseException


  public Object call(Object[] inStack) {
    /*
     * argument check
     */
    if (inStack.length > 2) {
      return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs",
          "solution.provideone.nodereference"));
    } else if (inStack.length < 2) { return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "",
        "error.moreargs", "solution.provideone.nodereference")); }
    /*
     * argument type check
     */
    Long courseRepoEntryKey;
    try{
      courseRepoEntryKey = Long.decode((String) inStack[0]) ;
    }catch(NumberFormatException nfe) {
      return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "",
          "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    }
   
    if (!(inStack[1] instanceof String)) return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "",
        "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    String childId = (String) inStack[1];
    /*
     * no integrity check can be done - other course might not exist anymore
     */
 
View Full Code Here


  public Object call(Object[] inStack) {
    /*
     * argument check
     */
    if (inStack.length > 2) {
      return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs",
          "solution.provideone.nodereference"));
    } else if (inStack.length < 2) { return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "",
        "error.moreargs", "solution.provideone.nodereference")); }
    /*
     * argument type check
     */
    //TODO argument check courseRepoEntryKey
    Long courseRepoEntryKey;
    try{
      courseRepoEntryKey = Long.decode((String) inStack[0]) ;
    }catch(NumberFormatException nfe) {
      return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "",
          "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    }
   
    if (!(inStack[1] instanceof String)) return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "",
        "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    String childId = (String) inStack[1];
    /*
     * no integrity check can be done - other course might not exist anymore
     */
 
View Full Code Here

  public Object call(Object[] inStack) {
    /*
     * argument check
     */
    if (inStack.length > 1) {
      return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs",
          "solution.provideone.nodereference"));
    } else if (inStack.length < 1) { return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "",
        "error.moreargs", "solution.provideone.nodereference")); }
    /*
     * argument type check
     */
    if (!(inStack[0] instanceof String)) return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "",
        "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    String childId = (String) inStack[0];
    /*
     * check reference integrity
     */
    CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
    if (cev != null) {
      if (!cev.existsNode(childId)) { return handleException( new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, childId,
          "error.notfound.coursenodeid", "solution.copypastenodeid")); }
      if (!cev.isAssessable(childId)) { return handleException(new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name,
          childId, "error.notassessable.coursenodid", "solution.takeassessablenode")); }
      // remember the reference to the node id for this condtion
      cev.addSoftReference("courseNodeId", childId);
      // return a valid value to continue with condition evaluation test
      return defaultValue();
View Full Code Here

  public Object call(Object[] inStack) {
    /*
     * argument check
     */
    if (inStack.length > 1) {
      return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs",
          "solution.provideone.nodereference"));
    } else if (inStack.length < 1) { return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "",
        "error.moreargs", "solution.provideone.nodereference")); }
    /*
     * argument type check
     */
    if (!(inStack[0] instanceof String)) return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "",
        "error.argtype.coursnodeidexpeted", "solution.example.node.infunction"));
    String childId = (String) inStack[0];
    /*
     * check reference integrity
     */
    CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv();
    if (cev != null) {
      if (!cev.existsNode(childId)) { return handleException( new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name, childId,
          "error.notfound.coursenodeid", "solution.copypastenodeid")); }
      if (!cev.isAssessable(childId)) { return handleException(new ArgumentParseException(ArgumentParseException.REFERENCE_NOT_FOUND, name,
          childId, "error.notassessable.coursenodid", "solution.takeassessablenode")); }
      // remember the reference to the node id for this condtion
      cev.addSoftReference("courseNodeId", childId);
      // return a valid value to continue with condition evaluation test
      return defaultValue();
View Full Code Here

TOP

Related Classes of org.olat.course.condition.interpreter.ArgumentParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.