Ejemplo n.º 1
0
 protected BlobInfo getBlobInfo(T state) throws PropertyException {
   BlobInfo blobInfo = new BlobInfo();
   blobInfo.key = (String) state.getSingle(BLOB_DATA);
   blobInfo.filename = (String) state.getSingle(BLOB_NAME);
   blobInfo.mimeType = (String) state.getSingle(BLOB_MIME_TYPE);
   blobInfo.encoding = (String) state.getSingle(BLOB_ENCODING);
   blobInfo.digest = (String) state.getSingle(BLOB_DIGEST);
   blobInfo.length = (Long) state.getSingle(BLOB_LENGTH);
   return blobInfo;
 }
Ejemplo n.º 2
0
 protected void setValueBlob(T state, Blob blob) throws PropertyException {
   BlobInfo blobInfo = new BlobInfo();
   if (blob != null) {
     BlobManager blobManager = Framework.getService(BlobManager.class);
     try {
       blobInfo.key = blobManager.writeBlob(blob, this);
     } catch (IOException e) {
       throw new PropertyException("Cannot get blob info for: " + blob, e);
     }
     blobInfo.filename = blob.getFilename();
     blobInfo.mimeType = blob.getMimeType();
     blobInfo.encoding = blob.getEncoding();
     blobInfo.digest = blob.getDigest();
     blobInfo.length = blob.getLength() == -1 ? null : Long.valueOf(blob.getLength());
   }
   setBlobInfo(state, blobInfo);
 }