Beispiel #1
0
 public IPage addSchedule(IRequestCycle cycle) {
   EditSchedule page = (EditSchedule) cycle.getPage(EditSchedule.PAGE);
   page.setUserId(null);
   page.setUserGroup(getSettingDao().getGroup(getGroupId()));
   page.newSchedule("usrGroup_sch", PAGE);
   return page;
 }
Beispiel #2
0
  public IPage commit(IRequestCycle cycle) {
    if (!TapestryUtils.isValid(this)) {
      return null;
    }
    // Save the user
    CoreContext core = getCoreContext();
    User user = getUser();
    user.setImId(user.getUserName());
    EditUser.saveGroups(getSettingDao(), user.getGroups());

    // Execute the automatic assignments for the user.
    GroupAutoAssign groupAutoAssign =
        new GroupAutoAssign(
            getConferenceBridgeContext(), getCoreContext(),
            getForwardingContext(), getMailboxManager());
    groupAutoAssign.assignUserData(user);

    // On saving the user, transfer control to edituser page.
    if (FormActions.APPLY.equals(getButtonPressed())) {
      EditUser edit = (EditUser) cycle.getPage(EditUser.PAGE);
      edit.setUserId(user.getId());
      return edit;
    }

    return null;
  }
  public void savePaintingAction(IRequestCycle cycle) {
    Painting painting = getPainting();
    Artist artist = getArtist();

    if (!assertNotNull(painting.getPaintingTitle())) {
      appendHtmlToErrorMessage("You must provide a painting title.");
      return;
    }

    DataContext ctxt = getVisitDataContext();

    // painting was created earlier, but before we can
    // start working with its relationships, and ultimately
    // save it to DB, it must be regsitered with DataContext
    ctxt.registerNewObject(painting);

    // establish relationship with artist via a simple method call
    // an equivalent of the line below would be "
    artist.addToPaintingArray(painting);

    // commit to the database
    ctxt.commitChanges();

    BrowseArtistsPage nextPage = (BrowseArtistsPage) cycle.getPage("BrowseArtistsPage");

    cycle.activate(nextPage);
  }
Beispiel #4
0
 public IPage addQueue(IRequestCycle cycle) {
   EditAcdQueue editPage = (EditAcdQueue) cycle.getPage(EditAcdQueue.PAGE);
   editPage.setAcdQueueId(null);
   editPage.setAcdServerId(getAcdServerId());
   editPage.setReturnPage(this);
   return editPage;
 }
Beispiel #5
0
 public IPage editService(IRequestCycle cycle, String serviceBeanId, Integer locationId) {
   PageWithCallback page = (PageWithCallback) cycle.getPage(SERVICE_MAP.get(serviceBeanId));
   page.setReturnPage(EditLocationPage.PAGE);
   if (page instanceof AcdServerPage) {
     AcdServer acdServer = getAcdContext().getAcdServerForLocationId(locationId);
     if (acdServer != null) {
       ((AcdServerPage) page).setAcdServerId(acdServer.getId());
     }
   }
   return page;
 }
Beispiel #6
0
  /** @see org.apache.tapestry.engine.IEngineService#service(org.apache.tapestry.IRequestCycle) */
  public void service(IRequestCycle cycle) throws IOException {
    String activePageName = cycle.getParameter(ServiceConstants.PAGE);
    IPage page = cycle.getPage(activePageName);
    cycle.activate(page);

    Object[] parameters = linkFactory.extractListenerParameters(cycle);

    String downloadFileName = (String) parameters[0];
    String taskType = (String) parameters[1];
    String templatePath = (String) parameters[2];
    Object reportEntity = parameters[6];

    IBlobModel templateEntity = null;

    boolean isUsetemplatePath = true;

    if (templatePath == null) {
      templateEntity = (IBlobModel) parameters[3];
      isUsetemplatePath = false;
    }

    // 设置reportEntity到page的rootedObject.
    if (reportEntity != null && page instanceof IPageRooted) {
      ((IPageRooted<Object, Object>) page).setRootedObject(reportEntity);
    }

    // 设置监听方法的参数.并调用trigger方法.
    cycle.setListenerParameters(JasperEntityLink.constructServiceParameters(parameters[7]));
    String idPath = (String) parameters[8];
    if (idPath != null) {
      IDirect direct = (IDirect) page.getNestedComponent(idPath);
      direct.trigger(cycle);
    }

    String detailEntity = (String) parameters[4];
    String detailCollection = (String) parameters[5];

    service(
        cycle,
        page,
        isUsetemplatePath,
        templatePath,
        templateEntity,
        downloadFileName,
        taskType,
        detailEntity,
        detailCollection);
  }
Beispiel #7
0
  public void service(IEngineServiceView engine, IRequestCycle cycle, ResponseOutputStream output)
      throws IOException {
    System.out.println(
        "===============================================================================================");
    RequestContext context = cycle.getRequestContext();
    String[] contextParams = getServiceContext(context);
    if (contextParams.length != 3)
      throw new ApplicationRuntimeException(
          "Incorrect number of service parameters for service "
              + getName()
              + ". Expected 2, but got "
              + contextParams.length);

    String componentPageName = contextParams[1];
    String componentId = contextParams[2];

    IPage componentPage = cycle.getPage(componentPageName);
    IComponent component = componentPage.getNestedComponent(componentId);

    if (!(component instanceof IXMLService))
      throw new ApplicationRuntimeException(
          "Incorrect component type: was "
              + component.getClass()
              + " but must be "
              + IXMLService.class,
          component,
          null,
          null);

    IXMLService xservice = (IXMLService) component;

    // do not squeeze on input
    String[] params = context.getParameters(Tapestry.PARAMETERS_QUERY_PARAMETER_NAME);
    cycle.setServiceParameters(params);
    xservice.trigger(cycle);

    // do not squeeze on output either
    Object[] args = cycle.getServiceParameters();
    String strArgs = generateOutputString(args);

    output.setContentType("text/xml");
    output.write(strArgs.getBytes("utf-8"));
  }
Beispiel #8
0
 public IPage editSchedulesGroup(IRequestCycle cycle, Integer scheduleId) {
   EditSchedule page = (EditSchedule) cycle.getPage(EditSchedule.PAGE);
   page.editSchedule(scheduleId, PAGE);
   return page;
 }
Beispiel #9
0
 @Override
 public IPage editGroupName(IRequestCycle cycle) {
   EditGroup page = (EditGroup) cycle.getPage(EditGroup.PAGE);
   page.editGroup(getGroupId(), PAGE);
   return page;
 }
 public void viewMissingEntries(IRequestCycle cycle) {
   IPage missingEntriesPage = cycle.getPage("ImageZipUploadMissingEntries");
   PropertyUtils.write(missingEntriesPage, "zipEntriesNoXML", getZipEntriesNoXML());
   PropertyUtils.write(missingEntriesPage, "xmlEntriesNoZip", getXmlEntriesNoZip());
   cycle.activate(missingEntriesPage);
 }
Beispiel #11
0
 public IPage extensionPools(IRequestCycle cycle) {
   ExtensionPoolsPage poolsPage = (ExtensionPoolsPage) cycle.getPage(ExtensionPoolsPage.PAGE);
   poolsPage.setReturnPage(this);
   return poolsPage;
 }
 public void activate(IRequestCycle cycle) {
   workflow.setCurrentEntry(this);
   DataContext.bindThreadDataContext(dataContext);
   cycle.getPage(pageName).validate(cycle);
   cycle.activate(pageName);
 }
Beispiel #13
0
 public IPage editLine(IRequestCycle cycle, Integer id) {
   EditAcdLine editPage = (EditAcdLine) cycle.getPage(EditAcdLine.PAGE);
   editPage.setAcdLineId(id);
   editPage.setReturnPage(this);
   return editPage;
 }
Beispiel #14
0
  /**
   * 得到JasperPrint的list.用于一个报表有多页的情况(非循环多页)
   *
   * <p>实现方法:通过读取zip包,将zip包里每一个报表文件进行填充并放入List返回.
   *
   * <p>注意:zip包里报表名命名规则:第一张应该为1.jasper,依次类推;若报表有detail,则在数字后边加上detail如2detail.jasper;
   * 若报表有子报表则命名时后缀为.zip有detail则加,无则不加.
   *
   * @param jasperInStream
   * @param page
   * @param parameters
   * @param detailEntity
   * @param detailCollection
   * @return
   * @throws JRException
   * @throws IOException
   * @throws ParseException
   */
  @SuppressWarnings("unchecked")
  protected List<JasperPrint> getJasperPrintList(
      IRequestCycle cycle,
      InputStream jasperInStream,
      IPage page,
      Map<Object, Object> parameters,
      String detailEntity,
      String detailCollection)
      throws JRException, IOException, ParseException {

    List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();

    int pageNumber = 0;
    JasperPrint jasperPrint = null;
    Object[] jasperName = parameters.keySet().toArray();
    Arrays.sort(jasperName);

    for (int i = 0; i < jasperName.length; i++) {

      jasperInStream = (InputStream) parameters.get(jasperName[i]);
      getJasperParameters(jasperInStream, parameters);
      IPageRooted<Object, Object> activePage = (IPageRooted<Object, Object>) page;

      if (parameters.containsKey(TEMPLATE_PAGE)) {

        InputStream propStream = (InputStream) parameters.get(TEMPLATE_PAGE);
        String jsonParam = getLinkParameter(propStream);
        parameters.remove(TEMPLATE_PAGE);

        if (jsonParam != null) {
          JSONObject json = new JSONObject(jsonParam);

          String activePageName = null;
          if (json.has(PAGE)) {
            activePageName = (String) json.get(PAGE);
            activePage = (IPageRooted<Object, Object>) cycle.getPage(activePageName);
            ((IPageRooted<Object, Object>) activePage)
                .setRootedObject(((IPageRooted<Object, Object>) page).getRootedObject());
            cycle.activate(activePage);
          }
        }
      }

      if (((String) jasperName[i])
          .substring(0, ((String) jasperName[i]).indexOf("."))
          .endsWith(DETAIL)) {

        jasperPrint =
            this.getJasperPrint(
                jasperInStream, activePage, parameters, detailEntity, detailCollection, pageNumber);
      } else {

        jasperPrint =
            this.getJasperPrint(jasperInStream, activePage, parameters, null, null, pageNumber);
      }

      jasperPrintList.add(jasperPrint);

      int pageSize = jasperPrint.getPages().size();

      pageNumber += pageSize; // 将前边的JasperPrint的页数进行记录
    }

    return jasperPrintList;
  }
Beispiel #15
0
 /**
  * form 提交动作 weijian.zhang 2006-4-18
  *
  * @param cycle
  */
 public void formSubmit(IRequestCycle cycle) {
   if (ConstantPageName.SET_RTN.equals(getFunctionHidden())) { // 返回
     RoleList roleList = (RoleList) cycle.getPage("RoleList");
     cycle.activate(roleList);
   }
 }