コード例 #1
0
  public static void doWorkitemComplete(
      final ComponentParameter cParameter, final WorkitemBean workitem) throws IOException {
    final KVMap kv = new KVMap();
    try {
      final WorkitemComplete workitemComplete = WorkitemComplete.get(workitem);

      // 绑定变量
      final IWorkflowForm workflowForm = (IWorkflowForm) workitemComplete.getWorkflowForm();
      if (workflowForm != null) {
        workflowForm.bindVariables(workitemComplete.getVariables());
      }

      final IWorkitemCompleteHandler hdl =
          (IWorkitemCompleteHandler) cParameter.getComponentHandler();
      if (!workitemComplete.isAllCompleted()) {
        hdl.complete(cParameter, workitemComplete);
      } else {
        // 是否有手动情况
        final ActivityComplete activityComplete = workitemComplete.getActivityComplete();
        final boolean transitionManual = activityComplete.isTransitionManual();
        final boolean participantManual = activityComplete.isParticipantManual();
        if (transitionManual || participantManual) {
          kv.add(
              "responseText",
              UrlForward.getResponseText(
                  cParameter,
                  ComponentUtils.getResourceHomePath(WorkitemCompleteBean.class)
                      + "/jsp/workitem_complete_route.jsp"));
          kv.add("transitionManual", transitionManual);
          kv.add("participantManual", participantManual);
        } else {
          hdl.complete(cParameter, workitemComplete);
        }
      }
    } catch (final Throwable ex) {
      kv.add("exception", AjaxRequestUtils.createException(ex));
    }
    final Writer out = cParameter.getResponseWriter();
    out.write(kv.toJSON());
    out.flush();
  }
コード例 #2
0
    @Override
    protected Map<String, Object> getRowData(final ComponentParameter cp, final Object dataObject) {
      final NewsAttachment attachment = (NewsAttachment) dataObject;
      final KVMap kv = new KVMap();
      try {
        final AttachmentFile af =
            newsContext.getAttachmentService().createAttachmentFile(attachment);
        kv.put(
            "topic",
            new LinkElement(attachment.getTopic())
                .setOnclick(JS.loc(DownloadUtils.getDownloadHref(af), true))
                .setTitle(attachment.getDescription()));
      } catch (final IOException e) {
        kv.put("topic", attachment.getTopic());
      }
      kv.put("attachsize", FileUtils.toFileSize(attachment.getAttachsize()));

      final Class<? extends Enum<?>> eClass =
          ((NewsFormAttachPage) get(cp)).getAttachmentTypeClass();
      if (eClass != null) {
        kv.put("attachtype", eClass.getEnumConstants()[attachment.getAttachtype()]);
      }

      if (((INewsWebContext) newsContext).getLogRef() != null) {
        kv.put(
            "downloads",
            LinkElement.style2(attachment.getDownloads())
                .setOnclick(
                    "$Actions['NewsTabAttachPage_logWin']('beanId=" + attachment.getId() + "');"));
      } else {
        kv.put("downloads", attachment.getDownloads());
      }
      kv.put("userId", cp.getUser(attachment.getUserId()));
      kv.put("createDate", attachment.getCreateDate());

      kv.add(TablePagerColumn.OPE, toOpeHTML(cp, attachment));
      return kv;
    }