Esempio n. 1
0
 /*     */ public String copy() {
   /* 177 */ String historyId = getRequest().getParameter("historyId");
   /* 178 */ DocHistory docHistory = (DocHistory) this.docHistoryService.get(new Long(historyId));
   /* 179 */ DocHistory newHistory = new DocHistory();
   /*     */
   /* 181 */ this.archivesDoc = docHistory.getArchivesDoc();
   /*     */
   /* 183 */ newHistory.setDocName(docHistory.getDocName());
   /* 184 */ newHistory.setFileAttach(docHistory.getFileAttach());
   /*     */
   /* 186 */ newHistory.setMender(ContextUtil.getCurrentUser().getFullname());
   /* 187 */ newHistory.setPath(docHistory.getPath());
   /* 188 */ newHistory.setUpdatetime(new Date());
   /* 189 */ newHistory.setVersion(
       Integer.valueOf(this.archivesDoc.getCurVersion().intValue() + 1));
   /* 190 */ newHistory.setArchivesDoc(this.archivesDoc);
   /* 191 */ this.docHistoryService.save(newHistory);
   /*     */
   /* 193 */ this.archivesDoc.setCurVersion(newHistory.getVersion());
   /* 194 */ this.archivesDoc.setDocPath(newHistory.getPath());
   /* 195 */ this.archivesDoc.setFileAttach(newHistory.getFileAttach());
   /*     */
   /* 197 */ this.archivesDocService.save(this.archivesDoc);
   /*     */
   /* 199 */ StringBuffer buff = new StringBuffer("{success:true,data:");
   /* 200 */ JSONSerializer json = new JSONSerializer();
   /* 201 */ buff.append(
       json.exclude(new String[] {"class", "docHistorys"}).serialize(this.archivesDoc));
   /* 202 */ buff.append("}");
   /*     */
   /* 204 */ setJsonString(buff.toString());
   /* 205 */ return "success";
   /*     */ }
Esempio n. 2
0
 /*     */ public String save() /*     */ {
   /* 123 */ AppUser curUser = ContextUtil.getCurrentUser();
   /* 124 */ if (this.archivesDoc.getDocId() == null)
   /*     */ {
     /* 126 */ this.archivesDoc.initUsers(curUser);
     /* 127 */ this.archivesDoc.setDocStatus(Short.valueOf(ArchivesDoc.STATUS_MODIFY));
     /* 128 */ this.archivesDoc.setUpdatetime(new Date());
     /* 129 */ this.archivesDoc.setCreatetime(new Date());
     /* 130 */ this.archivesDoc.setCurVersion(Integer.valueOf(ArchivesDoc.ORI_VERSION));
     /* 131 */ this.archivesDoc.setFileAttach(
         this.fileAttachService.getByPath(this.archivesDoc.getDocPath()));
     /* 132 */ this.archivesDocService.save(this.archivesDoc);
     /*     */ }
   /*     */ else {
     /* 135 */ ArchivesDoc oldVersion =
         (ArchivesDoc) this.archivesDocService.get(this.archivesDoc.getDocId());
     /* 136 */ this.archivesDoc.setCreatetime(oldVersion.getCreatetime());
     /* 137 */ this.archivesDoc.setArchives(oldVersion.getArchives());
     /* 138 */ this.archivesDoc.setCreatorId(oldVersion.getCreatorId());
     /* 139 */ this.archivesDoc.setFileAttach(
         this.fileAttachService.getByPath(this.archivesDoc.getDocPath()));
     /* 140 */ this.archivesDoc.setCreator(oldVersion.getCreator());
     /* 141 */ this.archivesDoc.setDocStatus(Short.valueOf(ArchivesDoc.STATUS_MODIFY));
     /* 142 */ this.archivesDoc.setUpdatetime(new Date());
     /* 143 */ this.archivesDoc.setCurVersion(
         Integer.valueOf(oldVersion.getCurVersion().intValue() + 1));
     /* 144 */ this.archivesDoc.setMender(curUser.getFullname());
     /* 145 */ this.archivesDoc.setMenderId(curUser.getUserId());
     /* 146 */ this.archivesDoc.setDocHistorys(oldVersion.getDocHistorys());
     /* 147 */ this.archivesDoc.setFileAttach(
         this.fileAttachService.getByPath(this.archivesDoc.getDocPath()));
     /* 148 */ this.archivesDocService.merge(this.archivesDoc);
     /*     */ }
   /*     */
   /* 152 */ DocHistory docHistory = new DocHistory();
   /* 153 */ docHistory.setArchivesDoc(this.archivesDoc);
   /* 154 */ docHistory.setFileAttach(
       this.fileAttachService.getByPath(this.archivesDoc.getDocPath()));
   /* 155 */ docHistory.setDocName(this.archivesDoc.getDocName());
   /* 156 */ docHistory.setPath(this.archivesDoc.getDocPath());
   /* 157 */ docHistory.setVersion(this.archivesDoc.getCurVersion());
   /* 158 */ docHistory.setUpdatetime(new Date());
   /* 159 */ docHistory.setMender(curUser.getFullname());
   /* 160 */ this.docHistoryService.save(docHistory);
   /*     */
   /* 165 */ StringBuffer buff = new StringBuffer("{success:true,data:");
   /*     */
   /* 167 */ JSONSerializer json = new JSONSerializer();
   /* 168 */ buff.append(
       json.exclude(new String[] {"class", "docHistorys"}).serialize(this.archivesDoc));
   /*     */
   /* 170 */ buff.append("}");
   /*     */
   /* 172 */ setJsonString(buff.toString());
   /* 173 */ return "success";
   /*     */ }