コード例 #1
0
 public InputStream loadStream(Thumbnail thumb) {
   InputStream inputStream = null;
   if (thumb != null) {
     inputStream = new ByteArrayInputStream(Base64.decodeBase64(thumb.getImage()));
   }
   return inputStream;
 }
コード例 #2
0
  public synchronized String save(Thumbnail thumbnail) {
    EntityTransaction transaction = em.getTransaction();
    String result = "{\"success\": false}";
    try {
      transaction.begin();
      em.merge(thumbnail);
      transaction.commit();
      result = "{\"success\": true}";

      updateDirtyBits(thumbnail.getItemId());
    } catch (Exception ex) {
      if (transaction.isActive()) {
        transaction.rollback();
      }
    }
    return result;
  }