All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.bonita.pvm.internal.lob.Blob Maven / Gradle / Ivy

package org.ow2.bonita.pvm.internal.lob;

import java.io.Serializable;
import java.util.List;

import org.ow2.bonita.env.Environment;

public class Blob implements Serializable {

  private static final long serialVersionUID = 1L;

  public static final BlobStrategy DEFAULT_BLOB_STRATEGY = new BlobStrategyChopped();

  // MAP WITH HIBERNATE AS COMPONENT

  protected java.sql.Blob blob;
  protected byte[] bytes;
  protected List chops;
  protected String fileName;

  public Blob() {
  }

  public Blob(byte[] bytes) {
    getBlobStrategy().set(bytes, this);
  }

  public byte[] extractBytes() {
    return getBlobStrategy().get(this);
  }

  protected BlobStrategy getBlobStrategy() {
    BlobStrategy blobStrategy = null;

    Environment environment = Environment.getCurrent();
    if (environment != null) {
      blobStrategy = environment.get(BlobStrategy.class);
    }

    if (blobStrategy == null) {
      blobStrategy = DEFAULT_BLOB_STRATEGY;
    }

    return blobStrategy;
  }

  public java.sql.Blob getBlob() {
    return blob;
  }

  public void setBlob(java.sql.Blob blob) {
    this.blob = blob;
  }

  public List getChops() {
    return chops;
  }

  public void setChops(List chops) {
    this.chops = chops;
  }

  public byte[] getBytes() {
    return bytes;
  }

  public void setBytes(byte[] bytes) {
    this.bytes = bytes;
  }

  public String getFileName() {
    return fileName;
  }

  public void setFileName(String fileName) {
    this.fileName = fileName;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy