Beispiel #1
0
    @Override
    public void before(ActionEvent<List<WebContentEntity>> event) {
      Orm orm = event.getOrm();

      WebCatalogEntity catalog = null;
      String catalogCode = "";

      List<WebContentEntity> list = event.getEntity();
      for (WebContentEntity entity : list) {

        /*
         * 获取栏目编码
         */
        if (catalog == null) {
          catalog = entity.getCatalog();
          catalogCode = catalog.getCode();
          if (StringUtil.isNil(catalogCode)) {
            catalog = (WebCatalogEntity) orm.load(catalog.getClass(), catalog.getId());
            catalogCode = catalog.getCode();
          }
        }

        /** 设置栏目编码(冗余字段) */
        entity.setCatalogCode(catalogCode);
      }
    }
Beispiel #2
0
    @Override
    public void before(ActionEvent<WebContentEntity> event) {
      Orm orm = event.getOrm();

      WebContentEntity entity = event.getEntity();

      /*
       * 获取栏目编码
       */
      WebCatalogEntity catalog = entity.getCatalog();
      String catalogCode = catalog.getCode();
      if (StringUtil.isNil(catalogCode)) {
        catalog = (WebCatalogEntity) orm.load(catalog.getClass(), catalog.getId());
        catalogCode = catalog.getCode();
      }

      /** 设置栏目编码(冗余字段) */
      entity.setCatalogCode(catalogCode);
    }