PBlobInfo.java from Texai at Krugle
Show PBlobInfo.java syntax highlighted
/*
* PBlobInfo.java
*
* Created on October 24, 2006, 1:46 PM
*
* Description: Contains the specialized fields for PBlob.
*
* Copyright (C) 2006 Stephen L. Reed.
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.texai.kb.ejb.entity;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Transient;
import javax.sql.rowset.serial.SerialBlob;
/**
* Entity class PBlobInfo
*
* @author reed
*/
@Entity
public class PBlobInfo implements Serializable {
/**
* Determines if a de-serialized file is compatible with this class.
*
* Maintainers must change this value if and only if the new version
* of this class is not compatible with old versions. See Sun docs
* for <a href=http://java.sun.com/products/jdk/1.1/docs/guide
* /serialization/spec/version.doc.html> details. </a>
*
* Not necessary to include in first version of the class, but
* included here as a reminder of its importance.
*/
@Transient
private static final long serialVersionUID = 1L;
/** the id */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long pBlobInfoId; // NOPMD
/** the persistent binary large object */
@OneToOne
private PBlob pBlob; // NOPMD
/** the binary large object value */
@Lob @Basic
private SerialBlob blobValue; // NOPMD
/** Creates a new instance of PBlobInfo */
public PBlobInfo() {
super();
}
/** Creates a new instance of PBlobInfo.
*
* @param pBlob the persistent binary large object
* @param blobValue the binary large object value
*/
public PBlobInfo(final PBlob pBlob, final SerialBlob blobValue) {
super();
//Preconditions
assert pBlob != null : "pBlob must not be null";
assert blobValue != null : "blobValue must not be null";
this.pBlob = pBlob;
this.blobValue = blobValue;
}
/**
* Gets the id of this PBlobInfo.
*
* @return the id
*/
public Long getId() {
return this.pBlobInfoId;
}
/** Gets the binary large object value.
*
* @return the binary large object value
*/
public SerialBlob getBlobValue() {
return blobValue;
}
/** Returns a string representation of this object.
*
* @return a string representation of this object
*/
@Override
public String toString() {
return blobValue.toString();
}
/** Returns a CycL representation of this object.
*
* @return a CycL representation of this object
*/
public String toCycLString() {
return toString();
}
/** gets the persistent binary large object
*
* @return the persistent binary large object
*/
public PBlob getPBlob() {
return pBlob;
}
}
See more files for this project here