4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
SavedMessage.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: SavedMessage.java
5  * Description: Class represent saved message that unavailable StoryScope
6  */
7 
8 /**
9  * @file SavedMessage.java
10  *
11  * @brief Class represent message that belongs to the StoryScope and it was
12  * saved because StoryScope was not available
13  */
14 
15 package cz.vutbr.fit.knot.annotations.modules.StoryscopeInterface;
16 
17 import java.io.Serializable;
18 import javax.persistence.*;
19 
20 /**
21  * Class represent message that belongs to the StoryScope and it was
22  * saved because StoryScope was not available.
23  *
24  * @brief This class represent saved message that belongs unavailable StoryScope.
25  * @author Martin Petr (xpetrm05)
26  */
27 @Entity
28 @Table(name = "savedMessages")
29 @NamedQueries({
30  @NamedQuery(name = "SavedMessage.findAll", query = "SELECT s FROM SavedMessage s"),
31  @NamedQuery(name = "SavedMessage.findById", query = "SELECT s FROM SavedMessage s WHERE s.id = :id"),
32  @NamedQuery(name = "SavedMessage.findByStoryScopeId", query = "SELECT s FROM SavedMessage s WHERE s.storyScopeId = :storyScopeId"),
33  @NamedQuery(name = "SavedMessage.findByStoryScopeAndType", query = "SELECT s FROM SavedMessage s WHERE s.storyScopeId = :storyScopeId AND s.messageType = :messageType")})
34 public class SavedMessage implements Serializable {
35  /** Id of message */
36  @Id
37  @GeneratedValue(strategy = GenerationType.IDENTITY)
38  @Basic(optional = false)
39  @Column(name = "id")
40  private Integer id;
41 
42  /** Id of StoryScope that this message belongs */
43  @Basic(optional = false)
44  @Column(name = "storyScopeId")
45  private Integer storyScopeId;
46 
47  /** Type of message (add,change,remove) */
48  @Basic(optional = false)
49  @Column(name = "messageType")
50  private int messageType;
51 
52  /** Saved message*/
53  @Basic(optional = false)
54  @Column(name = "message")
55  private String message;
56 
57  /** Add message indicator */
58  public static final int MESSAGE_ADD = 0;
59  /** Change message indicator */
60  public static final int MESSAGE_CHANGE = 1;
61  /** Remove message indicator */
62  public static final int MESSAGE_DELETE = 2;
63 
64  /**
65  * Constructor
66  */
67  public SavedMessage() {
68  }
69 
70  /**
71  * Constructor
72  *
73  * @param storyScopeId id of StoryScope that this message belongs
74  * @param messageType type of message (add,change,remove)
75  * @param message messsage content to store
76  */
77  public SavedMessage(Integer storyScopeId, int messageType, String message) {
78  this.storyScopeId = storyScopeId;
79  this.messageType = messageType;
80  this.message = message;
81  }
82 
83  /**
84  * Gets id of saved message
85  *
86  * @return Returns id of saved message
87  */
88  public Integer getId() {
89  return id;
90  }
91 
92  /**
93  * Sets id of StoryScope
94  *
95  * @param id Id of StoryScope
96  */
97  public void setId(Integer id) {
98  this.id = id;
99  }
100 
101  /**
102  * Gets id of StoryScope that this message belongs
103  *
104  * @return Returns id of StoryScope
105  */
106  public Integer getStoryScopeId() {
107  return storyScopeId;
108  }
109 
110  /**
111  * Sets id of StoryScope that this message belongs
112  *
113  * @param storyScopeId Id of StoryScope
114  */
115  public void setStoryScopeId(Integer storyScopeId) {
116  this.storyScopeId = storyScopeId;
117  }
118 
119  /**
120  * Gets type of message
121  *
122  * @return Returns type of message
123  */
124  public int getMessageType() {
125  return messageType;
126  }
127 
128  /**
129  * Sets type of message
130  *
131  * @param messageType Type of message
132  */
133  public void setMessageType(int messageType) {
134  this.messageType = messageType;
135  }
136 
137  /**
138  * Gets saved message for StoryScope
139  *
140  * @return Returns saved message
141  */
142  public String getMessage() {
143  return message;
144  }
145 
146  /**
147  * Sets saved message for StoryScope
148  *
149  * @param message Message for save
150  */
151  public void setMessage(String message) {
152  this.message = message;
153  }
154 
155 } // public class SavedMessage
SavedMessage(Integer storyScopeId, int messageType, String message)
This class represent saved message that belongs unavailable StoryScope.