@Test public void updateInstallation() throws Exception { Exception error = null; JSONObject json = null; try { NCMBInstallationService installationService = (NCMBInstallationService) NCMB.factory(NCMB.ServiceType.INSTALLATION); JSONObject updateData = new JSONObject(); updateData.put("key", "value_update"); json = installationService.updateInstallation("7FrmPTBKSNtVjajm", updateData); } catch (Exception e) { error = e; } Assert.assertNull(error); Assert.assertEquals("2014-06-04T11:28:30.348Z", json.getString("updateDate")); }
public JSONObject updateInstallation(String objectId, JSONObject params) throws NCMBException { try { params = argumentNullCheckForPUT(objectId, params); try { setInstallationBasicData(params); } catch (JSONException e) { throw new NCMBException(NCMBException.INVALID_JSON, "Invalid json format."); } catch (PackageManager.NameNotFoundException e) { throw new NCMBException(NCMBException.DATA_NOT_FOUND, "PackageManager not found."); } RequestParams request = createRequestParams(objectId, params, null, NCMBRequest.HTTP_METHOD_PUT); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_INSTALLATION_UPDATED) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Updated failed."); } writeCurrentInstallation(params, response.responseData); return response.responseData; } catch (NCMBException error) { checkDataNotFound(objectId, error.getCode()); throw error; } }
NCMBInstallationService extends NCMBService { public JSONObject updateInstallation(String objectId, JSONObject params) throws NCMBException { try { params = argumentNullCheckForPUT(objectId, params); try { setInstallationBasicData(params); } catch (JSONException e) { throw new NCMBException(NCMBException.INVALID_JSON, "Invalid json format."); } catch (PackageManager.NameNotFoundException e) { throw new NCMBException(NCMBException.DATA_NOT_FOUND, "PackageManager not found."); } RequestParams request = createRequestParams(objectId, params, null, NCMBRequest.HTTP_METHOD_PUT); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_INSTALLATION_UPDATED) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Updated failed."); } writeCurrentInstallation(params, response.responseData); return response.responseData; } catch (NCMBException error) { checkDataNotFound(objectId, error.getCode()); throw error; } } }
NCMBInstallationService extends NCMBService { public JSONObject updateInstallation(String objectId, JSONObject params) throws NCMBException { try { params = argumentNullCheckForPUT(objectId, params); try { setInstallationBasicData(params); } catch (JSONException e) { throw new NCMBException(NCMBException.INVALID_JSON, "Invalid json format."); } catch (PackageManager.NameNotFoundException e) { throw new NCMBException(NCMBException.DATA_NOT_FOUND, "PackageManager not found."); } RequestParams request = createRequestParams(objectId, params, null, NCMBRequest.HTTP_METHOD_PUT); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_INSTALLATION_UPDATED) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Updated failed."); } writeCurrentInstallation(params, response.responseData); return response.responseData; } catch (NCMBException error) { checkDataNotFound(objectId, error.getCode()); throw error; } } NCMBInstallationService(NCMBContext context); }
NCMBInstallationService extends NCMBService { public JSONObject updateInstallation(String objectId, JSONObject params) throws NCMBException { try { params = argumentNullCheckForPUT(objectId, params); try { setInstallationBasicData(params); } catch (JSONException e) { throw new NCMBException(NCMBException.INVALID_JSON, "Invalid json format."); } catch (PackageManager.NameNotFoundException e) { throw new NCMBException(NCMBException.DATA_NOT_FOUND, "PackageManager not found."); } RequestParams request = createRequestParams(objectId, params, null, NCMBRequest.HTTP_METHOD_PUT); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_INSTALLATION_UPDATED) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Updated failed."); } writeCurrentInstallation(params, response.responseData); return response.responseData; } catch (NCMBException error) { checkDataNotFound(objectId, error.getCode()); throw error; } } NCMBInstallationService(NCMBContext context); JSONObject createInstallation(String registrationId, JSONObject params); void createInstallationInBackground(String registrationId, JSONObject params, final ExecuteServiceCallback callback); JSONObject updateInstallation(String objectId, JSONObject params); void updateInstallationInBackground(final String objectId, JSONObject params, final ExecuteServiceCallback callback); void deleteInstallation(String objectId); void deleteInstallationInBackground(final String objectId, DoneCallback callback); NCMBInstallation fetchInstallation(String objectId); void fetchInstallationInBackground(String objectId, final FetchCallback callback); List searchInstallation(JSONObject conditions); void searchInstallationInBackground(JSONObject conditions, final SearchInstallationCallback callback); }
NCMBInstallationService extends NCMBService { public JSONObject updateInstallation(String objectId, JSONObject params) throws NCMBException { try { params = argumentNullCheckForPUT(objectId, params); try { setInstallationBasicData(params); } catch (JSONException e) { throw new NCMBException(NCMBException.INVALID_JSON, "Invalid json format."); } catch (PackageManager.NameNotFoundException e) { throw new NCMBException(NCMBException.DATA_NOT_FOUND, "PackageManager not found."); } RequestParams request = createRequestParams(objectId, params, null, NCMBRequest.HTTP_METHOD_PUT); NCMBResponse response = sendRequest(request); if (response.statusCode != HTTP_STATUS_INSTALLATION_UPDATED) { throw new NCMBException(NCMBException.NOT_EFFICIENT_VALUE, "Updated failed."); } writeCurrentInstallation(params, response.responseData); return response.responseData; } catch (NCMBException error) { checkDataNotFound(objectId, error.getCode()); throw error; } } NCMBInstallationService(NCMBContext context); JSONObject createInstallation(String registrationId, JSONObject params); void createInstallationInBackground(String registrationId, JSONObject params, final ExecuteServiceCallback callback); JSONObject updateInstallation(String objectId, JSONObject params); void updateInstallationInBackground(final String objectId, JSONObject params, final ExecuteServiceCallback callback); void deleteInstallation(String objectId); void deleteInstallationInBackground(final String objectId, DoneCallback callback); NCMBInstallation fetchInstallation(String objectId); void fetchInstallationInBackground(String objectId, final FetchCallback callback); List searchInstallation(JSONObject conditions); void searchInstallationInBackground(JSONObject conditions, final SearchInstallationCallback callback); static final String SERVICE_PATH; static final int HTTP_STATUS_INSTALLATION_CREATED; static final int HTTP_STATUS_INSTALLATION_UPDATED; static final int HTTP_STATUS_INSTALLATION_DELETED; static final int HTTP_STATUS_INSTALLATION_GOTTEN; }