src/java/de/uapcore/lightpit/entities/User.java

Sun, 08 Apr 2018 15:34:11 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 08 Apr 2018 15:34:11 +0200
changeset 26
65d5a0ca49ae
parent 24
src/java/de/uapcore/lightpit/entities/Module.java@8137ec335416
permissions
-rw-r--r--

Module names and descriptions + some more styling

21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 *
24
8137ec335416 updates copyright header
Mike Becker <universe@uap-core.de>
parents: 21
diff changeset
4 * Copyright 2018 Mike Becker. All rights reserved.
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 *
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 *
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 *
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 *
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 *
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 */
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 package de.uapcore.lightpit.entities;
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
31 import java.util.Optional;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
33 public final class User {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
34
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
35 public static final int ANONYMOUS_USERID = -1;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
37 private int userID;
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
38 private String username;
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
39 private Optional<String> givenname;
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
40 private Optional<String> lastname;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
42 public int getUserID() {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
43 return userID;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
46 public void setUserID(int userID) {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
47 this.userID = userID;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
50 public String getUsername() {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
51 return username;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
54 public void setUsername(String username) {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
55 this.username = username;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
58 public Optional<String> getGivenname() {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
59 return givenname;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
62 public void setGivenname(Optional<String> givenname) {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
63 this.givenname = givenname;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
66 public Optional<String> getLastname() {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
67 return lastname;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
70 public void setLastname(Optional<String> lastname) {
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
71 this.lastname = lastname;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 @Override
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 public int hashCode() {
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 int hash = 3;
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
77 hash = 41 * hash + this.userID;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 return hash;
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 @Override
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82 public boolean equals(Object obj) {
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
83 if (this == obj) {
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84 return true;
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
86 if (obj == null || getClass() != obj.getClass()) {
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
87 return false;
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
88 } else {
26
65d5a0ca49ae Module names and descriptions + some more styling
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
89 return this.userID == ((User) obj).userID;
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91 }
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents:
diff changeset
92 }

mercurial