Пример #1
0
  public void setRelaTableMaxNo(SiteTableRela.TableRela tr, DataRow dr, boolean newIDFlag) {
    for (int i = 0; i < this.NoRelas.length; ++i) {
      SiteTableRela.NoType nr = this.NoRelas[i];
      if (nr.TableCode.equalsIgnoreCase(tr.TableCode)) {
        String id = dr.getString(nr.FieldName);
        if (newIDFlag) {
          id = String.valueOf(NoUtil.getMaxID(nr.NoType));
        }
        addIDMapping(nr.TableCode + "." + nr.FieldName, dr.getString(nr.FieldName), id);
        dr.set(nr.FieldName, id);
      }
    }
    for (int i = 0; i < this.TableRelas.length; ++i)
      if (this.TableRelas[i].TableCode.equals(tr.TableCode)) {
        String type = this.TableRelas[i].RelaTable;
        if ((((type.equals("ZCArticle"))
                || (type.equals("ZCAttachment"))
                || (type.equals("ZCImage"))
                || (type.equals("ZCAudio"))
                || (type.equals("ZCVideo"))))
            && (this.TableRelas[i].RelaField.equals("ID"))) {
          type = "Document";
        }

        String id =
            getIDMapping(
                type + "." + this.TableRelas[i].RelaField,
                dr.getString(this.TableRelas[i].KeyField));
        if (StringUtil.isNotEmpty(id)) dr.set(this.TableRelas[i].KeyField, id);
      }
  }
Пример #2
0
  public void setSiteIDTableMaxNo(String tableName, DataRow dr, boolean newIDFlag) {
    try {
      if (dr.getDataColumn("SiteID") != null)
        dr.set("SiteID", getIDMapping("ZCSite", String.valueOf(this.siteID)));
    } catch (Throwable t) {
      t.printStackTrace();
      LogUtil.warn(tableName);
    }
    for (int i = 0; i < this.NoRelas.length; ++i) {
      SiteTableRela.NoType nr = this.NoRelas[i];
      if (nr.TableCode.equalsIgnoreCase(tableName)) {
        String id = dr.getString(nr.FieldName);
        if (newIDFlag) {
          if ((nr.TableCode.equals("ZCCatalog")) && (nr.FieldName.equals("InnerCode")))
            if (id.length() == 6) {
              id = CatalogUtil.createCatalogInnerCode(null);
            } else {
              String parent = id.substring(0, id.length() - 6);
              parent = getIDMapping(nr.TableCode + "." + nr.FieldName, parent);
              id = CatalogUtil.createCatalogInnerCode(parent);
            }
          else {
            id = String.valueOf(NoUtil.getMaxID(nr.NoType));
          }
        }
        String type = nr.TableCode;
        if ((((type.equals("ZCArticle"))
                || (type.equals("ZCAttachment"))
                || (type.equals("ZCImage"))
                || (type.equals("ZCAudio"))
                || (type.equals("ZCVideo"))))
            && (nr.NoType.equals("DocID"))) {
          type = "Document";
        }

        addIDMapping(type + "." + nr.FieldName, dr.getString(nr.FieldName), id);
        dr.set(nr.FieldName, id);
      }
    }
    for (int i = 0; i < this.TableRelas.length; ++i)
      if (this.TableRelas[i].TableCode.equals(tableName)) {
        String type = this.TableRelas[i].RelaTable;
        if ((((type.equals("ZCArticle"))
                || (type.equals("ZCAttachment"))
                || (type.equals("ZCImage"))
                || (type.equals("ZCAudio"))
                || (type.equals("ZCVideo"))))
            && (this.TableRelas[i].RelaField.equals("ID"))) {
          type = "Document";
        }

        String id =
            getIDMapping(
                type + "." + this.TableRelas[i].RelaField,
                dr.getString(this.TableRelas[i].KeyField));
        if (StringUtil.isNotEmpty(id)) dr.set(this.TableRelas[i].KeyField, id);
      }
  }