1 package com.srv4pos.server.api.user;
2
3 import com.srv4pos.server.api.auth.UserRole;
4 import com.srv4pos.server.api.infrastructure.Constraints;
5 import com.srv4pos.server.api.infrastructure.Info;
6 import org.springframework.roo.addon.javabean.RooJavaBean;
7 import org.springframework.roo.addon.json.RooJson;
8 import org.springframework.roo.addon.tostring.RooToString;
9
10 import javax.validation.constraints.NotNull;
11 import javax.validation.constraints.Pattern;
12 import javax.validation.constraints.Size;
13
14
15
16
17
18 @RooJavaBean
19 @RooToString
20 @RooJson(deepSerialize = true)
21 public class UserRegistrationInfo implements Info {
22
23
24
25
26 @NotNull
27 private boolean deleted = Boolean.FALSE;
28
29 @NotNull
30 @Size(max = 50, min = 1)
31 private String username;
32
33 @NotNull
34 @Size(max = 50, min = 6)
35 @Pattern(regexp = Constraints.EMAIL_REGEX)
36 private String email;
37
38 @NotNull
39 private UserRole role;
40
41
42
43
44
45 private Long softwareVendor;
46
47 @NotNull
48 @Size(min = 4, max = 16)
49 private String password;
50
51
52
53
54
55
56 public UserInfo toUserInfo() {
57 final UserInfo userInfo = new UserInfo();
58 userInfo.setDeleted(isDeleted());
59 userInfo.setEmail(getEmail());
60 userInfo.setRole(getRole());
61 userInfo.setSoftwareVendor(getSoftwareVendor());
62 userInfo.setUsername(getUsername());
63 return userInfo;
64 }
65 }