Package de.iritgo.aktera.model

Examples of de.iritgo.aktera.model.Command


    if (req.getParameter("loginmodel") != null)
    {
      loginModel = (String) req.getParameter("loginmodel");
    }

    Command login = res.createCommand(loginModel);

    login.setName("login");
    login.setLabel("$login");

    if (fixedDomain != null)
    {
      login.setParameter("domain", fixedDomain);
    }

    if (rememberConfig.equals("prompt") || rememberConfig.equals("last"))
    {
      Input remember = res.createInput("remember");

      remember.setLabel("Remember Login");
      remember.setAttribute("checkbox", "Y");

      String rememberChecked = configuration.getAttribute("remember-checked", "false");

      if (rememberConfig.equals("last"))
      {
        remember.setDefaultValue((defaultLoginName != null && ! defaultLoginName.equals("")) ? "on" : "off");
      }
      else if (rememberChecked.equals("true"))
      {
        remember.setDefaultValue("on");
      }

      res.add(remember);
    }
    else if (rememberConfig.equals("always"))
    {
      login.setParameter("remember", "Y");
    }
    else if (rememberConfig.equals("never"))
    {
      login.setParameter("remember", "N");
    }

    res.add(login);

    res.setDefaultsFromPrevious();

    Command logout = res.createCommand(Constants.LOGOFF);

    logout.setLabel("$logoff");
    res.add(logout);

    Command promptSendPassword = res.createCommand(Constants.PROMPT_SEND_PASSWORD);

    promptSendPassword.setName("sendPassword");
    promptSendPassword.setLabel("$sendPassword");
    res.add(promptSendPassword);

    Command promptRegister = res.createCommand(Constants.PROMPT_REGISTRATION);

    promptRegister.setLabel("$register");
    res.add(promptRegister);

    res.setDefaultsFromPrevious();

    return res;
View Full Code Here


    int currentMonth = cal.get(Calendar.MONTH);
    int currentYear = cal.get(Calendar.YEAR);

    outCalendar.setAttribute("currentDate", cal.getTime());

    Command cmdCurrentMonth = ModelTools.createPreviousModelCommand(req, res);

    cmdCurrentMonth.setParameter("showMonth", new Integer(cal.get(Calendar.MONTH)));
    cmdCurrentMonth.setParameter("showYear", new Integer(cal.get(Calendar.YEAR)));
    outCalendar.setAttribute("cmdCurrentMonth", cmdCurrentMonth);

    if (showMonth != - 1)
    {
      cal.set(Calendar.MONTH, showMonth);
    }
    else
    {
      showMonth = currentMonth;
    }

    if (showYear != - 1)
    {
      cal.set(Calendar.YEAR, showYear);
    }

    outCalendar.setAttribute("showDate", cal.getTime());

    cal.add(Calendar.MONTH, - 1);

    Command cmdPrevMonth = ModelTools.createPreviousModelCommand(req, res);

    cmdPrevMonth.setParameter("showMonth", new Integer(cal.get(Calendar.MONTH)));
    cmdPrevMonth.setParameter("showYear", new Integer(cal.get(Calendar.YEAR)));
    outCalendar.setAttribute("cmdPrevMonth", cmdPrevMonth);

    cal.add(Calendar.MONTH, 2);

    Command cmdNextMonth = ModelTools.createPreviousModelCommand(req, res);

    cmdNextMonth.setParameter("showMonth", new Integer(cal.get(Calendar.MONTH)));
    cmdNextMonth.setParameter("showYear", new Integer(cal.get(Calendar.YEAR)));
    outCalendar.setAttribute("cmdNextMonth", cmdNextMonth);

    cal.add(Calendar.MONTH, - 1);
    cal.add(Calendar.YEAR, - 1);

    Command cmdPrevYear = ModelTools.createPreviousModelCommand(req, res);

    cmdPrevYear.setParameter("showMonth", new Integer(cal.get(Calendar.MONTH)));
    cmdPrevYear.setParameter("showYear", new Integer(cal.get(Calendar.YEAR)));
    outCalendar.setAttribute("cmdPrevYear", cmdPrevYear);

    cal.add(Calendar.YEAR, 2);

    Command cmdNextYear = ModelTools.createPreviousModelCommand(req, res);

    cmdNextYear.setParameter("showMonth", new Integer(cal.get(Calendar.MONTH)));
    cmdNextYear.setParameter("showYear", new Integer(cal.get(Calendar.YEAR)));
    outCalendar.setAttribute("cmdNextYear", cmdNextYear);

    cal.add(Calendar.YEAR, - 1);

    Output outWeeks = res.createOutput("weeks");

    outCalendar.setAttribute("weeks", outWeeks);

    cal.set(Calendar.WEEK_OF_MONTH, 1);
    cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);

    for (int i = 0; i < 6; ++i)
    {
      Output outWeek = res.createOutput("week");

      outWeeks.add(outWeek);
      outWeek.setAttribute("num", new Integer(cal.get(Calendar.WEEK_OF_YEAR)));

      for (int j = 0; j < 7; ++j)
      {
        Output outDay = res.createOutput("day");

        outWeek.add(outDay);

        outDay.setAttribute("num", new Integer(cal.get(Calendar.DAY_OF_MONTH)));

        if (cal.get(Calendar.YEAR) == currentYear && cal.get(Calendar.DAY_OF_YEAR) == currentDayOfYear)
        {
          outDay.setAttribute("isCurrent", Boolean.TRUE);
        }

        if (cal.get(Calendar.MONTH) == showMonth)
        {
          if (dayModel != null)
          {
            Command cmdDoDay = res.createCommand(dayModel);

            outDay.setAttribute("cmdDoDay", cmdDoDay);
          }
        }
        else
View Full Code Here

    }

    if (conf.getChild("validation-error", false) != null)
    {
      Configuration validationErrorConfig = conf.getChild("validation-error");
      Command redirect = req.createResponse().createCommand(validationErrorConfig.getAttribute("model"));

      if (validationErrorConfig.getAttributeAsBoolean("params", true))
      {
        String oneParamName = null;

        for (Iterator i = req.getParameters().keySet().iterator(); i.hasNext();)
        {
          oneParamName = (String) i.next();
          redirect.setParameter(oneParamName, req.getParameter(oneParamName));

          return redirect;
        }
      }
    }
View Full Code Here

    response.clearErrors();
  }

  public Command createCommand(String model) throws ModelException
  {
    Command newCommand = null;

    newCommand = new DefaultCommand();
    newCommand.setName("command_" + nextName);
    nextName++;
    newCommand.setBean(model);

    return newCommand;
  }
View Full Code Here

      properties.setProperty("destination", params.destination);
    }

    ModelResponse res = req.createResponse();

    Command cmdBack = res.createCommand(params.backModel);

    cmdBack.setName("cmdBack");
    res.add(cmdBack);

    if ("analyze".equals(params.mode))
    {
      if (analyze(req, res, params.fileName, params.handlerId, params.bulkImport, params.xslt, properties))
      {
        Properties props = new Properties();

        props.put("file", params.fileName);

        if (StringTools.isNotTrimEmpty(params.destination))
        {
          props.put("destination", params.destination);
        }

        props.put("backModel", params.backModel);
        props.put("bulkImport", params.bulkImport);
        props.put("handler", params.handlerId);
        props.put("xslt", params.xslt);
        props.put("importModel", getConfiguration().getAttribute("id", "none"));

        return ModelTools.callModel(req, "aktera.import.analyse.report", props);
      }
      else
      {
        Command cmdForce = res.createCommand(getConfiguration().getAttribute("id", "none"));

        cmdForce.setName("cmdForce");
        cmdForce.setParameter("file", params.fileName);

        if (StringTools.isNotTrimEmpty(params.destination))
        {
          cmdForce.setParameter("destination", params.destination);
        }

        cmdForce.setParameter("mode", "analyze");
        cmdForce.setParameter("bulkImport", params.bulkImport);
        cmdForce.setParameter("force", "Y");
        cmdForce.setParameter("backModel", params.backModel);
        cmdForce.setParameter("handler", params.handlerId);
        cmdForce.setParameter("xslt", params.xslt);
        res.add(cmdForce);

        res.setAttribute("forward", "aktera.import.analyse-report");

        return res;
View Full Code Here

          {
            continue;
          }
        }

        Command cmd = res.createCommand("aktera.select-menu-item");

        cmd.setName("cmd" + num);
        cmd.setLabel(item.label);
        cmd.setAttribute("bundle", item.bundle);
        cmd.setAttribute("id", item.id);
        cmd.setParameter("item", item.category);

        if (item.bean != null)
        {
          cmd.setBean("de.iritgo.aktera.base.SelectMenuItem");
          cmd.setParameter("targetBean", item.bean);
        }
        else
        {
          cmd.setParameter("targetModel", item.model);
        }

        if (item.menu != null)
        {
          cmd.setParameter("menu", item.menu);
        }

        if (item.menuItem != null)
        {
          cmd.setParameter("menuItem", item.menuItem);
        }

        boolean active = item.category.equals(currentItem);

        //        String icon = active ? item.icon : item.inactiveIcon;
        String icon = item.icon;

        cmd.setAttribute("icon", icon != null ? icon : "menu-bullet");
        cmd.setAttribute("bigIcon", item.bigIcon);

        if (active)
        {
          cmd.setAttribute("active", "Y");
        }

        if (num % itemsPerRow == itemsPerRow - 1)
        {
          cmd.setAttribute("lastInRow", "Y");
        }

        if (! byGroups)
        {
          outFunctions.add(cmd);
View Full Code Here

    res.add(outReport);

    if (! StringTools.isEmpty(backModel))
    {
      Command cmd = res.createCommand(backModel);

      cmd.setName("back");
      cmd.setLabel("back");
      res.add(cmd);
    }

    try
    {
View Full Code Here

    outPage.setContent(new Integer(page));
    res.add(outPage);

    if (page > 1)
    {
      Command cmdPageStart = createPageCommand(req, res, "cmdPageStart", reportModel, backModel);

      cmdPageStart.setParameter("page", "1");
      res.add(cmdPageStart);

      Command cmdPageBack = createPageCommand(req, res, "cmdPageBack", reportModel, backModel);

      cmdPageBack.setParameter("page", String.valueOf(page - 1));
      res.add(cmdPageBack);

      Output outPrevPages = res.createOutput("prevPages");

      res.add(outPrevPages);

      int firstPrevPage = Math.max(1, page - numPrevPages);

      for (int i = page - 1; i >= firstPrevPage; --i)
      {
        Command cmdPage = createPageCommand(req, res, "cmdPage", reportModel, backModel);

        cmdPage.setParameter("page", String.valueOf(page - i - 1 + firstPrevPage));
        cmdPage.setLabel(String.valueOf(page - i - 1 + firstPrevPage));
        outPrevPages.add(cmdPage);
      }
    }

    if (page < numPages)
    {
      Command cmdPageEnd = createPageCommand(req, res, "cmdPageEnd", reportModel, backModel);

      cmdPageEnd.setParameter("page", String.valueOf(numPages));
      res.add(cmdPageEnd);

      Command cmdPageNext = createPageCommand(req, res, "cmdPageNext", reportModel, backModel);

      cmdPageNext.setParameter("page", String.valueOf(page + 1));
      res.add(cmdPageNext);

      Output outNextPages = res.createOutput("nextPages");

      res.add(outNextPages);

      int lastNextPage = Math.min(numPages, page + numNextPages);

      for (int i = page + 1; i <= lastNextPage; ++i)
      {
        Command cmdPage = createPageCommand(req, res, "cmdPage", reportModel, backModel);

        cmdPage.setParameter("page", String.valueOf(i));
        cmdPage.setLabel(String.valueOf(i));
        outNextPages.add(cmdPage);
      }
    }
  }
View Full Code Here

   * @return The new command.
   */
  private static Command createPageCommand(ModelRequest req, ModelResponse res, String name, String reportModel,
          String backModel) throws ModelException
  {
    Command cmd = res.createCommand(reportModel);

    cmd.setParameter("backModel", backModel);
    cmd.setName(name);

    return cmd;
  }
View Full Code Here

    }

    String modelName = getModelName(modelConfig, req);

    //         log.debug("Creating a command for modelName: " + modelName);
    Command c = existingResponse.createCommand(modelName);

    for (Iterator i = params.keySet().iterator(); i.hasNext();)
    {
      String paramName = (String) i.next();

      c.setParameter(paramName, params.get(paramName));

      //             if (log.isDebugEnabled()) {
      //               log.debug(
      //                 "Setting parameter:" + paramName + "=" + params.get(paramName));
      //             }
    }

    //         log.debug("About to execute the new command for " + modelName);
    c.setParameter(Sequence.SEQUENCE_NAME, seqName);
    c.setParameter(Sequence.SEQUENCE_NUMBER, "" + seqNumber);

    //c.setParameter(SequenceContext.CONTEXT_KEY, seqContext);
    //Add by Phil Brow to pass the seq Context as a param to each model
    //MN: Can't serialize a SequenceContext in the response
    ModelResponse commandRes = c.execute(req, existingResponse);

    //         log.debug("Executed command.");
    for (Iterator ii = postAttribs.keySet().iterator(); ii.hasNext();)
    {
      String oneKey = (String) ii.next();
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.model.Command

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.