PageRenderTime 40ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/simple-samples/extjs/simple-backend/src-gen/org/sample/model/auth/AuthUser.java

http://github.com/hudec/sql-processor
Java | 478 lines | 382 code | 96 blank | 0 comment | 64 complexity | 1d366b491d8942faf491870baa4611d7 MD5 | raw file
  1. package org.sample.model.auth;
  2. import ch.ralscha.extdirectspring.generator.Model;
  3. import ch.ralscha.extdirectspring.generator.ModelAssociation;
  4. import ch.ralscha.extdirectspring.generator.ModelAssociationType;
  5. import ch.ralscha.extdirectspring.generator.ModelField;
  6. import com.fasterxml.jackson.annotation.JsonIgnore;
  7. import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  8. import java.io.Serializable;
  9. import java.util.Date;
  10. import java.util.List;
  11. import java.util.Map;
  12. import java.util.Set;
  13. import javax.validation.constraints.NotNull;
  14. import javax.validation.constraints.Past;
  15. import org.hibernate.validator.constraints.NotBlank;
  16. import org.sample.model.auth.UserRole;
  17. import org.sample.web.util.DMYDateTimeSerializer;
  18. import org.sqlproc.engine.annotation.Pojo;
  19. @Pojo
  20. @Model(value = "SimpleWeb.model.AuthUser", paging = true, readMethod = "simpleService.loadAuthUsers")
  21. @SuppressWarnings("all")
  22. public class AuthUser implements Serializable {
  23. private final static long serialVersionUID = 1L;
  24. @JsonIgnore
  25. public final static String ORDER_BY_ID = "ID";
  26. @JsonIgnore
  27. public final static String ORDER_BY_USERNAME = "USERNAME";
  28. public AuthUser() {
  29. }
  30. public AuthUser(final String username, final String name) {
  31. super();
  32. setUsername(username);
  33. setName(name);
  34. }
  35. private Long id;
  36. public Long getId() {
  37. return this.id;
  38. }
  39. public void setId(final Long id) {
  40. this.id = id;
  41. }
  42. public AuthUser _setId(final Long id) {
  43. this.id = id;
  44. return this;
  45. }
  46. @NotBlank
  47. private String username;
  48. public String getUsername() {
  49. return this.username;
  50. }
  51. public void setUsername(final String username) {
  52. this.username = username;
  53. }
  54. public AuthUser _setUsername(final String username) {
  55. this.username = username;
  56. return this;
  57. }
  58. private String password;
  59. public String getPassword() {
  60. return this.password;
  61. }
  62. public void setPassword(final String password) {
  63. this.password = password;
  64. }
  65. public AuthUser _setPassword(final String password) {
  66. this.password = password;
  67. return this;
  68. }
  69. @NotBlank
  70. private String name;
  71. public String getName() {
  72. return this.name;
  73. }
  74. public void setName(final String name) {
  75. this.name = name;
  76. }
  77. public AuthUser _setName(final String name) {
  78. this.name = name;
  79. return this;
  80. }
  81. private String email;
  82. public String getEmail() {
  83. return this.email;
  84. }
  85. public void setEmail(final String email) {
  86. this.email = email;
  87. }
  88. public AuthUser _setEmail(final String email) {
  89. this.email = email;
  90. return this;
  91. }
  92. @ModelField(dateFormat = "d.m.Y")
  93. @Past
  94. private Date lastLogin;
  95. @JsonSerialize(using = DMYDateTimeSerializer.class)
  96. public Date getLastLogin() {
  97. return this.lastLogin;
  98. }
  99. @JsonSerialize(using = DMYDateTimeSerializer.class)
  100. public void setLastLogin(final Date lastLogin) {
  101. this.lastLogin = lastLogin;
  102. }
  103. public AuthUser _setLastLogin(final Date lastLogin) {
  104. this.lastLogin = lastLogin;
  105. return this;
  106. }
  107. @NotNull
  108. private Integer version = 0;
  109. public Integer getVersion() {
  110. return this.version;
  111. }
  112. public void setVersion(final Integer version) {
  113. this.version = version;
  114. }
  115. public AuthUser _setVersion(final Integer version) {
  116. this.version = version;
  117. return this;
  118. }
  119. @ModelAssociation(value = ModelAssociationType.HAS_MANY, model = UserRole.class)
  120. private List<UserRole> userRoles = new java.util.ArrayList<UserRole>();
  121. public List<UserRole> getUserRoles() {
  122. return this.userRoles;
  123. }
  124. public void setUserRoles(final List<UserRole> userRoles) {
  125. this.userRoles = userRoles;
  126. }
  127. public AuthUser _setUserRoles(final List<UserRole> userRoles) {
  128. this.userRoles = userRoles;
  129. return this;
  130. }
  131. @Override
  132. public boolean equals(final Object obj) {
  133. if (this == obj)
  134. return true;
  135. if (obj == null)
  136. return false;
  137. if (getClass() != obj.getClass())
  138. return false;
  139. AuthUser other = (AuthUser) obj;
  140. if (id == null || !id.equals(other.id))
  141. return false;
  142. return true;
  143. }
  144. @Override
  145. public int hashCode() {
  146. return java.util.Objects.hash(id);
  147. }
  148. @Override
  149. public String toString() {
  150. return "AuthUser [id=" + id + ", username=" + username + ", password=" + password + ", name=" + name + ", email=" + email + ", lastLogin=" + lastLogin + ", version=" + version + "]";
  151. }
  152. public String toStringFull() {
  153. return "AuthUser [id=" + id + ", username=" + username + ", password=" + password + ", name=" + name + ", email=" + email + ", lastLogin=" + lastLogin + ", version=" + version + ", userRoles=" + userRoles + "]";
  154. }
  155. public enum Attribute {
  156. password,
  157. email,
  158. lastLogin;
  159. }
  160. private Set<String> nullValues = new java.util.HashSet<String>();
  161. @JsonIgnore
  162. public void setNull(final AuthUser.Attribute... attributes) {
  163. if (attributes == null)
  164. throw new IllegalArgumentException();
  165. for (Attribute attribute : attributes)
  166. nullValues.add(attribute.name());
  167. }
  168. @JsonIgnore
  169. public AuthUser _setNull(final AuthUser.Attribute... attributes) {
  170. setNull(attributes);
  171. return this;
  172. }
  173. @JsonIgnore
  174. public void clearNull(final AuthUser.Attribute... attributes) {
  175. if (attributes == null)
  176. throw new IllegalArgumentException();
  177. for (Attribute attribute : attributes)
  178. nullValues.remove(attribute.name());
  179. }
  180. @JsonIgnore
  181. public AuthUser _clearNull(final AuthUser.Attribute... attributes) {
  182. clearNull(attributes);
  183. return this;
  184. }
  185. public void setNull(final String... attributes) {
  186. if (attributes == null)
  187. throw new IllegalArgumentException();
  188. for (String attribute : attributes)
  189. nullValues.add(attribute);
  190. }
  191. public AuthUser _setNull(final String... attributes) {
  192. setNull(attributes);
  193. return this;
  194. }
  195. public void clearNull(final String... attributes) {
  196. if (attributes == null)
  197. throw new IllegalArgumentException();
  198. for (String attribute : attributes)
  199. nullValues.remove(attribute);
  200. }
  201. public AuthUser _clearNull(final String... attributes) {
  202. clearNull(attributes);
  203. return this;
  204. }
  205. @JsonIgnore
  206. public Boolean isNull(final AuthUser.Attribute attribute) {
  207. if (attribute == null)
  208. throw new IllegalArgumentException();
  209. return nullValues.contains(attribute.name());
  210. }
  211. public Boolean isNull(final String attrName) {
  212. if (attrName == null)
  213. throw new IllegalArgumentException();
  214. return nullValues.contains(attrName);
  215. }
  216. public Boolean isDef(final String attrName, final Boolean isAttrNotNull) {
  217. if (attrName == null)
  218. throw new IllegalArgumentException();
  219. if (nullValues.contains(attrName))
  220. return true;
  221. if (isAttrNotNull != null)
  222. return isAttrNotNull;
  223. return false;
  224. }
  225. public void clearAllNull() {
  226. nullValues = new java.util.HashSet<String>();
  227. }
  228. public enum Association {
  229. userRoles;
  230. }
  231. private Set<String> initAssociations = new java.util.HashSet<String>();
  232. @JsonIgnore
  233. public Set<String> getInitAssociations() {
  234. return this.initAssociations;
  235. }
  236. @JsonIgnore
  237. public void setInitAssociations(final Set<String> initAssociations) {
  238. this.initAssociations = initAssociations;
  239. }
  240. @JsonIgnore
  241. public void setInit(final AuthUser.Association... associations) {
  242. if (associations == null)
  243. throw new IllegalArgumentException();
  244. for (Association association : associations)
  245. initAssociations.add(association.name());
  246. }
  247. @JsonIgnore
  248. public AuthUser _setInit(final AuthUser.Association... associations) {
  249. setInit(associations);
  250. return this;
  251. }
  252. @JsonIgnore
  253. public void clearInit(final AuthUser.Association... associations) {
  254. if (associations == null)
  255. throw new IllegalArgumentException();
  256. for (Association association : associations)
  257. initAssociations.remove(association.name());
  258. }
  259. @JsonIgnore
  260. public AuthUser _clearInit(final AuthUser.Association... associations) {
  261. clearInit(associations);
  262. return this;
  263. }
  264. public void setInit(final String... associations) {
  265. if (associations == null)
  266. throw new IllegalArgumentException();
  267. for (String association : associations)
  268. initAssociations.add(association);
  269. }
  270. public AuthUser _setInit(final String... associations) {
  271. setInit(associations);
  272. return this;
  273. }
  274. public void clearInit(final String... associations) {
  275. if (associations == null)
  276. throw new IllegalArgumentException();
  277. for (String association : associations)
  278. initAssociations.remove(association);
  279. }
  280. public AuthUser _clearInit(final String... associations) {
  281. clearInit(associations);
  282. return this;
  283. }
  284. @JsonIgnore
  285. public Boolean toInit(final AuthUser.Association association) {
  286. if (association == null)
  287. throw new IllegalArgumentException();
  288. return initAssociations.contains(association.name());
  289. }
  290. public Boolean toInit(final String association) {
  291. if (association == null)
  292. throw new IllegalArgumentException();
  293. return initAssociations.contains(association);
  294. }
  295. public void clearAllInit() {
  296. initAssociations = new java.util.HashSet<String>();
  297. }
  298. public enum OpAttribute {
  299. id,
  300. username,
  301. password,
  302. name,
  303. email,
  304. lastLogin,
  305. version,
  306. userRoles;
  307. }
  308. private Map<String, String> operators = new java.util.HashMap<String, String>();
  309. @JsonIgnore
  310. public Map<String, String> getOperators() {
  311. return operators;
  312. }
  313. @JsonIgnore
  314. public void setOp(final String operator, final AuthUser.OpAttribute... attributes) {
  315. if (attributes == null)
  316. throw new IllegalArgumentException();
  317. for (OpAttribute attribute : attributes)
  318. operators.put(attribute.name(), operator);
  319. }
  320. @JsonIgnore
  321. public AuthUser _setOp(final String operator, final AuthUser.OpAttribute... attributes) {
  322. setOp(operator, attributes);
  323. return this;
  324. }
  325. @JsonIgnore
  326. public void clearOp(final AuthUser.OpAttribute... attributes) {
  327. if (attributes == null)
  328. throw new IllegalArgumentException();
  329. for (OpAttribute attribute : attributes)
  330. operators.remove(attribute.name());
  331. }
  332. @JsonIgnore
  333. public AuthUser _clearOp(final AuthUser.OpAttribute... attributes) {
  334. clearOp(attributes);
  335. return this;
  336. }
  337. public void setOp(final String operator, final String... attributes) {
  338. if (attributes == null)
  339. throw new IllegalArgumentException();
  340. for (String attribute : attributes)
  341. operators.put(attribute, operator);
  342. }
  343. public AuthUser _setOp(final String operator, final String... attributes) {
  344. setOp(operator, attributes);
  345. return this;
  346. }
  347. public void clearOp(final String... attributes) {
  348. if (attributes == null)
  349. throw new IllegalArgumentException();
  350. for (String attribute : attributes)
  351. operators.remove(attribute);
  352. }
  353. public AuthUser _clearOp(final String... attributes) {
  354. clearOp(attributes);
  355. return this;
  356. }
  357. @JsonIgnore
  358. public void setNullOp(final AuthUser.OpAttribute... attributes) {
  359. if (attributes == null)
  360. throw new IllegalArgumentException();
  361. for (OpAttribute attribute : attributes)
  362. operators.put(attribute.name(), "is null");
  363. }
  364. @JsonIgnore
  365. public AuthUser _setNullOp(final AuthUser.OpAttribute... attributes) {
  366. setNullOp(attributes);
  367. return this;
  368. }
  369. public void setNullOp(final String... attributes) {
  370. if (attributes == null)
  371. throw new IllegalArgumentException();
  372. for (String attribute : attributes)
  373. operators.put(attribute, "is null");
  374. }
  375. public AuthUser _setNullOp(final String... attributes) {
  376. setNullOp(attributes);
  377. return this;
  378. }
  379. public void clearAllOps() {
  380. operators = new java.util.HashMap<String, String>();
  381. }
  382. }