View Javadoc
1   /*
2    * This file is part of Waarp Project (named also Waarp or GG).
3    *
4    *  Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
5    *  tags. See the COPYRIGHT.txt in the distribution for a full listing of
6    * individual contributors.
7    *
8    *  All Waarp Project is free software: you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License, or (at your
11   * option) any later version.
12   *
13   * Waarp is distributed in the hope that it will be useful, but WITHOUT ANY
14   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License along with
18   * Waarp . If not, see <http://www.gnu.org/licenses/>.
19   */
20  package org.waarp.openr66.protocol.localhandler.packet.json;
21  
22  import org.waarp.openr66.protocol.localhandler.packet.LocalPacketFactory;
23  
24  import static org.waarp.common.database.DbConstant.*;
25  
26  /**
27   * Import Configuration JSON packet
28   */
29  public class ConfigImportJsonPacket extends JsonPacket {
30  
31    protected boolean purgehost;
32    protected boolean purgerule;
33    protected boolean purgebusiness;
34    protected boolean purgealias;
35    protected boolean purgeroles;
36    protected String host;
37    protected String rule;
38    protected String business;
39    protected String alias;
40    protected String roles;
41    protected long hostid = ILLEGALVALUE;
42    protected long ruleid = ILLEGALVALUE;
43    protected long businessid = ILLEGALVALUE;
44    protected long aliasid = ILLEGALVALUE;
45    protected long rolesid = ILLEGALVALUE;
46  
47    /**
48     * @return the purgehost
49     */
50    public final boolean isPurgehost() {
51      return purgehost;
52    }
53  
54    /**
55     * @param purgehost the purgehost to set
56     */
57    public final void setPurgehost(final boolean purgehost) {
58      this.purgehost = purgehost;
59    }
60  
61    /**
62     * @return the purgerule
63     */
64    public final boolean isPurgerule() {
65      return purgerule;
66    }
67  
68    /**
69     * @param purgerule the purgerule to set
70     */
71    public final void setPurgerule(final boolean purgerule) {
72      this.purgerule = purgerule;
73    }
74  
75    /**
76     * @return the purgebusiness
77     */
78    public final boolean isPurgebusiness() {
79      return purgebusiness;
80    }
81  
82    /**
83     * @param purgebusiness the purgebusiness to set
84     */
85    public final void setPurgebusiness(final boolean purgebusiness) {
86      this.purgebusiness = purgebusiness;
87    }
88  
89    /**
90     * @return the purgealias
91     */
92    public final boolean isPurgealias() {
93      return purgealias;
94    }
95  
96    /**
97     * @param purgealias the purgealias to set
98     */
99    public final void setPurgealias(final boolean purgealias) {
100     this.purgealias = purgealias;
101   }
102 
103   /**
104    * @return the purgeroles
105    */
106   public final boolean isPurgeroles() {
107     return purgeroles;
108   }
109 
110   /**
111    * @param purgeroles the purgeroles to set
112    */
113   public final void setPurgeroles(final boolean purgeroles) {
114     this.purgeroles = purgeroles;
115   }
116 
117   /**
118    * @return the host
119    */
120   public final String getHost() {
121     return host;
122   }
123 
124   /**
125    * @param host the host to set
126    */
127   public final void setHost(final String host) {
128     this.host = host;
129   }
130 
131   /**
132    * @return the rule
133    */
134   public String getRule() {
135     return rule;
136   }
137 
138   /**
139    * @param rule the rule to set
140    */
141   public final void setRule(final String rule) {
142     this.rule = rule;
143   }
144 
145   /**
146    * @return the business
147    */
148   public final String getBusiness() {
149     return business;
150   }
151 
152   /**
153    * @param business the business to set
154    */
155   public final void setBusiness(final String business) {
156     this.business = business;
157   }
158 
159   /**
160    * @return the alias
161    */
162   public final String getAlias() {
163     return alias;
164   }
165 
166   /**
167    * @param alias the alias to set
168    */
169   public final void setAlias(final String alias) {
170     this.alias = alias;
171   }
172 
173   /**
174    * @return the roles
175    */
176   public final String getRoles() {
177     return roles;
178   }
179 
180   /**
181    * @param roles the roles to set
182    */
183   public final void setRoles(final String roles) {
184     this.roles = roles;
185   }
186 
187   /**
188    * @return the hostid
189    */
190   public final long getHostid() {
191     return hostid;
192   }
193 
194   /**
195    * @param hostid the hostid to set
196    */
197   public final void setHostid(final long hostid) {
198     this.hostid = hostid;
199   }
200 
201   /**
202    * @return the ruleid
203    */
204   public final long getRuleid() {
205     return ruleid;
206   }
207 
208   /**
209    * @param ruleid the ruleid to set
210    */
211   public final void setRuleid(final long ruleid) {
212     this.ruleid = ruleid;
213   }
214 
215   /**
216    * @return the businessid
217    */
218   public final long getBusinessid() {
219     return businessid;
220   }
221 
222   /**
223    * @param businessid the businessid to set
224    */
225   public final void setBusinessid(final long businessid) {
226     this.businessid = businessid;
227   }
228 
229   /**
230    * @return the aliasid
231    */
232   public final long getAliasid() {
233     return aliasid;
234   }
235 
236   /**
237    * @param aliasid the aliasid to set
238    */
239   public final void setAliasid(final long aliasid) {
240     this.aliasid = aliasid;
241   }
242 
243   /**
244    * @return the rolesid
245    */
246   public final long getRolesid() {
247     return rolesid;
248   }
249 
250   /**
251    * @param rolesid the rolesid to set
252    */
253   public final void setRolesid(final long rolesid) {
254     this.rolesid = rolesid;
255   }
256 
257   @Override
258   public final void fromJson(final JsonPacket other) {
259     super.fromJson(other);
260     if (other instanceof ConfigImportJsonPacket) {
261       final ConfigImportJsonPacket other2 = (ConfigImportJsonPacket) other;
262       purgehost = other2.purgehost;
263       purgerule = other2.purgerule;
264       purgebusiness = other2.purgebusiness;
265       purgealias = other2.purgealias;
266       purgeroles = other2.purgeroles;
267       host = other2.host;
268       rule = other2.rule;
269       business = other2.business;
270       alias = other2.alias;
271       roles = other2.roles;
272       hostid = other2.hostid;
273       ruleid = other2.ruleid;
274       businessid = other2.businessid;
275       aliasid = other2.aliasid;
276       rolesid = other2.rolesid;
277     }
278   }
279 
280   @Override
281   public void setRequestUserPacket() {
282     setRequestUserPacket(LocalPacketFactory.CONFIMPORTPACKET);
283   }
284 }