private void delete() throws ControllerException, AuthorityException, ServiceException, Exception { SysTwitterVO sysTwitter = new SysTwitterVO(); sysTwitter.setOid(this.getFields().get("oid")); DefaultResult<Boolean> result = this.sysTwitterService.deleteObject(sysTwitter); this.message = result.getSystemMessage().getValue(); if (result.getValue() && result.getValue()) { this.success = IS_YES; } }
private void save() throws ControllerException, AuthorityException, ServiceException, Exception { this.checkFields(); SysVO sys = this.findSys(); SysTwitterVO sysTwitter = new SysTwitterVO(); sysTwitter.setSystem(sys.getSysId()); sysTwitter.setTitle(this.getFields().get("title")); sysTwitter.setEnableFlag( ("true".equals(this.getFields().get("enableFlag")) ? YesNo.YES : YesNo.NO)); sysTwitter.setContent(this.getFields().get("content").getBytes()); DefaultResult<SysTwitterVO> result = this.sysTwitterService.saveObject(sysTwitter); this.message = result.getSystemMessage().getValue(); if (result.getValue() != null) { this.success = IS_YES; } }
private void update() throws ControllerException, AuthorityException, ServiceException, Exception { this.checkFields(); SysTwitterVO oldSysTwitter = new SysTwitterVO(); oldSysTwitter.setOid(this.getFields().get("oid")); DefaultResult<SysTwitterVO> oldResult = this.sysTwitterService.findObjectByOid(oldSysTwitter); if (oldResult.getValue() == null) { throw new ServiceException(oldResult.getSystemMessage().getValue()); } oldSysTwitter = oldResult.getValue(); SysTwitterVO sysTwitter = new SysTwitterVO(); sysTwitter.setOid(oldSysTwitter.getOid()); sysTwitter.setSystem(oldSysTwitter.getSystem()); sysTwitter.setTitle(this.getFields().get("title")); sysTwitter.setEnableFlag( ("true".equals(this.getFields().get("enableFlag")) ? YesNo.YES : YesNo.NO)); sysTwitter.setContent(null); // 先清除之前的blob資料 this.sysTwitterService.updateObject(sysTwitter); // 先清除之前的blob資料 String content = StringEscapeUtils.unescapeEcmaScript(this.getFields().get("content")); sysTwitter.setContent(content.getBytes()); DefaultResult<SysTwitterVO> result = this.sysTwitterService.updateObject(sysTwitter); this.message = result.getSystemMessage().getValue(); if (result.getValue() != null) { this.success = IS_YES; } }