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;
   }
 }
Example #2
0
 @Override
 public List<SavedQuery> handle(ResultSet resultSet) throws SQLException {
   List<SavedQuery> queries = Lists.newArrayList();
   while (resultSet.next()) {
     long id = resultSet.getLong(ID_COL_NAME);
     final String name =
         StringEscapeUtils.unescapeEcmaScript(resultSet.getString(NAME_COL_NAME));
     final String description =
         StringEscapeUtils.unescapeEcmaScript(resultSet.getString(DESCRIPTION_COL_NAME));
     final String query =
         StringEscapeUtils.unescapeEcmaScript(resultSet.getString(QUERY_COL_NAME));
     final List<Parameter> parameterList;
     try {
       parameterList =
           deserializeFrom(
               StringEscapeUtils.unescapeEcmaScript(resultSet.getString(PARAMS_COL_NAME)));
     } catch (LensException e) {
       throw new SQLException("Cannot deserialize parameters ", e);
     }
     queries.add(new SavedQuery(id, name, description, query, parameterList));
   }
   return queries;
 }