4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
SugImageAttribute.java
Go to the documentation of this file.
1 /*
2  * Project: Server for annotations sharing
3  * Author: Ing. Jaroslav Dytrych idytrych@fit.vutbr.cz
4  * File: SugImageAttribute.java
5  * Description: Class representing attribute of type Image for pruposes of suggestion
6  */
7 
8 package cz.vutbr.fit.knot.annotations.modules.suggestionManager.attributes;
9 
12 import javax.persistence.DiscriminatorValue;
13 import javax.persistence.Entity;
14 import javax.persistence.NamedQueries;
15 import javax.persistence.NamedQuery;
16 
17 /**
18  * @file SugImageAttribute.java
19  *
20  * @brief Class representing attribute of type Image for pruposes of suggestion
21  */
22 
23 /**
24  * Class representing attribute of type Image for pruposes of suggestion
25  *
26  * @brief Class representing attribute of type Image for pruposes of suggestion
27  */
28 @Entity
29 @DiscriminatorValue("Image")
30 @NamedQueries({
31  @NamedQuery(name = "SuggestionAttribute.findByImageUri", query = "SELECT a FROM SuggestionAttribute a WHERE a.uri = :uri"),
32 })
33 public class SugImageAttribute extends SugStringAttribute {
34 
35  /**
36  * Constructor
37  */
38  public SugImageAttribute() {
39  }
40 
41  /**
42  * Constructor
43  *
44  * @param name Name of the attribute
45  * @param value Value of the attribute
46  * @param refSuggestion Suggestion to which this attribute belongs
47  */
48  public SugImageAttribute(String name, String value, Suggestion refSuggestion) {
49  this.name = name;
50  this.simpleType = "Image";
51  this.uri = value;
52  this.refSuggestion = refSuggestion;
53  }
54 
55  /**
56  * Constructor
57  *
58  * @param name Name of the attribute
59  * @param value Value of the attribute
60  * @param refSuggestion Suggestion to which this attribute belongs
61  * @param priority Priority of attribute
62  */
63  public SugImageAttribute(String name, String value, Suggestion refSuggestion, Integer priority) {
64  this.name = name;
65  this.simpleType = "Image";
66  this.uri = value;
67  this.refSuggestion = refSuggestion;
68  this.priority = priority;
69  }
70 
71  /**
72  * Gets value of the attribute
73  *
74  * @return Returns value of the attribute
75  */
76  @Override
77  public Object getValue() {
78  return this.uri;
79  }
80 
81  /**
82  * Sets value of the attribute. Value should already be a native java value.
83  *
84  * @param value New value of the attribute
85  */
86  @Override
87  public void setValue(Object value) {
88  this.uri = (String) value;
89  }
90 
91  /**
92  * Parses provided value and sets that value as a value of attribute
93  *
94  * @param value new value of the attribute in raw form from XML
95  */
96  @Override
97  public void setRawValue(String value) {
98  this.uri = value;
99  }
100 
101  /**
102  * Gets URI addres in ontology for this type of attribute
103  *
104  * @return Return URI addres in ontology for this type of attribute.
105  */
106  @Override
107  public String getTypeOntologyUri(){
108  return Constants.IMAGE_URI;
109  }
110 }
Class representing attribute of type Image for pruposes of suggestion.
SugImageAttribute(String name, String value, Suggestion refSuggestion, Integer priority)
Class representing attribute of type String for prupose of suggestion.
Class representing suggestion of annotation.
Definition: Suggestion.java:87