public InputStream loadStream(Thumbnail thumb) { InputStream inputStream = null; if (thumb != null) { inputStream = new ByteArrayInputStream(Base64.decodeBase64(thumb.getImage())); } return inputStream; }
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; }