Ejemplo n.º 1
0
 /** 组装公告对像 */
 private SaveOrUpdateNoticeTask buildSaveOrUpdateNoticeTask() {
   SaveOrUpdateNoticeTask saveOrUpdateNoticeTask = new SaveOrUpdateNoticeTask();
   if (null == getArgument()) {
     // 公告GUID
     saveOrUpdateNoticeTask.setRECID(getContext().newRECID());
     // 创建日期
     saveOrUpdateNoticeTask.setCreateDate(new Date().getTime());
   } else {
     // 公告GUID
     saveOrUpdateNoticeTask.setRECID(((NoticeInfo) this.getArgument()).getRECID());
     // 创建日期
     saveOrUpdateNoticeTask.setCreateDate(((NoticeInfo) this.getArgument()).getCreateTime());
   }
   // 公告标题
   saveOrUpdateNoticeTask.setNoticeTitle(
       noticeTitleText.getText() != null ? noticeTitleText.getText().trim() : "");
   // 是否置顶
   saveOrUpdateNoticeTask.setIsTop(isTopCheckBox.getSelection());
   // 发布范围
   saveOrUpdateNoticeTask.setDeptNameStr(
       deptNameStrText.getText() != null ? deptNameStrText.getText().trim() : "");
   // 发布日期
   saveOrUpdateNoticeTask.setPublishTime(
       publishingDate.getDate() != null ? publishingDate.getDate().getTime() : 0);
   // 撤消日期
   saveOrUpdateNoticeTask.setCancelTime(
       cancelDate.getDate() != null ? DateUtil.getDayEndTime(cancelDate.getDate().getTime()) : 0);
   // 公告内容
   saveOrUpdateNoticeTask.setNoticeContent(
       noticeContentText.getContent() != null ? noticeContentText.getContent().trim() : "");
   // 发布范围
   if (StringHelper.isNotEmpty(deptGuidStr)) {
     String[] deptGuids = deptGuidStr.split(",");
     List<GUID> deptGuidList = new ArrayList<GUID>();
     if (null != deptGuids && deptGuids.length > 0) {
       for (Object item : deptGuids) {
         deptGuidList.add(GUID.valueOf(item.toString()));
       }
     }
     saveOrUpdateNoticeTask.setDeptGuidList(deptGuidList);
   }
   return saveOrUpdateNoticeTask;
 }
Ejemplo n.º 2
0
 /** 编辑时初始化内容 */
 private void initNoticeInfo() {
   NoticeInfo noticeInfo = (NoticeInfo) this.getArgument();
   if (null != noticeInfo) {
     deptGuidStr =
         noticeInfo.getDeptGuidList() == null
             ? ""
             : StringUtils.join(noticeInfo.getDeptGuidList().iterator(), ",");
     noticeTitleText.setText(noticeInfo.getNoticeTitle());
     isTopCheckBox.setSelection(noticeInfo.getIsTop());
     deptNameStrText.setText(noticeInfo.getDeptNameStr());
     publishingDate.setDate(
         noticeInfo.getPublishTime() == 0 ? null : new Date(noticeInfo.getPublishTime()));
     cancelDate.setDate(
         noticeInfo.getCancelTime() == 0 ? null : new Date(noticeInfo.getCancelTime()));
     noticeContentText.setContent(noticeInfo.getNoticeContent());
   }
 }