Package de.iritgo.aktera.model

Examples of de.iritgo.aktera.model.Output


          res.addOutput("sessionDisplayName", (String) userEnv.getAttribute("sessionDisplayName"));
          res.addOutput("sessionFirstName", (String) userEnv.getAttribute("sessionFirstName"));
          res.addOutput("sessionLastName", (String) userEnv.getAttribute("sessionLastName"));
          res.addOutput("sessionLoginName", (String) userEnv.getLoginName());

          Output lang = res.createOutput("sessionLanguage");

          lang.setContent(userEnv.getAttribute("sessionLanguage"));
          res.add(lang);
        }
        else
        {
          Output lang = res.createOutput("sessionLanguage");

          lang.setContent(Locale.GERMAN);
          res.add(lang);
        }
      }
      catch (AuthorizationException x)
      {
View Full Code Here


  /**
   * @see de.iritgo.aktera.ui.UIController#execute(de.iritgo.aktera.ui.UIRequest, de.iritgo.aktera.ui.UIResponse)
   */
  public void execute(UIRequest request, UIResponse response) throws UIControllerException
  {
    Output outContexts = response.createOutput("contexts");

    response.add(outContexts);

    int contextNum = 0;

    for (Map.Entry<String, ComparableContext> contextEntry : KeelAbstractServer.getContexts().entrySet())
    {
      Output outContext = response.createOutput("context-" + (contextNum++));

      outContexts.add(outContext);
      outContext.setContent(contextEntry.getKey());

      ComparableContext context = contextEntry.getValue();
      int entryNum = 0;

      while (context != null)
      {
        for (Map.Entry<Object, Object> dataEntry : context.getData().entrySet())
        {
          Output outEntry = response.createOutput("entry-" + (entryNum++));

          outContext.add(outEntry);
          outEntry.setContent(dataEntry.getKey() + ":" + dataEntry.getValue());

          if (dataEntry.getValue() instanceof DefaultUserEnvironment)
          {
            int attrNum = 0;

            for (Map.Entry<String, Object> attrEntry : ((DefaultUserEnvironment) dataEntry.getValue())
                    .getAttributes().entrySet())
            {
              Output outAttr = response.createOutput("attr-" + (attrNum++));

              outEntry.add(outAttr);
              outAttr.setContent(attrEntry.getKey() + "=" + attrEntry.getValue());
            }
          }
        }

        context = context.getParentContext();
View Full Code Here

      handler.adjustFormular(wrappedRequest, formular, persistents);

      if (NumberTools.toBool(request.getParameter(SYSTEM_EDIT), false))
      {
        Output out = response.createOutput(FORM_KEY);

        out.setContent(formular);
        response.add(out);
      }
      else
      {
        if (request.getParameter("ajax") != null)
View Full Code Here

   */
  public ModelResponse execute(ModelRequest req) throws ModelException
  {
    ModelResponse res = req.createResponse();

    Output outModuleList = res.createOutput("modules");

    res.add(outModuleList);

    try
    {
      Configuration config = getConfiguration();

      Configuration[] modules = config.getChildren("module");

      for (int i = 0; i < modules.length; ++i)
      {
        Configuration module = modules[i];

        if (LicenseTools.getLicenseInfo().moduleAllowed(module.getAttribute("id")))
        {
          Output outModule = res.createOutput("module_" + module.getAttribute("id"));

          outModuleList.add(outModule);
          outModule.setAttribute("name", module.getChild("name").getValue());
          outModule.setAttribute("version", module.getChild("version").getValue());
          outModule.setAttribute("type", module.getAttribute("type", "application"));
          outModule.setAttribute("description", module.getChild("description").getValue());
          outModule.setAttribute("copyright", module.getChild("copyright").getValue("").replaceAll("\\\\n",
                  "<br />"));
        }
      }
    }
    catch (ConfigurationException x)
View Full Code Here

      if (currentItem == null && UserTools.getCurrentUserId(req) != null)
      {
        currentItem = (String) systemConfigManager.get("system", "startMenuItem");
      }

      Output outFunctions = res.createOutput("functions");

      if (! byGroups)
      {
        outFunctions.setAttribute("style", style == null ? "none" : style);
        res.add(outFunctions);
      }

      String title = getConfiguration().getChild("title").getValue("functions");

      outFunctions.setAttribute("title", title);

      String bundle = getConfiguration().getChild("bundle").getValue("Aktera");

      outFunctions.setAttribute("bundle", bundle);

      Map<String, List<Command>> tmpMenuGroups = new Hashtable();

      int num = 0;

      for (Iterator i = functions.iterator(); i.hasNext();)
      {
        FunctionItem item = (FunctionItem) i.next();

        if (item.feature != null && ! LicenseTools.getLicenseInfo().hasFeature(item.feature))
        {
          continue;
        }

        if (item.check != null && ! CheckerTools.check(item.check, req, new Properties()))
        {
          continue;
        }

        if (item.role != null && ! UserTools.currentUserIsInGroup(req, "admin")
                && ! UserTools.currentUserIsInGroup(req, item.role))
        {
          continue;
        }

        if (item.permission != null)
        {
          boolean hasPermission = false;

          for (String p : item.permission.split("\\|"))
          {
            if (permissionManager.hasPermission(UserTools.getCurrentUserName(req), p))
            {
              hasPermission = true;

              break;
            }
          }

          if (! hasPermission)
          {
            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);
        }

        if (byGroups && item.group != null)
        {
          List<Command> menuItems = tmpMenuGroups.get(item.group);

          if (menuItems == null)
          {
            menuItems = new LinkedList<Command>();
            tmpMenuGroups.put(item.group, menuItems);
          }

          menuItems.add(cmd);
        }

        num++;
      }

      if (byGroups)
      {
        Output outMenuGroups = res.createOutput("menuGroups");

        res.add(outMenuGroups);

        for (MenuGroup menuGroup : menuGroups)
        {
          Output outMenuGroup = res.createOutput(menuGroup.id, menuGroup.id);

          outMenuGroups.add(outMenuGroup);
          outMenuGroup.setAttribute("label", menuGroup.label);
          outMenuGroup.setAttribute("bundle", menuGroup.bundle);

          List<Command> menuItems = tmpMenuGroups.get(menuGroup.id);

          if (menuItems != null)
          {
            for (Command cmd : menuItems)
            {
              outMenuGroup.add(cmd);
            }
          }
        }
      }
View Full Code Here

      handler.adjustFormular(req, formular, persistents);

      if (NumberTools.toBool(req.getParameter(SYSTEM_EDIT), false))
      {
        Output out = res.createOutput(FORM_KEY);

        out.setContent(formular);
        res.add(out);
      }
      else
      {
        if (req.getParameter("ajax") != null)
View Full Code Here

    {
      try
      {
        Model formularModel = (Model) req.getService(Model.ROLE, formularModelName);

        Output formularOutput = (Output) formularModel.execute(req).get("formular");

        if (formularOutput != null)
        {
          formular = (FormularDescriptor) formularOutput.getContent();
        }
      }
      catch (Exception x)
      {
        throw new ModelException("[aktera.edit] Unable to create formular from model " + formularModelName
View Full Code Here

   */
  public static void createReport(ModelRequest req, ModelResponse res, Class klass, String reportName,
          Map parameters, String format, String dataSourceName, String reportModel, String backModel)
    throws ModelException
  {
    Output outReport = res.createOutput("report");

    res.add(outReport);

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

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

    try
    {
      JasperPrint reportPrint = null;

      if (req.getParameter("page") != null)
      {
        reportPrint = (JasperPrint) UserTools.getUserEnvObject(req, "currentReport");
      }

      if (reportPrint == null)
      {
        reportPrint = ReportTools.createReport(dataSourceName, reportName, req, klass, parameters, format);

        UserTools.setUserEnvObject(req, "currentReport", reportPrint);
      }

      int page = NumberTools.toInt(req.getParameter("page"), 1);

      ExporterFilter noLayoutFilter = new ExporterFilter()
      {
        public boolean isToExport(JRPrintElement element)
        {
          return true;
        }
      };

      if ("pdf".equals(format))
      {
        res.addOutput("contentType", "application/pdf");
        res.addOutput("fileName", "Report.pdf");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JRPdfExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else if ("csv".equals(format))
      {
        res.addOutput("contentType", "text/plain");
        res.addOutput("fileName", "Report.csv");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JasperCSVExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.setParameter(JRExporterParameter.IGNORE_PAGE_MARGINS, true);
        exporter.setParameter(JRExporterParameter.FILTER, noLayoutFilter);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else if ("xml".equals(format))
      {
        res.addOutput("contentType", "text/xml");
        res.addOutput("fileName", "Report.xml");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JRXmlExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.setParameter(JRExporterParameter.IGNORE_PAGE_MARGINS, true);
        exporter.setParameter(JRExporterParameter.FILTER, noLayoutFilter);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else if ("xls".equals(format))
      {
        res.addOutput("contentType", "application/xls");
        res.addOutput("fileName", "Report.xls");

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        JRExporter exporter = new JRXlsExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, buf);
        exporter.setParameter(JRExporterParameter.IGNORE_PAGE_MARGINS, true);
        exporter.setParameter(JRExporterParameter.FILTER, noLayoutFilter);
        exporter.exportReport();
        outReport.setContent(buf.toByteArray());
      }
      else
      {
        StringBuffer buf = new StringBuffer();
        JRExporter exporter = new JRHtmlExporter();

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STRING_BUFFER, buf);
        exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, "");
        exporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER, "");
        exporter.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML, "");
        exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean(true));
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(page - 1));
        exporter.exportReport();
        outReport.setContent(buf.toString());

        createPageNavigationControls(req, res, page, reportPrint.getPages().size(), reportModel, backModel);
      }
    }
    catch (JRException x)
    {
      outReport.setAttribute("empty", "true");
    }
  }
View Full Code Here

          String reportModel, String backModel) throws ModelException
  {
    int numPrevPages = 4;
    int numNextPages = 4;

    Output outPage = res.createOutput("page");

    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

    {
      response = ((UIResponseVisitor) parentVisitor).getResponse();
      dashboardGroups = ((UIResponseVisitor) parentVisitor).getDashboardGroups();
    }

    Output group = response.createOutput(dashboardGroup.getId());

    group.setContent(currentGroupItems);
    group.setAttribute("title", dashboardGroup.getTitle());
    group.setAttribute("renderInclude", dashboardGroup.getRenderFile());
    dashboardGroups.add(group);
  }
View Full Code Here

TOP

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

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.