Revision eee72ed5
b/src/gr/grnet/pithos/web/client/PermissionsAddDialog.java | ||
---|---|---|
38 | 38 |
import com.google.gwt.http.client.Response; |
39 | 39 |
import com.google.gwt.json.client.JSONObject; |
40 | 40 |
import gr.grnet.pithos.web.client.catalog.GetUserCatalogs; |
41 |
import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs; |
|
41 | 42 |
import gr.grnet.pithos.web.client.catalog.UserCatalogs; |
42 | 43 |
import gr.grnet.pithos.web.client.grouptree.Group; |
43 | 44 |
|
... | ... | |
187 | 188 |
} |
188 | 189 |
else { |
189 | 190 |
// Must call server to obtain userID |
190 |
new GetUserCatalogs(app, null, Helpers.toList(userDisplayName)) {
|
|
191 |
new UpdateUserCatalogs(app, null, Helpers.toList(userDisplayName)) {
|
|
191 | 192 |
@Override |
192 |
public void onSuccess(Request request, Response response, JSONObject result, UserCatalogs userCatalogs) { |
|
193 |
app.getUserCatalogs().updateFrom(userCatalogs); |
|
194 |
final String userID = app.getUserIDForDisplayName(userDisplayName); |
|
193 |
public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) { |
|
194 |
final String userID = updatedUserCatalogs.getUserID(userDisplayName); |
|
195 | 195 |
if(userID == null) { |
196 | 196 |
app.displayWarning("Unknown user " + userDisplayName); |
197 | 197 |
} |
b/src/gr/grnet/pithos/web/client/PermissionsList.java | ||
---|---|---|
57 | 57 |
import com.google.gwt.user.client.ui.RadioButton; |
58 | 58 |
import com.google.gwt.user.client.ui.VerticalPanel; |
59 | 59 |
import gr.grnet.pithos.web.client.catalog.GetUserCatalogs; |
60 |
import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs; |
|
60 | 61 |
import gr.grnet.pithos.web.client.catalog.UserCatalogs; |
61 | 62 |
|
62 | 63 |
|
... | ... | |
142 | 143 |
); |
143 | 144 |
} |
144 | 145 |
else { |
145 |
new GetUserCatalogs(app, userID) {
|
|
146 |
new UpdateUserCatalogs(app, userID) {
|
|
146 | 147 |
@Override |
147 |
public void onSuccess(Request request, Response response, JSONObject result, UserCatalogs userCatalogs) { |
|
148 |
app.getUserCatalogs().updateFrom(userCatalogs); |
|
149 |
final String displayName = app.getUserDisplayNameForID(userID); |
|
148 |
public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) { |
|
149 |
final String displayName = updatedUserCatalogs.getDisplayName(userID); |
|
150 | 150 |
permTable.setHTML( |
151 | 151 |
ii, |
152 | 152 |
0, |
b/src/gr/grnet/pithos/web/client/Pithos.java | ||
---|---|---|
61 | 61 |
import com.google.gwt.view.client.SelectionChangeEvent.Handler; |
62 | 62 |
import com.google.gwt.view.client.SingleSelectionModel; |
63 | 63 |
import gr.grnet.pithos.web.client.catalog.GetUserCatalogs; |
64 |
import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs; |
|
64 | 65 |
import gr.grnet.pithos.web.client.catalog.UserCatalogs; |
65 | 66 |
import gr.grnet.pithos.web.client.commands.UploadFileCommand; |
66 | 67 |
import gr.grnet.pithos.web.client.foldertree.*; |
... | ... | |
722 | 723 |
callback.execute(); |
723 | 724 |
} |
724 | 725 |
// Initialize the user catalog |
725 |
new GetUserCatalogs(Pithos.this, Pithos.this.getUserID()) { |
|
726 |
@Override |
|
727 |
public void onSuccess(Request request, Response response, JSONObject result, UserCatalogs usersCatalog) { |
|
728 |
super.onSuccess(request, response, result, usersCatalog); |
|
729 |
Pithos.this.userCatalogs.updateFrom(usersCatalog); |
|
730 |
} |
|
731 |
}.scheduleDeferred(); |
|
726 |
new UpdateUserCatalogs(Pithos.this, Pithos.this.getUserID()).scheduleDeferred(); |
|
732 | 727 |
} |
733 | 728 |
|
734 | 729 |
@Override |
b/src/gr/grnet/pithos/web/client/catalog/UpdateUserCatalogs.java | ||
---|---|---|
1 |
package gr.grnet.pithos.web.client.catalog; |
|
2 |
|
|
3 |
import com.google.gwt.core.client.Scheduler; |
|
4 |
import com.google.gwt.http.client.Request; |
|
5 |
import com.google.gwt.http.client.Response; |
|
6 |
import com.google.gwt.json.client.JSONObject; |
|
7 |
import gr.grnet.pithos.web.client.Helpers; |
|
8 |
import gr.grnet.pithos.web.client.Pithos; |
|
9 |
|
|
10 |
import java.util.List; |
|
11 |
|
|
12 |
/** |
|
13 |
* This is a wrapper around GetUserCatalogs that takes care of updating |
|
14 |
* the application-wide user catalogs. |
|
15 |
* |
|
16 |
* @author Christos KK Loverdos <loverdos@gmail.com> |
|
17 |
*/ |
|
18 |
public class UpdateUserCatalogs implements Scheduler.ScheduledCommand { |
|
19 |
private final GetUserCatalogs getUserCatalogs; |
|
20 |
private final Pithos app; |
|
21 |
|
|
22 |
public UpdateUserCatalogs(Pithos app) { |
|
23 |
this(app, null, null); |
|
24 |
} |
|
25 |
|
|
26 |
public UpdateUserCatalogs(Pithos app, String userID) { |
|
27 |
this(app, Helpers.toList(userID), null); |
|
28 |
} |
|
29 |
|
|
30 |
public UpdateUserCatalogs(Pithos app, List<String> ids) { |
|
31 |
this(app, ids, null); |
|
32 |
} |
|
33 |
|
|
34 |
public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) { |
|
35 |
} |
|
36 |
|
|
37 |
public void onError(Request request, Throwable t) { |
|
38 |
getUserCatalogs.onError(request, t); |
|
39 |
} |
|
40 |
|
|
41 |
public UpdateUserCatalogs(Pithos app, List<String> ids, List<String> names) { |
|
42 |
this.app = app; |
|
43 |
this.getUserCatalogs = new GetUserCatalogs(app, ids, names) { |
|
44 |
@Override |
|
45 |
public void onSuccess(Request request, Response response, JSONObject result, UserCatalogs userCatalogs) { |
|
46 |
UpdateUserCatalogs.this.app.getUserCatalogs().updateFrom(userCatalogs); |
|
47 |
UpdateUserCatalogs.this.onSuccess(userCatalogs, UpdateUserCatalogs.this.app.getUserCatalogs()); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public void onError(Request request, Throwable t) { |
|
52 |
UpdateUserCatalogs.this.onError(request, t); |
|
53 |
} |
|
54 |
}; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public void execute() { |
|
59 |
this.getUserCatalogs.execute(); |
|
60 |
} |
|
61 |
|
|
62 |
public void scheduleDeferred() { |
|
63 |
Scheduler.get().scheduleDeferred(this); |
|
64 |
} |
|
65 |
} |
b/src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.java | ||
---|---|---|
58 | 58 |
import gr.grnet.pithos.web.client.Pithos; |
59 | 59 |
import gr.grnet.pithos.web.client.SharingUsers; |
60 | 60 |
import gr.grnet.pithos.web.client.catalog.GetUserCatalogs; |
61 |
import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs; |
|
61 | 62 |
import gr.grnet.pithos.web.client.catalog.UserCatalogs; |
62 | 63 |
import gr.grnet.pithos.web.client.foldertree.AccountResource; |
63 | 64 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
... | ... | |
201 | 202 |
fetchSharedContainers(userLevelDataProviderForIDs.getList().iterator(), callback); |
202 | 203 |
} else { |
203 | 204 |
// First fetch unknown display names and then proceed |
204 |
new GetUserCatalogs(app, userIDsWithUnknownDisplayNames) {
|
|
205 |
new UpdateUserCatalogs(app, userIDsWithUnknownDisplayNames) {
|
|
205 | 206 |
@Override |
206 |
public void onSuccess(Request request, Response response, JSONObject result, UserCatalogs userCatalogs) { |
|
207 |
// for(Map.Entry<String, String> entry : userCatalogs) { |
|
208 |
// final String id = entry.getKey(); |
|
209 |
// final String name = entry.getValue(); |
|
210 |
// LOG("mapping: userID("+id+") -> name("+name+")"); |
|
211 |
// } |
|
212 |
|
|
213 |
// Update the cached user catalogs |
|
214 |
app.getUserCatalogs().updateFrom(userCatalogs); |
|
215 |
|
|
207 |
public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) { |
|
216 | 208 |
fetchSharedContainers(userLevelDataProviderForIDs.getList().iterator(), callback); |
217 | 209 |
} |
218 | 210 |
|
Also available in: Unified diff