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