14 package cz.vutbr.fit.knot.annotations.modules.suggestionManager.alternative;
20 import java.io.Serializable;
21 import javax.persistence.Basic;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.Lob;
29 import javax.persistence.ManyToOne;
30 import javax.persistence.NamedQueries;
31 import javax.persistence.NamedQuery;
32 import javax.persistence.Table;
33 import javax.validation.constraints.NotNull;
34 import javax.validation.constraints.Size;
35 import javax.xml.bind.annotation.XmlRootElement;
36 import javax.xml.xpath.XPathExpressionException;
46 @Table(name =
"alternativeFragment")
49 @NamedQuery(name =
"AlternativeFragment.findAll", query =
"SELECT a FROM AlternativeFragment a"),
50 @NamedQuery(name =
"AlternativeFragment.findById", query =
"SELECT a FROM AlternativeFragment a WHERE a.id = :id"),
51 @NamedQuery(name =
"AlternativeFragment.findByAlternative", query =
"SELECT a FROM AlternativeFragment a WHERE a.alternative = :alternative"),
52 @NamedQuery(name =
"AlternativeFragment.findByOffset", query =
"SELECT a FROM AlternativeFragment a WHERE a.offset = :frOffset"),
53 @NamedQuery(name =
"AlternativeFragment.findByLength", query =
"SELECT a FROM AlternativeFragment a WHERE a.length = :frLength"),
54 @NamedQuery(name =
"AlternativeFragment.findByIsGood", query =
"SELECT a FROM AlternativeFragment a WHERE a.isGood = :isGood"),
55 @NamedQuery(name =
"AlternativeFragment.deleteByAltId", query =
"DELETE FROM AlternativeFragment a WHERE a.alternative = :altId")
58 private static final long serialVersionUID = 1L;
62 @GeneratedValue(strategy = GenerationType.IDENTITY)
63 @Basic(optional =
false)
68 @Basic(optional = false)
70 @Column(name = "alternative", nullable = false, insertable = false, updatable = false)
71 private
int alternative;
75 @Size(max = 2147483647)
76 @Column(name = "path")
80 @Column(name = "offset")
81 private Integer offset;
84 @Column(name = "fLength")
85 private Integer length;
88 @Basic(optional = false)
91 @Size(min = 0, max = 16777215)
92 @Column(name = "annotatedText")
93 private String annotatedText;
98 @Basic(optional = false)
100 @Column(name = "isGood")
101 private
boolean isGood;
106 @ManyToOne(optional = false)
107 @JoinColumn(name = "alternative", referencedColumnName = "
id")
127 this.offset = offset;
128 this.length = length;
129 this.annotatedText = annotatedText;
130 this.refAlternative = refAlternative;
146 this.offset = offset;
147 this.length = length;
148 this.annotatedText = annotatedText;
149 this.refAlternative = refAlternative;
150 this.isGood = isGood;
162 this.offset = offset;
163 this.length = length;
200 this.alternative = alternative;
236 this.offset = offset;
255 this.length = length;
265 return annotatedText;
274 this.annotatedText = annotatedText;
293 this.isGood = isGood;
302 return refAlternative;
312 return refAlternative;
321 this.refAlternative = refAlternative;
332 this.refAlternative = (Alternative) value;
353 this.path = uf.getXPathString();
355 this.path = uf.getXPathString() +
"/text()";
357 this.offset = uf.getOffset();
358 this.length = uf.getLength();
359 this.annotatedText = uf.getText();
368 this.path = fr.getPath();
369 this.length = fr.getLength();
370 this.offset = fr.getOffset();
371 this.annotatedText = fr.getAnnotatedText();
372 this.isGood = fr.getIsGood();
388 AlternativeFragment other = (AlternativeFragment)
object;
390 if (this.path != other.
path && (
this.path == null || !
this.path.equals(other.
path))) {
393 if (this.offset != other.
offset && (
this.offset == null || !
this.offset.equals(other.
offset))) {
396 if (this.length != other.
length && (
this.length == null || !
this.length.equals(other.
length))) {
399 if ((this.annotatedText == null) ? (other.annotatedText != null) : !this.annotatedText.equals(other.
annotatedText)) {
418 if ((this.path == null) ? (other.
getPath() != null) : !this.path.equals(other.
getPath())) {
419 if ((this.path == null) ? (other.getPath() != null) : !this.path.equals(other.getPath().concat(
"/text()"))) {
423 if (this.offset != other.
getOffset() && (this.offset == null || !this.offset.equals(other.getOffset()))) {
426 if (this.length != other.
getLength() && (this.length == null || !this.length.equals(other.getLength()))) {
429 if ((this.annotatedText == null) ? (other.getAnnotatedText() != null) : !this.annotatedText.equals(other.getAnnotatedText())) {
447 if (getClass() != obj.getClass()) {
451 if ((this.path == null) ? (other.path != null) : !this.path.equals(other.
path)) {
452 if ((this.path == null) ? (other.path != null) : !this.path.equals(other.
path.concat(
"/text()"))) {
456 if (this.offset != other.
offset && (
this.offset == null || !
this.offset.equals(other.
offset))) {
459 if (this.length != other.
length && (
this.length == null || !
this.length.equals(other.
length))) {
462 if ((this.annotatedText == null) ? (other.annotatedText != null) : !this.annotatedText.equals(other.
annotatedText)) {
484 if (this.offset != uf.
getOffset() && (this.offset == null || !this.offset.equals(uf.getOffset()))) {
487 if (this.length != uf.
getLength() && (this.length == null || !this.length.equals(uf.getLength()))) {
490 if ((this.annotatedText == null) ? (uf.getText() != null) : !this.annotatedText.equals(uf.getText())) {
504 invalid =
" valid=\"false\"";
506 return "<a:fragment" + invalid +
">"
507 +
"<a:path>" + path +
"</a:path>"
508 +
"<a:offset>" + offset +
"</a:offset>"
509 +
"<a:length>" + length +
"</a:length>"
510 +
"<a:annotatedText>" + Util.toHTMLString(annotatedText) +
"</a:annotatedText>"
517 hash += (
id != null ? id.hashCode() : 0);
518 hash += (offset != null ? offset.hashCode() : 0);
519 hash += (length != null ? length.hashCode() : 0);
520 hash += (annotatedText != null ? annotatedText.hashCode() : 0);
526 return "cz.vutbr.fit.knot.annotations.modules.suggestionManager.SuggestionFragment[ id=" +
id +
" ]";
539 throw new UnsupportedOperationException(
"Not supported yet.");
541 AlternativeFragment other = (AlternativeFragment)
object;
542 int compareResult = offset.compareTo(other.getOffset());
543 if (compareResult == 0) {
544 compareResult = length.compareTo(other.getLength());
547 return compareResult;
SecSuggestion getRefSecSuggestion()
AlternativeFragment(String path, Integer offset, Integer length)
Interface for Suggestion and Alternative.
Alternative getRefAlternative()
void updateFromFragment(Fragment fr)
String getAnnotatedText()
void setRefSecSuggestion(SecSuggestion value)
boolean contentEqualsForSec(SuggestionFragment other)
void updateWithUpdatableFragment(UpdatableFragment uf)
void setPath(String path)
void setRefAlternative(Alternative refAlternative)
Class representing suggested annotation fragment.
void setIsGood(boolean isGood)
Class representing fragment for suggestion alternative.
Class for XML document fragment.
UpdatableFragment toUpdatableFragment()
void setAnnotatedText(String annotatedText)
boolean fragmentEqualsWUF(UpdatableFragment uf)
void setAlternative(int alternative)
Class representing alternative of suggestion.
void setOffset(Integer offset)
boolean equals(Object object)
void setLength(Integer length)
int compareTo(Object object)
Utility class (manipulates RFC 3339 dates)
Class representing annotated fragment.
boolean contentEquals(Object obj)
AlternativeFragment(String path, Integer offset, Integer length, String annotatedText, Alternative refAlternative)
AlternativeFragment(String path, Integer offset, Integer length, String annotatedText, Alternative refAlternative, Boolean isGood)
Interface for SuggestionFragment and AlternativeFragment.