1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.waarp.openr66.pojo;
22
23 import com.fasterxml.jackson.annotation.JsonIgnore;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import org.waarp.common.database.exception.WaarpDatabaseSqlException;
26
27 import java.sql.Types;
28
29 import static org.waarp.common.database.data.AbstractDbData.*;
30
31
32
33
34 public class Limit {
35
36 @JsonProperty("HOSTID")
37 private String hostid;
38
39 @JsonProperty("READGLOBALLIMIT")
40 private long readGlobalLimit;
41
42 @JsonProperty("WRITEGLOBALLIMIT")
43 private long writeGlobalLimit;
44
45 @JsonProperty("READSESSIONLIMIT")
46 private long readSessionLimit;
47
48 @JsonProperty("WRITESESSIONLIMIT")
49 private long writeSessionLimit;
50
51 @JsonProperty("DELAYLIMIT")
52 private long delayLimit;
53
54 @JsonProperty("UPDATEDINFO")
55 private UpdatedInfo updatedInfo = UpdatedInfo.UNKNOWN;
56
57
58
59
60 public Limit() {
61
62 }
63
64 public Limit(final String hostid, final long delayLimit,
65 final long readGlobalLimit, final long writeGlobalLimit,
66 final long readSessionLimit, final long writeSessionLimit,
67 final UpdatedInfo updatedInfo) throws WaarpDatabaseSqlException {
68 this(hostid, delayLimit, readGlobalLimit, writeGlobalLimit,
69 readSessionLimit, writeSessionLimit);
70 this.updatedInfo = updatedInfo;
71 }
72
73 public Limit(final String hostid, final long delayLimit,
74 final long readGlobalLimit, final long writeGlobalLimit,
75 final long readSessionLimit, final long writeSessionLimit)
76 throws WaarpDatabaseSqlException {
77 this.hostid = hostid;
78 this.delayLimit = delayLimit;
79 this.readGlobalLimit = readGlobalLimit;
80 this.writeGlobalLimit = writeGlobalLimit;
81 this.readSessionLimit = readSessionLimit;
82 this.writeSessionLimit = writeSessionLimit;
83 checkValues();
84 }
85
86 public Limit(final String hostid, final long delayLimit)
87 throws WaarpDatabaseSqlException {
88 this(hostid, delayLimit, 0, 0, 0, 0);
89 }
90
91 @JsonIgnore
92 public final void checkValues() throws WaarpDatabaseSqlException {
93 validateLength(Types.NVARCHAR, hostid);
94 }
95
96 public final String getHostid() {
97 return hostid;
98 }
99
100 public final void setHostid(final String hostid) {
101 this.hostid = hostid;
102 }
103
104 public final long getReadGlobalLimit() {
105 return readGlobalLimit;
106 }
107
108 public final void setReadGlobalLimit(final long readGlobalLimit) {
109 this.readGlobalLimit = readGlobalLimit;
110 }
111
112 public final long getWriteGlobalLimit() {
113 return writeGlobalLimit;
114 }
115
116 public final void setWriteGlobalLimit(final long writeGlobalLimit) {
117 this.writeGlobalLimit = writeGlobalLimit;
118 }
119
120 public final long getReadSessionLimit() {
121 return readSessionLimit;
122 }
123
124 public final void setReadSessionLimit(final long readSessionLimit) {
125 this.readSessionLimit = readSessionLimit;
126 }
127
128 public final long getWriteSessionLimit() {
129 return writeSessionLimit;
130 }
131
132 public final void setWriteSessionLimit(final long writeSessionLimit) {
133 this.writeSessionLimit = writeSessionLimit;
134 }
135
136 public final long getDelayLimit() {
137 return delayLimit;
138 }
139
140 public final void setDelayLimit(final long delayLimit) {
141 this.delayLimit = delayLimit;
142 }
143
144 public final UpdatedInfo getUpdatedInfo() {
145 return updatedInfo;
146 }
147
148 public final void setUpdatedInfo(final UpdatedInfo info) {
149 updatedInfo = info;
150 }
151 }