示例#1
0
  public Number preEditNewspaper(String mode, Number docId, String compCode) {
    this.getDBTransaction().getSession().getUserData().put("compCode", compCode);
    Number result = null;
    CmsNewspaperTVOImpl newspaperTVO = this.getCmsNewspaperTVO();
    if ("CREATE".equals(mode)) {
      CmsDocTVOImpl docVO = this.getCmsDocTVO();
      CmsDocTVORowImpl docNewRow = (CmsDocTVORowImpl) docVO.createRow();
      docNewRow.setStatus("TO_GATHER_NEWSPAPER");
      docNewRow.setLibCode("NEWSPAPER");
      docNewRow.setLibTypeCode("END_PROD_LIB");
      docNewRow.setCompCode(compCode);
      docVO.insertRow(docNewRow);

      CmsNewspaperTVORowImpl newRow = (CmsNewspaperTVORowImpl) newspaperTVO.createRow();

      // 初始化
      CmsNewspaperCategoryVOImpl newspaperCategoryVO = this.getCmsNewspaperCategoryVO();
      CmsNewspaperCategoryVORowImpl row =
          (CmsNewspaperCategoryVORowImpl) newspaperCategoryVO.first();
      if (row != null) {
        newRow.setNewspaperCategoryId(row.getNewspaperCategoryId());
        newRow.setDocId(docNewRow.getDocId());
        newRow.setPrice(row.getPrice());
        newRow.setNewspaperType(row.getNewspaperType());
        newRow.setNewspaperTypeMeaning(row.getNewspaperTypeMeaning());
        newRow.setIssn(row.getIssn());
        newRow.setCn(row.getCn());
        newRow.setLang(row.getLang());
        newRow.setLangMeaning(row.getLangMeaning());
        newRow.setChiefEditor(row.getChiefEditor());
        newRow.setBookSize(row.getBookSize());
        newRow.setBookSizeMeaning(row.getBookSizeMeaning());
        newRow.setProdSize(row.getProdSize());
        newRow.setProdSizeMeaning(row.getProdSizeMeaning());
        newRow.setReaderGroup(row.getReaderGroup());
        newRow.setReaderGroupMeaning(row.getReaderGroupMeaning());
        newspaperTVO.insertRow(newRow);
        preDocCategroupRel(mode, docNewRow.getDocId(), row.getNewspaperCategoryId());
      }

      result = newRow.getDocId();
    } else {
      result = docId;
      newspaperTVO.setbvDocId(docId);
      newspaperTVO.executeQuery();
      Row row = newspaperTVO.first();
      if (row != null) {
        row.setAttribute("LastUpdateDate", new Date());
        newspaperTVO.setCurrentRow(row);
      }
      preDocCategroupRel(mode, docId, null);
    }
    return result;
  }
示例#2
0
  public void batchEditNewspaper(String docIds) {
    String[] docId = docIds.split(",");
    CmsNewspaperTVOImpl newspaperVO = this.getCmsNewspaperTVO();
    CmsNewspaperEditVOImpl editVO = this.getCmsNewspaperEditVO();
    CmsNewspaperEditVORowImpl editRow = (CmsNewspaperEditVORowImpl) editVO.getCurrentRow();
    for (String id : docId) {
      try {
        newspaperVO.setbvDocId(new Number(id));
      } catch (SQLException e) {
        e.printStackTrace();
      }
      newspaperVO.executeQuery();
      Row row = newspaperVO.first();
      if (row != null) {
        CmsNewspaperTVORowImpl newspaperRow = (CmsNewspaperTVORowImpl) row;
        for (String attr : editRow.getAttributeNames()) {
          if (editRow.getAttribute(attr) != null) {
            if ("Keyword".equals(attr)) {
              String oldKeyword = newspaperRow.getKeyword();
              String newKeyword = null;
              if (oldKeyword == null) {
                newKeyword = editRow.getAttribute(attr) + "";
              } else {
                newKeyword = oldKeyword + "," + editRow.getAttribute(attr);
              }
              newspaperRow.setAttribute(attr, newKeyword);
            } else if (attr.indexOf("Lookup") >= 0) {

            } else {
              newspaperRow.setAttribute(attr, editRow.getAttribute(attr));
            }
          }
        }
        newspaperRow.setLastUpdatedBy(this.getCustomDBTransaction().getUserId());
        newspaperRow.setLastUpdateDate(new Date());
      }
    }
  }