try {
search.getCopyStatuses();
- } catch (NoNetworkAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (NoAccessToServer e) {
+ } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
}
public void getOrgHiddentDepth(){
// logic can be found in the opac_utils.js file in web/opac/common/js
-
-
+
for(int i=0; i<organisations.size();i++){
AccountAccess ac = AccountAccess.getAccountAccess();
//check to see if EG http server is reachable
checkIfNetAddressIsReachable(GlobalConfigs.httpAddress);
-
- //TODO check params and throw errors
Method method = new Method(methodName);
System.out.println("Method :" + methodName + " param:");
return null;
}
+ // does not throw exception
+ // is fast than with checks for multiple method invocations like in search
+ public static Object doRequestSimple(HttpConnection conn, String service, String methodName, Object[] params){
+ Method method = new Method(methodName);
+ System.out.println("Method :" + methodName + " param:");
+ for(int i=0;i<params.length;i++){
+ method.addParam(params[i]);
+ System.out.print("Param "+i+":" + params[i]);
+ }
+ //need space
+ System.out.println();
+
+ //sync request
+ HttpRequest req = new GatewayRequest(conn, service, method).send();
+ Object resp;
-
+ while ((resp = req.recv()) != null) {
+ System.out.println("Sync Response: " + resp);
+ Object response = (Object) resp;
+
+ return response;
+
+ }
+ return null;
+ }
public static ShowServerNotAvailableRunnable showServerNotAvailableDialog(Context context){
System.out.println("Exception in JSON " + e.getMessage());
}
-
+ //do request and check for connectivity
Object resp = Utils.doRequest(conn, SERVICE, METHOD_MULTICASS_SEARCH, cm, new Object[]{complexParm,searchWords,1});
ArrayList<String> ids = new ArrayList<String>();
}
- public Object getCopyStatuses() throws NoNetworkAccessException, NoAccessToServer{
+ public Object getCopyStatuses() {
- List<OSRFObject> ccs_list = (List<OSRFObject>)Utils.doRequest(conn, SERVICE, METHOD_COPY_STATUS_ALL, cm, new Object[]{});
+ List<OSRFObject> ccs_list = (List<OSRFObject>)Utils.doRequestSimple(conn, SERVICE, METHOD_COPY_STATUS_ALL, new Object[]{});
CopyInformation.availableOrgStatuses = new LinkedHashMap<String,String>();
return ccs_list;
}
- public Object getLocationCount(Integer recordID, Integer orgID, Integer orgDepth) throws NoNetworkAccessException, NoAccessToServer{
+ public Object getLocationCount(Integer recordID, Integer orgID, Integer orgDepth){
- List<?> list = (List<?>)Utils.doRequest(conn, SERVICE, METHOD_COPY_LOCATION_COUNTS, cm, new Object[]{recordID, orgID, orgDepth});
+ List<?> list = (List<?>)Utils.doRequestSimple(conn, SERVICE, METHOD_COPY_LOCATION_COUNTS, new Object[]{recordID, orgID, orgDepth});
return list;
}
}
- public ArrayList<CopyCountInformation> getCopyCount(Integer recordID, Integer orgID) throws NoNetworkAccessException, NoAccessToServer{
+ public ArrayList<CopyCountInformation> getCopyCount(Integer recordID, Integer orgID){
- List<?> list = (List<?>)Utils.doRequest(conn, SERVICE, METHOD_GET_COPY_COUNT, cm, new Object[]{orgID, recordID, ""});
+ List<?> list = (List<?>)Utils.doRequestSimple(conn, SERVICE, METHOD_GET_COPY_COUNT, new Object[]{orgID, recordID, ""});
ArrayList<CopyCountInformation> copyInfoList = new ArrayList<CopyCountInformation>();