1 | |
package org.kuali.student.lum.common.client.widgets; |
2 | |
|
3 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
4 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
5 | |
import org.kuali.student.core.assembly.data.Data; |
6 | |
import org.kuali.student.core.assembly.data.Metadata; |
7 | |
|
8 | |
import com.google.gwt.core.client.GWT; |
9 | |
import com.google.gwt.user.client.Window; |
10 | |
import com.google.gwt.user.client.rpc.AsyncCallback; |
11 | |
|
12 | |
|
13 | 0 | public class CluSetRetrieverImpl implements CluSetRetriever { |
14 | |
|
15 | 0 | private CluSetManagementRpcServiceAsync cluSetManagementRpcServiceAsync = GWT.create(CluSetManagementRpcService.class); |
16 | |
|
17 | |
@Override |
18 | |
public void getCluSetInformation(final String cluSetId, final Callback<CluSetInformation> retrieveDoneCallback) { |
19 | 0 | cluSetManagementRpcServiceAsync.getCluSetInformation(cluSetId, new AsyncCallback<CluSetInformation>() { |
20 | |
@Override |
21 | |
public void onFailure(Throwable caught) { |
22 | 0 | Window.alert("Failed to retrieve CluSet information for " + cluSetId); |
23 | 0 | retrieveDoneCallback.exec(null); |
24 | 0 | } |
25 | |
@Override |
26 | |
public void onSuccess(CluSetInformation result) { |
27 | 0 | retrieveDoneCallback.exec(result); |
28 | 0 | } |
29 | |
}); |
30 | 0 | } |
31 | |
|
32 | |
@Override |
33 | |
public void getMetadata(final String id, final Callback<Metadata> callback) { |
34 | 0 | cluSetManagementRpcServiceAsync.getMetadata(id, null, new AsyncCallback<Metadata>() { |
35 | |
|
36 | |
@Override |
37 | |
public void onFailure(Throwable caught) { |
38 | 0 | Window.alert("Failed to get metadata with id " + id); |
39 | 0 | callback.exec(null); |
40 | 0 | } |
41 | |
|
42 | |
@Override |
43 | |
public void onSuccess(Metadata result) { |
44 | 0 | callback.exec(result); |
45 | 0 | } |
46 | |
}); |
47 | 0 | } |
48 | |
|
49 | |
@Override |
50 | |
public void getData(final String cluSetId, final Callback<Data> callback) { |
51 | 0 | cluSetManagementRpcServiceAsync.getData(cluSetId, new AsyncCallback<Data>() { |
52 | |
@Override |
53 | |
public void onFailure(Throwable caught) { |
54 | 0 | Window.alert("Failed to retreive data for clu Set with id " + cluSetId); |
55 | 0 | callback.exec(null); |
56 | 0 | } |
57 | |
@Override |
58 | |
public void onSuccess(Data result) { |
59 | 0 | callback.exec(result); |
60 | 0 | } |
61 | |
}); |
62 | 0 | } |
63 | |
|
64 | |
@Override |
65 | |
public void saveData(final Data data, final Callback<DataSaveResult> callback) { |
66 | 0 | cluSetManagementRpcServiceAsync.saveData(data, new AsyncCallback<DataSaveResult>() { |
67 | |
@Override |
68 | |
public void onFailure(Throwable caught) { |
69 | 0 | Window.alert("Failed to save clu set data"); |
70 | 0 | callback.exec(null); |
71 | 0 | } |
72 | |
@Override |
73 | |
public void onSuccess(DataSaveResult result) { |
74 | 0 | callback.exec(result); |
75 | 0 | } |
76 | |
}); |
77 | 0 | } |
78 | |
|
79 | |
} |