Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/InitFrom/src/org/litesoft/initfrom/client/boviews/UserViewDataProvider.java

Diff revisions: vs.
  @@ -8,151 +8,121 @@
8 8 import org.litesoft.core.*;
9 9
10 10 public class UserViewDataProvider extends InitFrom_TypedVoDataProvider<UserView> implements UserViewNames,
11 - LoginServerStateChecker
12 - {
11 + LoginServerStateChecker {
13 12 private static UserViewDataProvider sInstance = null;
14 13
15 - public static synchronized UserViewDataProvider getInstance()
16 - {
14 + public static synchronized UserViewDataProvider getInstance() {
17 15 return (sInstance != null) ? sInstance : (sInstance = new UserViewDataProvider());
18 16 }
19 17
20 - private UserViewDataProvider()
21 - {
18 + private UserViewDataProvider() {
22 19 super( UserViewMetaData.getInstance() );
23 20 }
24 21
25 22 @Override
26 - public void invalidate( CacheID pCacheID )
27 - {
23 + public void invalidate( CacheID pCacheID ) {
28 24 }
29 25
30 26 @Override
31 - public void checkServerLogin( final SimpleDataProviderCallBack pCallBack )
32 - {
27 + public void checkServerLogin( final SimpleDataProviderCallBack pCallBack ) {
33 28 getCScomm().requestFunctionFetchRow( this, null, //
34 29 new VOCSrequestFunctionFetchRow( UserView.class, //
35 30 UserViewAbstractServerFunctionFetchCurrentLoginUser.REG_ID ), //
36 - new FetchRowDataProviderCallBack<UserView>()
37 - {
31 + new FetchRowDataProviderCallBack<UserView>() {
38 32 @Override
39 - public void success( UserView pRow )
40 - {
33 + public void success( UserView pRow ) {
41 34 updateContext( pRow );
42 35 pCallBack.error( null );
43 36 }
44 37
45 38 @Override
46 - public void error( String pError )
47 - {
39 + public void error( String pError ) {
48 40 pCallBack.error( pError );
49 41 }
50 42 } );
51 43 }
52 44
53 - public void changePassword( UserView pUserView, final SimpleDataProviderCallBack pCallBack )
54 - {
55 - if ( cursoryPasswordCheck( pUserView.getCurrentPassword(), aCurrentPassword, pCallBack ) )
56 - {
57 - if ( cursoryPasswordCheck( pUserView.getNewPassword(), aNewPassword, pCallBack ) )
58 - {
59 - if ( cursoryPasswordCheck( pUserView.getConfirmPassword(), aConfirmPassword, pCallBack ) )
60 - {
45 + public void changePassword( UserView pUserView, final SimpleDataProviderCallBack pCallBack ) {
46 + if ( cursoryPasswordCheck( pUserView.getCurrentPassword(), aCurrentPassword, pCallBack ) ) {
47 + if ( cursoryPasswordCheck( pUserView.getNewPassword(), aNewPassword, pCallBack ) ) {
48 + if ( cursoryPasswordCheck( pUserView.getConfirmPassword(), aConfirmPassword, pCallBack ) ) {
61 49 getCScomm().requestFunctionFetchRow( this, null, //
62 50 new VOCSrequestFunctionFetchRow( UserView.class, //
63 51 UserViewAbstractServerFunctionChangePassword.REG_ID, //
64 - pUserView ), new FetchRowDataProviderCallBack<UserView>()
65 - {
66 - @Override
67 - public void success( UserView pRow )
68 - {
69 - updateContext( pRow );
70 - pCallBack.error( null );
71 - }
72 -
73 - @Override
74 - public void error( String pError )
75 - {
76 - pCallBack.error( pError );
77 - }
78 - } );
52 + pUserView ), new FetchRowDataProviderCallBack<UserView>() {
53 + @Override
54 + public void success( UserView pRow ) {
55 + updateContext( pRow );
56 + pCallBack.error( null );
57 + }
58 +
59 + @Override
60 + public void error( String pError ) {
61 + pCallBack.error( pError );
62 + }
63 + } );
79 64 }
80 65 }
81 66 }
82 67 }
83 68
84 - public void validatePassword( UserView pUserView, SimpleDataProviderCallBack pCallBack )
85 - {
86 - if ( cursoryPasswordCheck( pUserView.getCurrentPassword(), aCurrentPassword, pCallBack ) )
87 - {
69 + public void validatePassword( UserView pUserView, SimpleDataProviderCallBack pCallBack ) {
70 + if ( cursoryPasswordCheck( pUserView.getCurrentPassword(), aCurrentPassword, pCallBack ) ) {
88 71 getCScomm().requestFunctionSimple( new VOCSrequestFunctionSimple( UserView.class, //
89 72 UserViewAbstractServerFunctionValidatePassword.REG_ID, //
90 73 pUserView ), pCallBack );
91 74 }
92 75 }
93 76
94 - public void attemptLogin( UserView pUserView, final SimpleDataProviderCallBack pCallBack )
95 - {
96 - if ( cursoryEmailCheck( pUserView.getLogonEmail(), aLogonEmail, pCallBack ) )
97 - {
98 - if ( cursoryPasswordCheck( pUserView.getCurrentPassword(), aCurrentPassword, pCallBack ) )
99 - {
77 + public void attemptLogin( UserView pUserView, final SimpleDataProviderCallBack pCallBack ) {
78 + if ( cursoryEmailCheck( pUserView.getLogonEmail(), aLogonEmail, pCallBack ) ) {
79 + if ( cursoryPasswordCheck( pUserView.getCurrentPassword(), aCurrentPassword, pCallBack ) ) {
100 80 getCScomm().requestFunctionFetchRow( this, null, //
101 81 new VOCSrequestFunctionFetchRow( UserView.class, //
102 82 UserViewAbstractServerFunctionLogin.REG_ID, //
103 - pUserView ), new FetchRowDataProviderCallBack<UserView>()
104 - {
105 - @Override
106 - public void success( UserView pRow )
107 - {
108 - updateContext( pRow );
109 - pCallBack.error( null );
110 - }
111 -
112 - @Override
113 - public void error( String pError )
114 - {
115 - pCallBack.error( pError );
116 - }
117 - } );
83 + pUserView ), new FetchRowDataProviderCallBack<UserView>() {
84 + @Override
85 + public void success( UserView pRow ) {
86 + updateContext( pRow );
87 + pCallBack.error( null );
88 + }
89 +
90 + @Override
91 + public void error( String pError ) {
92 + pCallBack.error( pError );
93 + }
94 + } );
118 95 }
119 96 }
120 97 }
121 98
122 - public void logoutUser()
123 - {
99 + public void logoutUser() {
124 100 ClientContext.get().get( CurrentUserViewAccessor.class ).setUser( null );
125 101 getCScomm().requestFunctionSimple( new VOCSrequestFunctionSimple( UserView.class.getName(), UserViewAbstractServerFunctionLogout.REG_ID ), null );
126 102 }
127 103
128 - public void nextDemoUser( final SimpleDataProviderCallBack pCallBack )
129 - {
104 + public void nextDemoUser( final SimpleDataProviderCallBack pCallBack ) {
130 105 getCScomm().requestFunctionFetchRow( this, null, //
131 106 new VOCSrequestFunctionFetchRow( UserView.class, //
132 107 UserViewAbstractServerFunctionNextDemoLoginUser.REG_ID ), //
133 - new FetchRowDataProviderCallBack<UserView>()
134 - {
108 + new FetchRowDataProviderCallBack<UserView>() {
135 109 @Override
136 - public void success( UserView pRow )
137 - {
110 + public void success( UserView pRow ) {
138 111 updateContext( pRow );
139 112 pCallBack.error( null );
140 113 }
141 114
142 115 @Override
143 - public void error( String pError )
144 - {
116 + public void error( String pError ) {
145 117 pCallBack.error( pError );
146 118 }
147 119 } );
148 120 }
149 121
150 - public void attemptSwitchToRestrictedResource( RestrictedResourceView pRestrictedResourceView, final SimpleDataProviderCallBack pCallBack )
151 - {
122 + public void attemptSwitchToRestrictedResource( RestrictedResourceView pRestrictedResourceView, final SimpleDataProviderCallBack pCallBack ) {
152 123 Objects.assertNotNull( "RestrictedResource", pRestrictedResourceView );
153 124 RestrictedResourceView zRestrictedResource = ClientContext.get().get( CurrentRestrictedResourceViewAccessor.class ).getRestrictedResource();
154 - if ( pRestrictedResourceView.equals( zRestrictedResource ) )
155 - {
125 + if ( pRestrictedResourceView.equals( zRestrictedResource ) ) {
156 126 pCallBack.error( "Already at RestrictedResource: " + zRestrictedResource );
157 127 return;
158 128 }
  @@ -161,33 +131,29 @@
161 131 getCScomm().requestFunctionFetchRow( this, null, //
162 132 new VOCSrequestFunctionFetchRow( UserView.class, //
163 133 UserViewAbstractServerFunctionSwitchRestrictedResources.REG_ID, //
164 - zUser ), new FetchRowDataProviderCallBack<UserView>()
165 - {
166 - @Override
167 - public void success( UserView pRow )
168 - {
169 - updateContext( pRow );
170 - pCallBack.error( null );
171 - }
134 + zUser ), new FetchRowDataProviderCallBack<UserView>() {
135 + @Override
136 + public void success( UserView pRow ) {
137 + updateContext( pRow );
138 + pCallBack.error( null );
139 + }
172 140
173 - @Override
174 - public void error( String pError )
175 - {
176 - pCallBack.error( pError );
177 - }
178 - } );
141 + @Override
142 + public void error( String pError ) {
143 + pCallBack.error( pError );
144 + }
145 + } );
179 146 }
180 147
181 - public void validateLogonEmailAvailable( String pLogonEmail, FetchRowDataProviderCallBack<UserView> pCallBack )
182 - {
183 - if ( cursoryEmailCheck( pLogonEmail, aLogonEmail, pCallBack ) )
184 - {
148 + public void validateLogonEmailAvailable( String pLogonEmail, FetchRowDataProviderCallBack<UserView> pCallBack ) {
149 + if ( cursoryEmailCheck( pLogonEmail, aLogonEmail, pCallBack ) ) {
185 150 UserView zUserView = new UserView( false, null );
186 151 zUserView.setLogonEmail( pLogonEmail );
187 152 zUserView.initialize();
188 153 getCScomm().requestFunctionFetchRow( this, null, //
189 154 new VOCSrequestFunctionFetchRow( UserView.class, //
190 - UserViewAbstractServerFunctionValidateLogonEmailAvailable.REG_ID, zUserView ), pCallBack );
155 + UserViewAbstractServerFunctionValidateLogonEmailAvailable.REG_ID, zUserView ),
156 + pCallBack );
191 157 }
192 158 }
193 159 }