15 package cz.vutbr.fit.knot.annotations.entity;
 
   17 import com.hp.hpl.jena.graph.query.Expression;
 
   21 import java.io.Serializable;
 
   22 import javax.persistence.Basic;
 
   23 import javax.persistence.Column;
 
   24 import javax.persistence.Entity;
 
   25 import javax.persistence.GeneratedValue;
 
   26 import javax.persistence.GenerationType;
 
   27 import javax.persistence.Id;
 
   28 import javax.persistence.JoinColumn;
 
   29 import javax.persistence.Lob;
 
   30 import javax.persistence.NamedQueries;
 
   31 import javax.persistence.NamedQuery;
 
   32 import javax.persistence.OneToOne;
 
   33 import javax.persistence.Table;
 
   42 @Table(name = 
"typeAttrOnto")
 
   44   @NamedQuery(name = 
"TypeAttrOnto.findAll", query = 
"SELECT a FROM TypeAttrOnto a"),
 
   45   @NamedQuery(name = 
"TypeAttrOnto.findById", query = 
"SELECT a FROM TypeAttrOnto a WHERE a.id = :id"),
 
   46   @NamedQuery(name = 
"TypeAttrOnto.findByUserGroup", query = 
"SELECT a FROM TypeAttrOnto a WHERE a.groupId = :groupId"),
 
   47   @NamedQuery(name = 
"TypeAttrOnto.findByName", query = 
"SELECT a FROM TypeAttrOnto a WHERE a.name = :name"),
 
   48   @NamedQuery(name = 
"TypeAttrOnto.findByNameAndGroup", query = 
"SELECT a FROM TypeAttrOnto a WHERE a.name = :name AND a.groupId = :groupId"),
 
   49   @NamedQuery(name = 
"TypeAttrOnto.findBySimpleType", query = 
"SELECT a FROM TypeAttrOnto a WHERE a.simpleType = :simpleType"),
 
   50   @NamedQuery(name = 
"TypeAttrOnto.findByType", query = 
"SELECT a FROM TypeAttrOnto a WHERE a.type = :type")})
 
   52   private static final long serialVersionUID = 1L;
 
   55   @GeneratedValue(strategy = GenerationType.IDENTITY)
 
   56   @Basic(optional = 
false)
 
   60   @Basic(optional = true)
 
   61   @Column(name = "groupId", insertable=false, updatable=false)
 
   62   private Integer groupId;
 
   64   @Basic(optional = false)
 
   65   @Column(name = "name")
 
   68   @Column(name = "simpleType")
 
   69   private String simpleType;
 
   73   @Basic(optional = true)
 
   74   @Column(name = "type", insertable=false, updatable=false)
 
   77   @Basic(optional = true)
 
   78   @Column(name = "uriInOntology")
 
   79   private String uriInOntology;
 
   81   @Basic(optional = true)
 
   83   @Column(name = "commentary")
 
   84   private String comment;
 
   87   @OneToOne(optional = true)
 
   88   @JoinColumn(name = "type", referencedColumnName = "
id")
 
   91   @OneToOne(optional = true)
 
   92   @JoinColumn(name = "groupId", referencedColumnName = "
id")
 
  120     this.simpleType = simpleType;
 
  122     this.attributeType = null;
 
  123     this.uriInOntology = null;
 
  137     this.simpleType = null;
 
  138     this.type = structuredType.getId();
 
  139     this.attributeType = structuredType;
 
  140     this.uriInOntology = null;
 
  213     this.simpleType = simpleType;
 
  243     return attributeType;
 
  252     this.attributeType = attributeType;
 
  261     return uriInOntology;
 
  270     this.uriInOntology = uriInOntology;
 
  288     this.comment = comment;
 
  294     hash += (
id != null ? id.hashCode() : 0);
 
  310     TypeAttrOnto other = (TypeAttrOnto) 
object;
 
  311     if ((this.
id == null && other.
id != null) || (this.id != null && !this.id.equals(other.id))) {
 
  328     if (getClass() != obj.getClass()) {
 
  332     if ((this.name == null) ? (other.name != null) : !this.name.equals(other.
name)) {
 
  335     if ((this.simpleType == null) ? (other.simpleType != null) : !this.simpleType.equals(other.
simpleType)) {
 
  338     if (this.type != other.
type && (
this.type == null || !
this.type.equals(other.
type))) {
 
  341     if (this.attributeType != other.
attributeType && (
this.attributeType == null || !
this.attributeType.equals(other.
attributeType))) {
 
  344     if (this.comment == null ? other.
comment != null : !
this.comment.equals(other.
comment)) {
 
  352     return "cz.vutbr.fit.knot.annotations.entity.TypeAttrOnto[id=" + 
id + 
",name=" + name + 
",simpleType=" + simpleType + 
",type=" + type + 
"]";
 
  361     String serializedCom = 
"/";
 
  362     if (comment != null && !comment.isEmpty()) {
 
  363       serializedCom = 
"><a:comment>" 
  367                     + 
"</a:comment></a:attribute";
 
  371       grStr = 
" group=\"" + group.getUri() + 
"\"";
 
  375         BaseAttribute buf = AttributeManager.createAttribute(name, simpleType, null);
 
  376         return "<a:attribute name=\"" + name + 
"\" type=\"" + buf.getSimpleType() + 
"\"" + grStr + serializedCom + 
">";
 
  379     catch (ClassNotFoundException e) {
 
  390     if (simpleType == null || simpleType.isEmpty()) {
 
  391       String serializedCom = 
"/";
 
  392       if (comment != null && !comment.isEmpty()) {
 
  393         serializedCom = 
"><a:comment>" 
  397         + 
"</a:comment></a:attribute";
 
  401         grStr = 
" group=\"" + group.getUri() + 
"\"";
 
  403       return "<a:attribute name=\"" + name + 
"\" type=\"" + attributeType.getUri()
 
  404              + 
"\"" + grStr + serializedCom + 
">";
 
  406     return simpleTypeToString();
 
  415     StringBuilder result = 
new StringBuilder();
 
  417     result.append(
"<attribute name=\"");
 
  419     result.append(
"\" uri=\"");
 
  420     result.append(uriInOntology);
 
  421     result.append(
"\" typeUri=\"");
 
  423     if(simpleType != null && !simpleType.isEmpty()){
 
  425           Integer post = Constants.SIMPLE_TYPES_NAMES_V2.indexOf(simpleType);
 
  426           result.append(Constants.SIMPLE_TYPES_URI_V2.get(post));
 
  428           result.append(simpleType);
 
  432       result.append(attributeType.getUri());
 
  438       result.append(
" groupUri=\"");
 
  439       result.append(group.getUri());
 
  443     if (comment != null && !comment.isEmpty()) {
 
  444         result.append(
"><comment><![CDATA[");
 
  445         result.append(comment);
 
  446         result.append(
"]]></comment></attribute>");
 
  451     return result.toString();
 
Class representing attribute of unknown type of annotation. 
boolean contentEquals(Object obj)
void setUriInOntology(String uriInOntology)
void setAttributeType(AnnotType attributeType)
void setSimpleType(String simpleType)
void setType(Integer type)
TypeAttrOnto(UserGroup group, String name, String simpleType)
static final ArrayList< String > SIMPLE_TYPES_NAMES_V2
void setName(String name)
String simpleTypeToString()
Class representing user group. 
String getUriInOntology()
Base class representing attribute of annotation. 
void setComment(String comment)
Class representing type of annotation. 
void setGroup(UserGroup group)
TypeAttrOnto(UserGroup group, String name, AnnotType structuredType)
Class attribute manager provides a way how to create new attributes. 
boolean equals(Object object)
AnnotType getAttributeType()