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  
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   * Business data object
33   */
34  public class Business {
35  
36    @JsonProperty("HOSTID")
37    private String hostid;
38  
39    @JsonProperty("BUSINESS")
40    private String business;
41  
42    @JsonProperty("ROLES")
43    private String roles;
44  
45    @JsonProperty("ALIASES")
46    private String aliases;
47  
48    @JsonProperty("OTHERS")
49    private String others;
50  
51    @JsonProperty("UPDATEDINFO")
52    private UpdatedInfo updatedInfo = UpdatedInfo.UNKNOWN;
53  
54    /**
55     * Empty constructor
56     */
57    public Business() {
58      // Nothing
59    }
60  
61    public Business(final String hostid, final String business,
62                    final String roles, final String aliases, final String others,
63                    final UpdatedInfo updatedInfo)
64        throws WaarpDatabaseSqlException {
65      this(hostid, business, roles, aliases, others);
66      this.updatedInfo = updatedInfo;
67    }
68  
69    public Business(final String hostid, final String business,
70                    final String roles, final String aliases, final String others)
71        throws WaarpDatabaseSqlException {
72      this.hostid = hostid;
73      this.business = business;
74      this.roles = roles;
75      this.aliases = aliases;
76      this.others = others;
77      checkValues();
78    }
79  
80    @JsonIgnore
81    public final void checkValues() throws WaarpDatabaseSqlException {
82      validateLength(Types.LONGVARCHAR, business, roles, aliases, others);
83      validateLength(Types.NVARCHAR, hostid);
84    }
85  
86    public final String getHostid() {
87      return hostid;
88    }
89  
90    public final void setHostid(final String hostid) {
91      this.hostid = hostid;
92    }
93  
94    public final String getBusiness() {
95      return business;
96    }
97  
98    public final void setBusiness(final String business) {
99      this.business = business;
100   }
101 
102   public final String getRoles() {
103     return roles;
104   }
105 
106   public final void setRoles(final String roles) {
107     this.roles = roles;
108   }
109 
110   public final String getAliases() {
111     return aliases;
112   }
113 
114   public final void setAliases(final String aliases) {
115     this.aliases = aliases;
116   }
117 
118   public final String getOthers() {
119     return others;
120   }
121 
122   public final void setOthers(final String others) {
123     this.others = others;
124   }
125 
126   public final UpdatedInfo getUpdatedInfo() {
127     return updatedInfo;
128   }
129 
130   public final void setUpdatedInfo(final UpdatedInfo info) {
131     updatedInfo = info;
132   }
133 }