Merge "adding catalog-service for mod2"
[dcaegen2/platform.git] / mod2 / auth-service / src / main / java / org / onap / dcaegen2 / platform / mod / models / ModUser.java
1 /*
2  *
3  *  * ============LICENSE_START=======================================================
4  *  *  org.onap.dcae
5  *  *  ================================================================================
6  *  *  Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
7  *  *  ================================================================================
8  *  *  Licensed under the Apache License, Version 2.0 (the "License");
9  *  *  you may not use this file except in compliance with the License.
10  *  *  You may obtain a copy of the License at
11  *  *
12  *  *       http://www.apache.org/licenses/LICENSE-2.0
13  *  *
14  *  *  Unless required by applicable law or agreed to in writing, software
15  *  *  distributed under the License is distributed on an "AS IS" BASIS,
16  *  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *  *  See the License for the specific language governing permissions and
18  *  *  limitations under the License.
19  *  *  ============LICENSE_END=========================================================
20  *
21  */
22
23 package org.onap.dcaegen2.platform.mod.models;
24
25 import lombok.Data;
26 import lombok.AllArgsConstructor;
27 import lombok.NoArgsConstructor;
28 import lombok.Getter;
29 import lombok.Setter;
30 import org.springframework.data.annotation.Id;
31 import org.springframework.data.mongodb.core.mapping.DBRef;
32 import org.springframework.data.mongodb.core.mapping.Document;
33
34 import javax.validation.constraints.NotBlank;
35 import javax.validation.constraints.Size;
36 import java.io.Serializable;
37 import java.util.ArrayList;
38 import java.util.HashSet;
39 import java.util.Set;
40
41 /**
42  * @author
43  * @date 09/08/2020
44  * Assigning Roles to User
45  */
46 @Data
47 @AllArgsConstructor
48 @NoArgsConstructor
49 @Getter
50 @Setter
51 @Document(collection = "users")
52 public class ModUser implements Serializable {
53
54     @Id
55     public String _id;
56
57     @NotBlank
58     @Size(max = 10)
59     private String username;
60
61     @NotBlank
62     private String password;
63
64     @NotBlank
65     private String fullName;
66
67     @DBRef
68     private Set<Role> roles = new HashSet<>();
69
70     public ModUser(@NotBlank @Size(max = 10) String username, @NotBlank String password, @NotBlank String fullName) {
71         this.username = username;
72         this.password = password;
73         this.fullName=fullName;
74     }
75 }