예제 #1
0
  public void saveContext() throws Exception {
    if (this.insId <= 0L) GDB.getInstance().addXORMObjWithNewId(this);
    else {
      GDB.getInstance().updateXORMObjToDB(Long.valueOf(this.insId), this);
    }

    StringBuilder sb = new StringBuilder();
    BizFlowInsManager.getInstance().updateCxtIdx(this, true, sb);

    this.bDirty = false;
  }
예제 #2
0
 public static BizFlowInsContext loadContext(long cxtid) throws Exception {
   BizFlowInsContext bfi =
       (BizFlowInsContext)
           GDB.getInstance().getXORMObjByPkId(BizFlowInsContext.class, Long.valueOf(cxtid));
   bfi.bDirty = false;
   return bfi;
 }
예제 #3
0
  public static void renderXormFile(
      HttpServletRequest req,
      HttpServletResponse resp,
      Class xormc,
      String xormprop,
      long pkid,
      String filename,
      boolean showpic,
      Date lastmodify)
      throws ClassNotFoundException, Exception {
    filename = filename.replace(" ", "");

    if (!showpic)
      resp.addHeader(
          "Content-Disposition",
          "attachment; filename=" + new String(filename.getBytes(), "iso8859-1"));

    if (lastmodify != null) {
      resp.setDateHeader("Last-Modified", lastmodify.getTime());
    }

    if (req != null) {
      long l = req.getDateHeader("If-Modified-Since");
      if (l > 0) {
        if (lastmodify != null
            && lastmodify.getTime() / 1000 <= l / 1000) { // 由于文件系统的最后修改时间精确到秒,所以需要去除毫秒以便于计算
          resp.setStatus(304); // not modify
          return;
        }
      }
    }

    GDB g = GDB.getInstance();

    long filelen = g.getXORMFileContLength(xormc, xormprop, pkid);
    if (filelen < 0) return;

    resp.setContentLength((int) filelen);
    resp.setContentType(Mime.getContentType(filename));
    ServletOutputStream os = resp.getOutputStream();
    GDB.getInstance().loadXORMFileContToOutputStream(xormc, xormprop, pkid, os);
    os.flush();
  }
예제 #4
0
  /**
   * 根据XORM定义和对应的文件属性列,输出文件内容.
   *
   * @param resp
   * @param filename
   * @param xorm_c
   * @param xorm_prop
   * @param xorm_pk
   */
  public static void renderFile(
      HttpServletResponse resp, String filename, Class xorm_c, String xorm_prop, long xorm_pk)
      throws Exception {
    InputStream is = null;
    try {
      is = GDB.getInstance().getXORMFileStreamByPkId(xorm_c, xorm_prop, xorm_pk);
      if (is == null) return;

      renderFile(resp, filename, is);
    } finally {
      if (is != null) is.close();
    }
  }
예제 #5
0
 public void saveNodeId2InsMap() throws Exception {
   GDB.getInstance()
       .updateXORMObjToDBWithHasColNames(
           Long.valueOf(this.insId), this, new String[] {"NodeInsMap"});
 }