List of usage examples for org.json JSONObject isNull
public boolean isNull(String key)
From source file:org.wso2.emm.agent.services.PolicyComplianceChecker.java
/** * Checks Wifi policy on the device (Particular wifi configuration in the policy should be enforced). * * @param operation - Operation object.// www.j a v a 2 s . c om * @return policy - ComplianceFeature object. */ private ComplianceFeature checkWifiPolicy(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { String ssid = null; try { JSONObject wifiData = new JSONObject(operation.getPayLoad().toString()); if (!wifiData.isNull(resources.getString(R.string.intent_extra_ssid))) { ssid = (String) wifiData.get(resources.getString(R.string.intent_extra_ssid)); } WiFiConfig config = new WiFiConfig(context.getApplicationContext()); if (config.findWifiConfigurationBySsid(ssid)) { policy.setCompliance(true); } else { policy.setCompliance(false); policy.setMessage(resources.getString(R.string.error_wifi_policy)); } } catch (JSONException e) { throw new AndroidAgentException("Invalid JSON format.", e); } return policy; }
From source file:org.wso2.emm.agent.services.PolicyComplianceChecker.java
/** * Checks Work-Profile policy on the device (Particular work-profile configuration in the policy should be enforced). * * @param operation - Operation object./* w ww .j ava 2 s .co m*/ * @return policy - ComplianceFeature object. */ private ComplianceFeature checkWorkProfilePolicy(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { String profileName; String systemAppsData; String googlePlayAppsData; try { JSONObject profileData = new JSONObject(operation.getPayLoad().toString()); if (!profileData.isNull(resources.getString(R.string.intent_extra_profile_name))) { profileName = (String) profileData.get(resources.getString(R.string.intent_extra_profile_name)); //yet there is no method is given to get the current profile name. //add a method to test whether profile name is set correctly once introduced. } if (!profileData.isNull(resources.getString(R.string.intent_extra_enable_system_apps))) { // generate the System app list which are configured by user and received to agent as a single String // with packages separated by Commas. systemAppsData = (String) profileData .get(resources.getString(R.string.intent_extra_enable_system_apps)); List<String> systemAppList = Arrays .asList(systemAppsData.split(resources.getString(R.string.split_delimiter))); for (String packageName : systemAppList) { if (!applicationManager.isPackageInstalled(packageName)) { policy.setCompliance(false); policy.setMessage(resources.getString(R.string.error_work_profile_policy)); return policy; } } } if (!profileData.isNull(resources.getString(R.string.intent_extra_enable_google_play_apps))) { googlePlayAppsData = (String) profileData .get(resources.getString(R.string.intent_extra_enable_google_play_apps)); List<String> playStoreAppList = Arrays .asList(googlePlayAppsData.split(resources.getString(R.string.split_delimiter))); for (String packageName : playStoreAppList) { if (!applicationManager.isPackageInstalled(packageName)) { policy.setCompliance(false); policy.setMessage(resources.getString(R.string.error_work_profile_policy)); return policy; } } } } catch (JSONException e) { throw new AndroidAgentException("Invalid JSON format.", e); } policy.setCompliance(true); return policy; }
From source file:de.btobastian.javacord.entities.permissions.impl.ImplBan.java
public ImplBan(ImplDiscordAPI api, ImplServer server, JSONObject data) { this.server = server; this.user = api.getOrCreateUser(data.getJSONObject("user")); this.reason = data.isNull("reason") ? null : data.getString("reason"); }
From source file:org.wso2.emm.agent.services.PolicyRevokeHandler.java
/** * Revokes install app policy on the device (Particular app in the policy should be removed). * * @param operation - Operation object./* w w w .ja v a 2 s. co m*/ */ private void revokeInstallAppPolicy(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { String appIdentifier = null; try { JSONObject appData = new JSONObject(operation.getPayLoad().toString()); if (!appData.isNull(resources.getString(R.string.app_identifier))) { appIdentifier = appData.getString(resources.getString(R.string.app_identifier)); } if (isAppInstalled(appIdentifier)) { applicationManager.uninstallApplication(appIdentifier, null); } } catch (JSONException e) { throw new AndroidAgentException("Invalid JSON format.", e); } }
From source file:org.wso2.emm.agent.services.PolicyRevokeHandler.java
/** * Revokes Wifi policy on the device (Particular wifi configuration in the policy should be disabled). * * @param operation - Operation object.//from w w w .j av a2 s . c om */ private void revokeWifiPolicy(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { String ssid = null; try { JSONObject wifiData = new JSONObject(operation.getPayLoad().toString()); if (!wifiData.isNull(resources.getString(R.string.intent_extra_ssid))) { ssid = (String) wifiData.get(resources.getString(R.string.intent_extra_ssid)); } WiFiConfig config = new WiFiConfig(context.getApplicationContext()); if (config.findWifiConfigurationBySsid(ssid)) { config.removeWifiConfigurationBySsid(ssid); } } catch (JSONException e) { throw new AndroidAgentException("Invalid JSON format.", e); } }
From source file:net.dv8tion.jda.core.handle.UserUpdateHandler.java
@Override protected Long handleInternally(JSONObject content) { SelfUserImpl self = (SelfUserImpl) api.getSelfUser(); String name = content.getString("username"); String discriminator = content.getString("discriminator"); String avatarId = !content.isNull("avatar") ? content.getString("avatar") : null; Boolean verified = content.has("verified") ? content.getBoolean("verified") : null; Boolean mfaEnabled = content.has("mfa_enabled") ? content.getBoolean("mfa_enabled") : null; //Client only String email = !content.isNull("email") ? content.getString("email") : null; if (!Objects.equals(name, self.getName()) || !Objects.equals(discriminator, self.getDiscriminator())) { String oldName = self.getName(); String oldDiscriminator = self.getDiscriminator(); self.setName(name);/*from ww w .j a va2s .c o m*/ self.setDiscriminator(discriminator); api.getEventManager().handle(new SelfUpdateNameEvent(api, responseNumber, oldName, oldDiscriminator)); } if (!Objects.equals(avatarId, self.getAvatarId())) { String oldAvatarId = self.getAvatarId(); self.setAvatarId(avatarId); api.getEventManager().handle(new SelfUpdateAvatarEvent(api, responseNumber, oldAvatarId)); } if (verified != null && verified != self.isVerified()) { boolean wasVerified = self.isVerified(); self.setVerified(verified); api.getEventManager().handle(new SelfUpdateVerifiedEvent(api, responseNumber, wasVerified)); } if (mfaEnabled != null && mfaEnabled != self.isMfaEnabled()) { boolean wasMfaEnabled = self.isMfaEnabled(); self.setMfaEnabled(mfaEnabled); api.getEventManager().handle(new SelfUpdateMFAEvent(api, responseNumber, wasMfaEnabled)); } if (api.getAccountType() == AccountType.CLIENT && !Objects.equals(email, self.getEmail())) { String oldEmail = self.getEmail(); self.setEmail(email); api.getEventManager().handle(new SelfUpdateEmailEvent(api, responseNumber, oldEmail)); } return null; }
From source file:com.aokyu.dev.pocket.RequestToken.java
RequestToken(JSONObject jsonObj) throws PocketException { try {/*from w w w .j a v a 2s.c o m*/ if (!jsonObj.isNull(KEY_CODE)) { mToken = jsonObj.getString(KEY_CODE); } } catch (JSONException e) { throw new PocketException(); } if (mToken == null) { throw new PocketException(); } }
From source file:org.protorabbit.json.DefaultSerializer.java
@SuppressWarnings("unchecked") void invokeMethod(Method[] methods, String key, String name, JSONObject jo, Object targetObject) { Object param = null;/*from w w w. ja v a2 s . c o m*/ Throwable ex = null; for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (m.getName().equals(name)) { Class<?>[] paramTypes = m.getParameterTypes(); if (paramTypes.length == 1 && jo.has(key)) { Class<?> tparam = paramTypes[0]; boolean allowNull = false; try { if (jo.isNull(key)) { // do nothing because param is already null : lets us not null on other types } else if (Long.class.isAssignableFrom(tparam) || tparam == long.class) { param = new Long(jo.getLong(key)); } else if (Double.class.isAssignableFrom(tparam) || tparam == double.class) { param = new Double(jo.getDouble(key)); } else if (Integer.class.isAssignableFrom(tparam) || tparam == int.class) { param = new Integer(jo.getInt(key)); } else if (String.class.isAssignableFrom(tparam)) { param = jo.getString(key); } else if (Enum.class.isAssignableFrom(tparam)) { param = Enum.valueOf((Class<? extends Enum>) tparam, jo.getString(key)); } else if (Boolean.class.isAssignableFrom(tparam)) { param = new Boolean(jo.getBoolean(key)); } else if (jo.isNull(key)) { param = null; allowNull = true; } else if (Collection.class.isAssignableFrom(tparam)) { if (m.getGenericParameterTypes().length > 0) { Type t = m.getGenericParameterTypes()[0]; if (t instanceof ParameterizedType) { ParameterizedType tv = (ParameterizedType) t; if (tv.getActualTypeArguments().length > 0 && tv.getActualTypeArguments()[0] == String.class) { List<String> ls = new ArrayList<String>(); JSONArray ja = jo.optJSONArray(key); if (ja != null) { for (int j = 0; j < ja.length(); j++) { ls.add(ja.getString(j)); } } param = ls; } else if (tv.getActualTypeArguments().length == 1) { ParameterizedType type = (ParameterizedType) tv.getActualTypeArguments()[0]; Class itemClass = (Class) type.getRawType(); if (itemClass == Map.class && type.getActualTypeArguments().length == 2 && type.getActualTypeArguments()[0] == String.class && type.getActualTypeArguments()[1] == Object.class) { List<Map<String, Object>> ls = new ArrayList<Map<String, Object>>(); JSONArray ja = jo.optJSONArray(key); if (ja != null) { for (int j = 0; j < ja.length(); j++) { Map<String, Object> map = new HashMap<String, Object>(); JSONObject mo = ja.getJSONObject(j); Iterator<String> keys = mo.keys(); while (keys.hasNext()) { String okey = keys.next(); Object ovalue = null; // make sure we don't get JSONObject$Null if (!mo.isNull(okey)) { ovalue = mo.get(okey); } map.put(okey, ovalue); } ls.add(map); } } param = ls; } else { getLogger().warning( "Don't know how to handle Collection of type : " + itemClass); } } else { getLogger().warning("Don't know how to handle Collection of type : " + tv.getActualTypeArguments()[0]); } } } } else { getLogger().warning( "Unable to serialize " + key + " : Don't know how to handle " + tparam); } } catch (JSONException e) { e.printStackTrace(); } if (param != null || allowNull) { try { if (m != null) { Object[] args = { param }; m.invoke(targetObject, args); ex = null; break; } } catch (SecurityException e) { ex = e; } catch (IllegalArgumentException e) { ex = e; } catch (IllegalAccessException e) { ex = e; } catch (InvocationTargetException e) { ex = e; } } } } } if (ex != null) { if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } else { throw new RuntimeException(ex); } } }
From source file:com.markupartist.sthlmtraveling.provider.planner.Planner.java
public Trip2 addIntermediateStops(final Context context, Trip2 trip, JourneyQuery query) throws IOException { Uri u = Uri.parse(apiEndpoint2());// w ww. j av a 2 s. c o m Uri.Builder b = u.buildUpon(); b.appendEncodedPath("journey/v1/intermediate/"); b.appendQueryParameter("ident", query.ident); b.appendQueryParameter("seqnr", query.seqnr); int references = 0; String reference = null; for (SubTrip st : trip.subTrips) { if ((!TextUtils.isEmpty(st.reference)) && st.intermediateStop.isEmpty()) { b.appendQueryParameter("reference", st.reference); references++; reference = st.reference; } } u = b.build(); if (references == 0) { return trip; } HttpHelper httpHelper = HttpHelper.getInstance(context); HttpURLConnection connection = httpHelper.getConnection(u.toString()); String rawContent; int statusCode = connection.getResponseCode(); switch (statusCode) { case 200: rawContent = httpHelper.getBody(connection); try { JSONObject baseResponse = new JSONObject(rawContent); if (baseResponse.has("stops")) { if (baseResponse.isNull("stops")) { Log.d(TAG, "stops was null, ignoring."); } else if (references == 1) { JSONArray intermediateStopsJson = baseResponse.getJSONArray("stops"); for (SubTrip st : trip.subTrips) { if (reference.equals(st.reference)) { for (int i = 0; i < intermediateStopsJson.length(); i++) { st.intermediateStop .add(IntermediateStop.fromJson(intermediateStopsJson.getJSONObject(i))); } } } } else { JSONObject intermediateStopsJson = baseResponse.getJSONObject("stops"); for (SubTrip st : trip.subTrips) { if (intermediateStopsJson.has(st.reference)) { JSONArray jsonArray = intermediateStopsJson.getJSONArray(st.reference); for (int i = 0; i < jsonArray.length(); i++) { st.intermediateStop.add(IntermediateStop.fromJson(jsonArray.getJSONObject(i))); } } } } } else { Log.w(TAG, "Invalid response when fetching intermediate stops."); } } catch (JSONException e) { Log.w(TAG, "Could not parse the reponse for intermediate stops."); } break; case 400: // Bad request rawContent = httpHelper.getErrorBody(connection); try { BadResponse br = BadResponse.fromJson(new JSONObject(rawContent)); Log.e(TAG, "Invalid response for intermediate stops: " + br.toString()); } catch (JSONException e) { Log.e(TAG, "Could not parse the reponse for intermediate stops."); } default: Log.e(TAG, "Status code not OK from intermediate stops API, was " + statusCode); } return trip; }
From source file:com.roiland.crm.sm.core.service.impl.ProjectAPIImpl.java
/** * @see com.roiland.crm.core.service.ProjectAPI#getProjectInfo(java.lang.String, java.lang.String, java.lang.String, java.lang.String) *///from ww w. j a v a2s.c o m @Override public Project getProjectInfo(String userID, String dealerOrgID, String projectID, String customerID) throws ResponseException { Project project = null; try { if (userID == null || dealerOrgID == null) { throw new ResponseException("userID or dealerOrgID is null."); } JSONObject params = new JSONObject(); params.put("userID", userID); params.put("dealerOrgID", dealerOrgID); params.put("projectID", projectID); params.put("customerID", customerID); RLHttpResponse response = getHttpClient() .executePostJSON(getURLAddress(URLContact.METHOD_GET_PROJECT_INFO), params, null); if (response.isSuccess()) { project = new Project(); JSONObject result = new JSONObject(getSimpleString(response)).getJSONObject("result"); JSONObject customerEntityresult = result.getJSONObject("customerEntity"); JSONObject purchaseCarIntentionresult = result.getJSONObject("purchaseCarIntention"); Customer customerEntity = new Customer(); PurchaseCarIntention purchaseCarIntention = new PurchaseCarIntention(); if (StringUtils.isEmpty(projectID)) { customerEntity.setProjectID(projectID); } customerEntity.setCustomerID(parsingString(customerEntityresult.get("customerID"))); customerEntity.setCustName(parsingString(customerEntityresult.get("custName"))); customerEntity.setCustFromCode(parsingString(customerEntityresult.get("custFromCode"))); customerEntity.setCustFrom(parsingString(customerEntityresult.get("custFrom"))); customerEntity.setCustTypeCode(parsingString(customerEntityresult.get("custTypeCode"))); customerEntity.setCustType(parsingString(customerEntityresult.get("custType"))); customerEntity.setInfoFromCode(parsingString(customerEntityresult.get("infoFromCode"))); customerEntity.setInfoFrom(parsingString(customerEntityresult.get("infoFrom"))); customerEntity.setCollectFromCode(parsingString(customerEntityresult.get("collectFromCode"))); customerEntity.setCollectFrom(parsingString(customerEntityresult.get("collectFrom"))); customerEntity.setCustMobile(parsingString(customerEntityresult.get("custMobile"))); customerEntity.setCustOtherPhone(parsingString(customerEntityresult.get("custOtherPhone"))); customerEntity.setGenderCode(parsingString(customerEntityresult.get("genderCode"))); customerEntity.setGender(parsingString(customerEntityresult.get("gender"))); customerEntity.setBirthday(parsingString(customerEntityresult.get("birthday"))); customerEntity.setIdTypeCode((parsingString(customerEntityresult.get("idTypeCode")))); customerEntity.setIdType(parsingString(customerEntityresult.get("idType"))); customerEntity.setIdNumber(parsingString(customerEntityresult.get("idNumber"))); customerEntity.setProvinceCode(parsingString(customerEntityresult.get("provinceCode"))); customerEntity.setProvince(parsingString(customerEntityresult.get("province"))); customerEntity.setCityCode(parsingString(customerEntityresult.get("cityCode"))); customerEntity.setCity(parsingString(customerEntityresult.get("city"))); customerEntity.setDistrictCode(parsingString(customerEntityresult.get("districtCode"))); customerEntity.setDistrict(parsingString(customerEntityresult.get("district"))); customerEntity.setQq(parsingString(customerEntityresult.get("qq"))); customerEntity.setAddress(parsingString(customerEntityresult.get("address"))); customerEntity.setPostcode(parsingString(customerEntityresult.get("postcode"))); customerEntity.setEmail(parsingString(customerEntityresult.get("email"))); customerEntity.setConvContactTime(parsingString(customerEntityresult.get("convContactTime"))); // customerEntity.setConvContactTimeCode((customerEntityresult // .get("convContactTimeCode"))); customerEntity .setExpectContactWayCode(parsingString(customerEntityresult.get("expectContactWayCode"))); customerEntity.setExpectContactWay((parsingString(customerEntityresult.get("expectContactWay")))); customerEntity.setFax(parsingString(customerEntityresult.get("fax"))); // customerEntity.setExistingCarCode(String // .valueOf(parsingString(customerEntityresult // .get("existingCarCode")))); customerEntity.setExistingCarBrand(parsingString(customerEntityresult.get("existingCarBrand"))); customerEntity.setIndustryCode(parsingString(customerEntityresult.get("industryCode"))); customerEntity.setPositionCode(parsingString(customerEntityresult.get("positionCode"))); customerEntity.setEducationCode(parsingString(customerEntityresult.get("educationCode"))); customerEntity.setExistingCar(parsingString(customerEntityresult.get("existingCar"))); customerEntity.setIndustry(parsingString(customerEntityresult.get("industry"))); customerEntity.setPosition(parsingString(customerEntityresult.get("position"))); customerEntity.setEducation(parsingString(customerEntityresult.get("education"))); customerEntity.setCustInterestCode1(parsingString(customerEntityresult.get("custInterestCode1"))); customerEntity.setCustInterest1((parsingString(customerEntityresult.get("custInterest1")))); customerEntity.setCustInterestCode2((parsingString(customerEntityresult.get("custInterestCode2")))); customerEntity.setCustInterest2(parsingString(customerEntityresult.get("custInterest2"))); customerEntity.setCustInterestCode3(parsingString(customerEntityresult.get("custInterestCode3"))); customerEntity.setCustInterest3(parsingString(customerEntityresult.get("custInterest3"))); customerEntity.setExistLisenPlate(parsingString(customerEntityresult.get("existLisenPlate"))); customerEntity.setEnterpTypeCode(parsingString(customerEntityresult.get("enterpTypeCode"))); customerEntity.setEnterpType(parsingString(customerEntityresult.get("enterpType"))); customerEntity .setEnterpPeopleCountCode(parsingString(customerEntityresult.get("enterpPeopleCountCode"))); customerEntity.setEnterpPeopleCount(parsingString(customerEntityresult.get("enterpPeopleCount"))); customerEntity .setRegisteredCapitalCode(parsingString(customerEntityresult.get("registeredCapitalCode"))); customerEntity.setRegisteredCapital(parsingString(customerEntityresult.get("registeredCapital"))); // customerEntity.setCompeCarModelCode(String // .valueOf(parsingString(customerEntityresult // .get("compeCarModelCode")))); customerEntity.setCompeCarModel(parsingString(customerEntityresult.get("compeCarModel"))); customerEntity.setRebuyStoreCustTag( Boolean.parseBoolean((parsingString(customerEntityresult.get("rebuyStoreCustTag"))))); customerEntity.setRebuyOnlineCustTag( Boolean.parseBoolean(parsingString(customerEntityresult.get("rebuyOnlineCustTag")))); customerEntity.setChangeCustTag( Boolean.parseBoolean(parsingString(customerEntityresult.get("changeCustTag")))); customerEntity.setLoanCustTag( Boolean.parseBoolean((parsingString(customerEntityresult.get("loanCustTag"))))); customerEntity.setHeaderQuartCustTag( Boolean.parseBoolean(parsingString(customerEntityresult.get("headerQuartCustTag")))); customerEntity.setRegularCustTag( Boolean.parseBoolean(parsingString(customerEntityresult.get("regularCustTag")))); customerEntity.setRegularCustCode(parsingString(customerEntityresult.get("regularCustCode"))); customerEntity.setRegularCust(parsingString(customerEntityresult.get("regularCust"))); customerEntity .setBigCustTag(Boolean.parseBoolean(parsingString(customerEntityresult.get("bigCustTag")))); customerEntity.setBigCustsCode(parsingString(customerEntityresult.get("bigCustsCode"))); customerEntity.setBigCusts(parsingString(customerEntityresult.get("bigCusts"))); customerEntity.setCustComment(parsingString(customerEntityresult.get("custComment"))); //customerEntity.setHasUnexePlan(parsingString(customerEntityresult.get("hasUnexePlan"))); purchaseCarIntention.setBrandCode(parsingString(purchaseCarIntentionresult.get("brandCode"))); purchaseCarIntention.setBrand(parsingString(purchaseCarIntentionresult.get("brand"))); purchaseCarIntention.setModelCode(parsingString(purchaseCarIntentionresult.get("modelCode"))); purchaseCarIntention.setModel(parsingString(purchaseCarIntentionresult.get("model"))); purchaseCarIntention .setOutsideColorCode(parsingString(purchaseCarIntentionresult.get("outsideColorCode"))); purchaseCarIntention.setOutsideColor(parsingString(purchaseCarIntentionresult.get("outsideColor"))); purchaseCarIntention .setInsideColorCode(parsingString(purchaseCarIntentionresult.get("insideColorCode"))); purchaseCarIntention.setInsideColor(parsingString(purchaseCarIntentionresult.get("insideColor"))); purchaseCarIntention.setInsideColorCheck( purchaseCarIntentionresult.getBoolean("insideColorCheck") ? true : false); purchaseCarIntention.setCarConfigurationCode( parsingString(purchaseCarIntentionresult.get("carConfigurationCode"))); purchaseCarIntention .setCarConfiguration(parsingString(purchaseCarIntentionresult.get("carConfiguration"))); purchaseCarIntention.setSalesQuote(parsingString(purchaseCarIntentionresult.get("salesQuote"))); purchaseCarIntention.setDealPriceIntervalCode( parsingString(purchaseCarIntentionresult.get("dealPriceIntervalCode"))); purchaseCarIntention .setDealPriceInterval(parsingString(purchaseCarIntentionresult.get("dealPriceInterval"))); purchaseCarIntention.setPaymentCode(parsingString(purchaseCarIntentionresult.get("paymentCode"))); purchaseCarIntention.setPayment(parsingString(purchaseCarIntentionresult.get("payment"))); purchaseCarIntention .setPreorderCount(parsingString(purchaseCarIntentionresult.get("preorderCount"))); purchaseCarIntention.setPreorderDate(purchaseCarIntentionresult.isNull("preorderDate") ? 0L : purchaseCarIntentionresult.getLong("preorderDate")); purchaseCarIntention .setFlowStatusCode(parsingString(purchaseCarIntentionresult.get("flowStatusCode"))); purchaseCarIntention.setFlowStatus(parsingString(purchaseCarIntentionresult.get("flowStatus"))); purchaseCarIntention.setDealPossibility(purchaseCarIntentionresult.isNull("dealPossibility") ? "" : parsingString(purchaseCarIntentionresult.get("dealPossibility"))); purchaseCarIntention.setPurchMotivationCode( parsingString(purchaseCarIntentionresult.get("purchMotivationCode"))); purchaseCarIntention .setPurchMotivation(parsingString(purchaseCarIntentionresult.get("purchMotivation"))); purchaseCarIntention.setChassisNo(parsingString(purchaseCarIntentionresult.get("chassisNo"))); purchaseCarIntention.setEngineNo(parsingString(purchaseCarIntentionresult.get("engineNo"))); purchaseCarIntention.setLicensePlate(parsingString(purchaseCarIntentionresult.get("licensePlate"))); purchaseCarIntention.setLicenseProp(parsingString(purchaseCarIntentionresult.get("licenseProp"))); purchaseCarIntention .setLicensePropCode(parsingString(purchaseCarIntentionresult.get("licensePropCode"))); purchaseCarIntention.setPickupDate(parsingString(purchaseCarIntentionresult.get("pickupDate"))); purchaseCarIntention.setPreorderTag(parsingString(purchaseCarIntentionresult.get("preorderTag"))); purchaseCarIntention.setGiveupTag(purchaseCarIntentionresult.getBoolean("giveupTag")); purchaseCarIntention.setGiveupReason(parsingString(purchaseCarIntentionresult.get("giveupReason"))); // purchaseCarIntention.setGiveupReasonCode(String // .valueOf(parsingString(purchaseCarIntentionresult // .get("giveupReasonCode"))); purchaseCarIntention.setInvoiceTitle(parsingString(purchaseCarIntentionresult.get("invoiceTitle"))); purchaseCarIntention .setProjectComment(parsingString(purchaseCarIntentionresult.get("projectComment"))); // ?? purchaseCarIntention.setHasActiveOrder(purchaseCarIntentionresult.getBoolean("hasActiveOrder")); // ? purchaseCarIntention.setHasActiveDrive(purchaseCarIntentionresult.getBoolean("hasActiveDrive")); //? purchaseCarIntention.setHasUnexePlan(purchaseCarIntentionresult.getBoolean("hasUnexePlan")); //??? purchaseCarIntention.setOrderStatus(parsingString(purchaseCarIntentionresult.get("orderStatus"))); project.setCustomer(customerEntity); project.setPurchaseCarIntention(purchaseCarIntention); return project; } throw new ResponseException(); } catch (IOException e) { Log.e(tag, "Connection network error.", e); throw new ResponseException(e); } catch (JSONException e) { Log.e(tag, "Parsing data error.", e); throw new ResponseException(e); } }