2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.be.model;
22 import com.fasterxml.jackson.annotation.JsonInclude;
23 import lombok.EqualsAndHashCode;
25 import lombok.NoArgsConstructor;
27 import lombok.ToString;
28 import org.joda.time.DateTime;
29 import org.joda.time.DateTimeZone;
30 import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
31 import org.openecomp.sdc.common.util.NoHtml;
41 public static final String FORCE_DELETE_HEADER_FLAG = "FORCE_DELETE";
43 private String firstName;
45 private String lastName;
47 private String userId;
52 private Long lastLoginTime;
54 @EqualsAndHashCode.Exclude
55 private UserStatusEnum status = UserStatusEnum.ACTIVE;
57 public User(String userId) {
61 public User(String firstName, String lastName, String userId, String emailAddress, String role, Long lastLoginTime) {
62 this.firstName = firstName;
63 this.lastName = lastName;
65 this.email = emailAddress;
67 this.lastLoginTime = lastLoginTime;
70 public User(User aUser) {
71 this(aUser.getFirstName(), aUser.getLastName(), aUser.getUserId(), aUser.getEmail(), aUser.getRole(), aUser.getLastLoginTime());
74 public void copyData(User other) {
78 this.firstName = other.getFirstName();
79 this.lastName = other.getLastName();
80 this.userId = other.getUserId();
81 this.email = other.getEmail();
82 this.role = other.getRole();
83 this.lastLoginTime = other.getLastLoginTime();
86 public String getFullName() {
87 return this.getFirstName() + " " + this.getLastName();
90 public void setLastLoginTime() {
91 DateTime now = new DateTime(DateTimeZone.UTC);
92 this.lastLoginTime = now.getMillis();