Package org.apache.taglibs.rdc.core

Examples of org.apache.taglibs.rdc.core.BaseModel


       */
      navRule = (NavigationRule) navigation.get(null);
    } else {
      // Only one child executes at a time in this strategy
      currentExec = (String) activeChildren.get(0);
      BaseModel model = (BaseModel) children.get(currentExec);
      if (!DMUtils.isChildDone(model)) {
        return;
      }
      navRule= (NavigationRule) navigation.get(currentExec);
    }
View Full Code Here


  private static boolean renderNextChild(GroupModel groupModel) {
    Map children = groupModel.getLocalMap();
    List activeChildren = groupModel.getActiveChildren();
    // Only one child executes at a time in this strategy
    if (activeChildren.size() > 0) {
      BaseModel model = (BaseModel)children.get(activeChildren.get(0));
      if (DMUtils.isChildDone(model)) {
        return true;
      }
    }
    return false;
View Full Code Here

      }
      groupState = Constants.GRP_ALL_CHILDREN_DONE;
      log.info("Null ID of identified target");
      return;
    }
    BaseModel model = (BaseModel) children.get(id);
    if (model != null) {
      if (groupState != Constants.GRP_SOME_CHILD_RUNNING) {
        groupState = Constants.GRP_SOME_CHILD_RUNNING;
      }
      if (activeChildren.size() > 0) {
        activeChildren.remove(0);
      }
      activeChildren.add(id);
      if (model instanceof BaseModel) {
        model.setState(Constants.FSM_INPUT);
      } else if (model instanceof GroupModel) {
        model.setState(Constants.GRP_STATE_RUNNING);
      } else if (model instanceof ComponentModel) {
        model.setState(Constants.FSM_INPUT);
      }
    } else {
      // Invalid child ID specified in XML navigation rules
      // Abort group execution -- return values collected
      // upto this point
View Full Code Here

      return;
    }

    Iterator iter = children.keySet().iterator();
    String current;
    BaseModel model = null;

    //Loop while there are elements in the list
    while (iter.hasNext()) {
      current = (String) iter.next();
      if (current.equals(Constants.STR_INIT_ONLY_FLAG)) {
        continue;
      }

      model = (BaseModel) children.get(current);
      if (model != null) {
        model.setState(state);
      }
    }
  }
View Full Code Here

      return;
    }

    Iterator iter = children.keySet().iterator();
    String current;
    BaseModel model = null;
    String setterName = "set" + propertyName.substring(0,1).toUpperCase() +
      ((propertyName.length() > 1) ? propertyName.substring(1) :
      Constants.STR_EMPTY);
    Class[] argClasses = { value.getClass() };
    Object[] args = { value };

    //Loop while there are elements in the list
    while (iter.hasNext()) {
      current = (String) iter.next();
      if (current.equals(Constants.STR_INIT_ONLY_FLAG)) {
        continue;
      }

      model = (BaseModel) children.get(current);
      if (model != null) {
        Class modelClass = model.getClass();
        try
          Method setter = modelClass.getMethod(setterName,
            argClasses);
          setter.invoke((Object)model, args);
        } catch (Exception e) {
          MessageFormat msgFormat =
            new MessageFormat(ERR_SET_PROPERTY);
              log.error(msgFormat.format(new Object[] {propertyName,
                model.getId(), e.getMessage()}));
        }
      }
    }
  }
View Full Code Here

    }

    Iterator iter = children.keySet().iterator();
    String currentItem = null;
    int currentState;
    BaseModel model = null;
   
    while (iter.hasNext()) {
      currentItem = (String) iter.next();
      if (currentItem.equals(Constants.STR_INIT_ONLY_FLAG)) {
        continue;
      }
 
      model = (BaseModel) children.get(currentItem);
      currentState = model.getState();
      List activeChildren = groupModel.getActiveChildren();

      if (currentState != Constants.FSM_DONE &&
        currentState != Constants.GRP_STATE_DONE){
        // If the state is FSM_DORMANT, set it to FSM_INPUT
        if (currentState == Constants.FSM_DORMANT) {
          if (activeChildren.size() > 0) {
            activeChildren.remove(0);
          }
          activeChildren.add(model.getId());
          if (model instanceof GroupModel) {
            model.setState(Constants.GRP_STATE_RUNNING);
          } else {
            model.setState(Constants.FSM_INPUT);
          }
        }
        // Else, let child execute till completion
        return;
      }
View Full Code Here

   * @param GroupModel The group model which holds a child of the given ID
   * @param String The ID whose value is required
   */
  private static Object valueOfIDExpr(GroupModel groupModel, String id) { 
    Object value = null;
    BaseModel iteratorModel = groupModel;
    if (id == null) {
      return null;
    }
    StringTokenizer idTokenizer = new StringTokenizer(id,
      NESTED_DATAMODEL_SEPARATOR);
    BaseModel model = null;
    while (idTokenizer.hasMoreTokens()) {
      String idTok = idTokenizer.nextToken();
      if (iteratorModel instanceof GroupModel) {
        model = (BaseModel) ((GroupModel)iteratorModel).
          getLocalMap().get(idTok);
      } else if (iteratorModel instanceof ComponentModel) {
        model = (BaseModel) ((ComponentModel)iteratorModel).
          getLocalMap().get(idTok);     
      }
      if (model == null) {
        // Invalid child ID specified in XML navigation rules
        MessageFormat msgFormat = new MessageFormat(ERR_NO_SUCH_MODEL);
            log.warn(msgFormat.format(new Object[] {idTok,
              iteratorModel.getId()}));
            return "$" + id;
      }
      iteratorModel = model;
    }
    value = model.getValue();
    return value;
  }
View Full Code Here

TOP

Related Classes of org.apache.taglibs.rdc.core.BaseModel

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.