コード例 #1
0
ファイル: CreateKeyJob.java プロジェクト: jior/wechat
 public void execute(JobExecutionContext context) throws JobExecutionException {
   StringBuffer sb = new StringBuffer();
   for (int i = 0; i < 32; i++) {
     sb.append(UUID32.getUUID());
   }
   FileUtils.save("/key", sb.toString().getBytes());
 }
コード例 #2
0
ファイル: FileExecutionHelper.java プロジェクト: jior/glaf
 public void save(Connection connection, String serviceKey, File file) {
   String sql =
       " insert into "
           + BlobItemDomainFactory.TABLENAME
           + " (ID_, BUSINESSKEY_, FILEID_, SERVICEKEY_, NAME_, TYPE_, FILENAME_, PATH_, LASTMODIFIED_, LOCKED_, STATUS_, DATA_, CREATEBY_, CREATEDATE_)"
           + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
   PreparedStatement psmt = null;
   try {
     psmt = connection.prepareStatement(sql);
     psmt.setString(1, UUID32.getUUID());
     psmt.setString(2, serviceKey);
     psmt.setString(3, DigestUtils.md5Hex(file.getAbsolutePath()));
     psmt.setString(4, serviceKey);
     psmt.setString(5, file.getName());
     psmt.setString(6, "Execution");
     psmt.setString(7, file.getAbsolutePath());
     psmt.setString(8, file.getAbsolutePath());
     psmt.setLong(9, file.lastModified());
     psmt.setInt(10, 0);
     psmt.setInt(11, 1);
     psmt.setBytes(12, FileUtils.getBytes(file));
     psmt.setString(13, "system");
     psmt.setTimestamp(14, DateUtils.toTimestamp(new java.util.Date()));
     psmt.executeUpdate();
   } catch (Exception ex) {
     logger.error(ex);
     ex.printStackTrace();
     throw new RuntimeException(ex);
   } finally {
     JdbcUtils.close(psmt);
   }
 }