|
@@ -6,38 +6,32 @@ |
6 |
6 |
|
import org.litesoft.security.*; |
7 |
7 |
|
|
8 |
8 |
|
public final class UserView extends UserViewGO implements Precommitable, |
9 |
|
- |
SecurityUserView<UserView> |
10 |
|
- |
{ |
|
9 |
+ |
SecurityUserView<UserView> { |
11 |
10 |
|
@Deprecated |
12 |
11 |
|
protected UserView() // For Serialization |
13 |
12 |
|
{ |
14 |
13 |
|
} |
15 |
14 |
|
|
16 |
|
- |
protected UserView( boolean pNew, org.litesoft.bo.views.TransactionSet pTransactionSet ) |
17 |
|
- |
{ |
|
15 |
+ |
protected UserView( boolean pNew, org.litesoft.bo.views.TransactionSet pTransactionSet ) { |
18 |
16 |
|
super( pNew, pTransactionSet ); |
19 |
17 |
|
} |
20 |
18 |
|
|
21 |
|
- |
public static UserView createNew() |
22 |
|
- |
{ |
|
19 |
+ |
public static UserView createNew() { |
23 |
20 |
|
UserView zVO = new UserView( true, UserViewDataProvider.getInstance().createTransactionSet() ); |
24 |
21 |
|
zVO.initialize(); |
25 |
22 |
|
return zVO; |
26 |
23 |
|
} |
27 |
24 |
|
|
28 |
25 |
|
@Override |
29 |
|
- |
public void aboutToCommit() |
30 |
|
- |
{ |
31 |
|
- |
if ( Objects.areNotNull( getCurrentPassword(), getNewPassword(), getConfirmPassword() ) ) |
32 |
|
- |
{ |
|
26 |
+ |
public void aboutToCommit() { |
|
27 |
+ |
if ( Objects.areNotNull( getCurrentPassword(), getNewPassword(), getConfirmPassword() ) ) { |
33 |
28 |
|
setResetPassword( false ); |
34 |
29 |
|
clearPasswordFields(); |
35 |
30 |
|
} |
36 |
31 |
|
} |
37 |
32 |
|
|
38 |
33 |
|
@Override |
39 |
|
- |
public UserView clearPasswordFields() |
40 |
|
- |
{ |
|
34 |
+ |
public UserView clearPasswordFields() { |
41 |
35 |
|
setCurrentPassword( null ); |
42 |
36 |
|
setNewPassword( null ); |
43 |
37 |
|
setConfirmPassword( null ); |
|
@@ -45,42 +39,33 @@ |
45 |
39 |
|
} |
46 |
40 |
|
|
47 |
41 |
|
@Override |
48 |
|
- |
public String getFullName() |
49 |
|
- |
{ |
|
42 |
+ |
public String getFullName() { |
50 |
43 |
|
String rv = getFirstName() + " "; |
51 |
|
- |
if ( Strings.isNotNullOrEmpty( getMiddleInitial() ) ) |
52 |
|
- |
{ |
|
44 |
+ |
if ( Strings.isNotNullOrEmpty( getMiddleInitial() ) ) { |
53 |
45 |
|
rv += getMiddleInitial() + ". "; |
54 |
46 |
|
} |
55 |
47 |
|
return rv + getLastName(); |
56 |
48 |
|
} |
57 |
49 |
|
|
58 |
|
- |
public boolean canResetPassword() |
59 |
|
- |
{ |
|
50 |
+ |
public boolean canResetPassword() { |
60 |
51 |
|
return anyOf( getHelpDeskMember(), getRestrictedResourceManage(), getSuperAdmin() ); |
61 |
52 |
|
} |
62 |
53 |
|
|
63 |
|
- |
public boolean canChange_HelpDeskMember() |
64 |
|
- |
{ |
|
54 |
+ |
public boolean canChange_HelpDeskMember() { |
65 |
55 |
|
return anyOf( getHelpDeskMember(), getSuperAdmin() ); |
66 |
56 |
|
} |
67 |
57 |
|
|
68 |
|
- |
public boolean canChange_RestrictedResourceManage() |
69 |
|
- |
{ |
|
58 |
+ |
public boolean canChange_RestrictedResourceManage() { |
70 |
59 |
|
return anyOf( getRestrictedResourceManage(), getSuperAdmin() ); |
71 |
60 |
|
} |
72 |
61 |
|
|
73 |
|
- |
public boolean canChange_SuperAdmin() |
74 |
|
- |
{ |
|
62 |
+ |
public boolean canChange_SuperAdmin() { |
75 |
63 |
|
return Boolean.TRUE.equals( getSuperAdmin() ); |
76 |
64 |
|
} |
77 |
65 |
|
|
78 |
|
- |
private boolean anyOf( Boolean... pFlags ) |
79 |
|
- |
{ |
80 |
|
- |
for ( Boolean zFlag : pFlags ) |
81 |
|
- |
{ |
82 |
|
- |
if ( Boolean.TRUE.equals( zFlag ) ) |
83 |
|
- |
{ |
|
66 |
+ |
private boolean anyOf( Boolean... pFlags ) { |
|
67 |
+ |
for ( Boolean zFlag : pFlags ) { |
|
68 |
+ |
if ( Boolean.TRUE.equals( zFlag ) ) { |
84 |
69 |
|
return true; |
85 |
70 |
|
} |
86 |
71 |
|
} |
|
@@ -91,46 +76,38 @@ |
91 |
76 |
|
|
92 |
77 |
|
private AlternateRestrictedResourceOption[] mAlternateRestrictedResourceOptions; |
93 |
78 |
|
|
94 |
|
- |
public AlternateRestrictedResourceOption[] getAlternateRestrictedResourceOptions() |
95 |
|
- |
{ |
|
79 |
+ |
public AlternateRestrictedResourceOption[] getAlternateRestrictedResourceOptions() { |
96 |
80 |
|
return mAlternateRestrictedResourceOptions; |
97 |
81 |
|
} |
98 |
82 |
|
|
99 |
|
- |
public void setAlternateRestrictedResourceOptions( AlternateRestrictedResourceOption[] pAlternateRestrictedResourceOptions ) |
100 |
|
- |
{ |
|
83 |
+ |
public void setAlternateRestrictedResourceOptions( AlternateRestrictedResourceOption[] pAlternateRestrictedResourceOptions ) { |
101 |
84 |
|
mAlternateRestrictedResourceOptions = pAlternateRestrictedResourceOptions; |
102 |
85 |
|
} |
103 |
86 |
|
|
104 |
87 |
|
private RestrictedResourceView mCurrentRestrictedResource; |
105 |
88 |
|
|
106 |
|
- |
public RestrictedResourceView getCurrentRestrictedResource() |
107 |
|
- |
{ |
|
89 |
+ |
public RestrictedResourceView getCurrentRestrictedResource() { |
108 |
90 |
|
return mCurrentRestrictedResource; |
109 |
91 |
|
} |
110 |
92 |
|
|
111 |
|
- |
public void setCurrentRestrictedResource( RestrictedResourceView pCurrentRestrictedResource ) |
112 |
|
- |
{ |
|
93 |
+ |
public void setCurrentRestrictedResource( RestrictedResourceView pCurrentRestrictedResource ) { |
113 |
94 |
|
mCurrentRestrictedResource = pCurrentRestrictedResource; |
114 |
95 |
|
} |
115 |
96 |
|
|
116 |
|
- |
public boolean isDemo() |
117 |
|
- |
{ |
|
97 |
+ |
public boolean isDemo() { |
118 |
98 |
|
return Boolean.TRUE.equals( getDemoUser() ); |
119 |
99 |
|
} |
120 |
100 |
|
|
121 |
|
- |
public boolean isGuest() |
122 |
|
- |
{ |
|
101 |
+ |
public boolean isGuest() { |
123 |
102 |
|
return false; // Todo: Add real guest flag |
124 |
103 |
|
} |
125 |
104 |
|
|
126 |
|
- |
public static UserView get( IViewObject[] pViewObjects, int pIndex ) |
127 |
|
- |
{ |
|
105 |
+ |
public static UserView get( IViewObject[] pViewObjects, int pIndex ) { |
128 |
106 |
|
return ((pViewObjects != null) && (pIndex < pViewObjects.length)) ? (UserView) pViewObjects[pIndex] : null; |
129 |
107 |
|
} |
130 |
108 |
|
|
131 |
109 |
|
@Override |
132 |
|
- |
public AccessKey getAccessKey() |
133 |
|
- |
{ |
|
110 |
+ |
public AccessKey getAccessKey() { |
134 |
111 |
|
return null; // TODO... |
135 |
112 |
|
} |
136 |
113 |
|
} |