Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- String data = "";
- Order order = orderConnector.getOrder(orderId);
- if (order.hasNote())
- {
- JSONArray jsonArray = new JSONArray(CommonMethods.getInstance().changeFormattedStringToJson(order.getNote()));
- for (int i = 0; i < jsonArray.length(); i++)
- {
- JSONObject jsonObject = jsonArray.getJSONObject(i);
- if (jsonObject.getString(MyConstants.LINE_ITEM_ID).equals(lineItemIDLocal))
- {
- jsonArray.remove(i);
- }
- }
- data = CommonMethods.getInstance().changeJsonToFormattedString(jsonArray.put(CommonMethods.getInstance().createJsonObject(itemIDLocal, lineItemIDLocal, myPrice, timeType, name)));
- }
- else
- {
- JSONArray jsonArray = new JSONArray();
- data = CommonMethods.getInstance().changeJsonToFormattedString(jsonArray.put(CommonMethods.getInstance().createJsonObject(itemIDLocal, lineItemIDLocal, myPrice, timeType, name)));
- }
- order.setNote(data);
- try {
- orderConnector.updateOrder(order);
- } catch (RemoteException e) {
- e.printStackTrace();
- } catch (ClientException e) {
- e.printStackTrace();
- } catch (ServiceException e) {
- e.printStackTrace();
- } catch (BindingException e) {
- e.printStackTrace();
- } catch (NumberFormatException e) {
- e.printStackTrace();
- } catch (NullPointerException e) {
- e.printStackTrace();
- }
- }
- catch (RemoteException | ClientException | ServiceException | BindingException e)
- {
- e.printStackTrace();
- } catch (JSONException e) {
- e.printStackTrace();
- } catch (NumberFormatException e) {
- e.printStackTrace();
- } catch (NullPointerException e) {
- e.printStackTrace();
- }
- return null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement