@Test(enabled = false) public void testExecuteBatch_invalidQuery() throws FMSException { BatchOperation batchOperation = new BatchOperation(); String query = "select * from customer"; batchOperation.addQuery(query, "13"); service.executeBatch(batchOperation); Assert.assertNotNull(batchOperation.getFault("13")); Assert.assertTrue(batchOperation.getFault("13").getError().size() > 0); }
public void executeBatch(BatchOperation batchOperation) throws FMSException { IntuitMessage intuitMessage = prepareBatch(batchOperation); executeInterceptors(intuitMessage); IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } } } }
DataService { public void executeBatch(BatchOperation batchOperation) throws FMSException { IntuitMessage intuitMessage = prepareBatch(batchOperation); executeInterceptors(intuitMessage); IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } } } } }
DataService { public void executeBatch(BatchOperation batchOperation) throws FMSException { IntuitMessage intuitMessage = prepareBatch(batchOperation); executeInterceptors(intuitMessage); IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } } } } protected  DataService();  DataService(final Context context); }
DataService { public void executeBatch(BatchOperation batchOperation) throws FMSException { IntuitMessage intuitMessage = prepareBatch(batchOperation); executeInterceptors(intuitMessage); IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } } } } protected  DataService();  DataService(final Context context); @SuppressWarnings("unchecked") List<T> findAll(T entity); @SuppressWarnings("unchecked") QueryResult findAllTaxClassification(); @SuppressWarnings("unchecked") T add(T entity); @SuppressWarnings("unchecked") T delete(T entity); @SuppressWarnings("unchecked") T update(T entity); @SuppressWarnings("unchecked") T updateAccountOnTxns(T entity); @SuppressWarnings("unchecked") T donotUpdateAccountOnTxns(T entity); @SuppressWarnings("unchecked") T findById(T entity); @SuppressWarnings("unchecked") QueryResult findTaxClassificationByParentId(IEntity entity); @SuppressWarnings("unchecked") QueryResult findTaxClassificationByLevel(IEntity entity); @SuppressWarnings("unchecked") T voidRequest(T entity); @SuppressWarnings("unchecked") T upload(T entity, InputStream docContent); List<T> upload(List<UploadEntry> entries); InputStream download(T entity); InputStream downloadPDF(T entity); T sendEmail(T entity); @SuppressWarnings("unchecked") T sendEmail(T entity, String email); boolean isAvailableAsPDF(T entity); boolean isAvailableToEmail(T entity); QueryResult executeQuery(String query); List<CDCQueryResult> executeCDCQuery(List<? extends IEntity> entities, String changedSince); void executeBatch(BatchOperation batchOperation); void findAllAsync(T entity, CallbackHandler callbackHandler); void addAsync(T entity, CallbackHandler callbackHandler); void deleteAsync(T entity, CallbackHandler callbackHandler); void updateAsync(T entity, CallbackHandler callbackHandler); void findByIdAsync(T entity, CallbackHandler callbackHandler); void voidRequestAsync(T entity, CallbackHandler callbackHandler); void uploadAsync(T entity, InputStream docContent, CallbackHandler callbackHandler); void downloadAsync(T entity, CallbackHandler callbackHandler); void downloadPDFAsync(T entity, CallbackHandler callbackHandler); void sendEmailAsync(T entity, CallbackHandler callbackHandler); void sendEmailAsync(T entity, String email, CallbackHandler callbackHandler); void executeQueryAsync(String query, CallbackHandler callbackHandler); void executeCDCQueryAsync(List<? extends IEntity> entities, String changedSince, CallbackHandler callbackHandler); EntitlementsResponse getEntitlements(); void executeBatchAsync(BatchOperation batchOperation, CallbackHandler callbackHandler); }
DataService { public void executeBatch(BatchOperation batchOperation) throws FMSException { IntuitMessage intuitMessage = prepareBatch(batchOperation); executeInterceptors(intuitMessage); IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse(); if (intuitResponse != null) { List<BatchItemResponse> batchItemResponses = intuitResponse.getBatchItemResponse(); if (batchItemResponses != null && !batchItemResponses.isEmpty()) { int count = 0; Iterator<BatchItemResponse> itr = batchItemResponses.iterator(); while (itr.hasNext()) { BatchItemResponse batchItemResponse = itr.next(); String bId = batchItemResponse.getBId(); if (!StringUtils.hasText(bId)) { bId = batchOperation.getBatchItemRequests().get(count).getBId(); } if (batchItemResponse.getFault() != null) { batchOperation.getFaultResult().put(bId, batchItemResponse.getFault()); } else if (batchItemResponse.getReport() != null) { batchOperation.getReportResult().put(bId, batchItemResponse.getReport()); } else if (batchItemResponse.getIntuitObject() != null) { batchOperation.getEntityResult().put(bId, (IEntity) batchItemResponse.getIntuitObject().getValue()); } else if (batchItemResponse.getQueryResponse() != null) { QueryResult queryResult = getQueryResult(batchItemResponse.getQueryResponse()); batchOperation.getQueryResult().put(bId, queryResult); } else if (batchItemResponse.getCDCResponse() != null) { CDCQueryResult cdcQueryResult = getCDCQueryResult(batchItemResponse.getCDCResponse()); batchOperation.getCDCQueryResult().put(bId, cdcQueryResult); } else { LOG.warn("BatchItemResponse is not Fault, Entity, Query and Report."); } count++; } } } } protected  DataService();  DataService(final Context context); @SuppressWarnings("unchecked") List<T> findAll(T entity); @SuppressWarnings("unchecked") QueryResult findAllTaxClassification(); @SuppressWarnings("unchecked") T add(T entity); @SuppressWarnings("unchecked") T delete(T entity); @SuppressWarnings("unchecked") T update(T entity); @SuppressWarnings("unchecked") T updateAccountOnTxns(T entity); @SuppressWarnings("unchecked") T donotUpdateAccountOnTxns(T entity); @SuppressWarnings("unchecked") T findById(T entity); @SuppressWarnings("unchecked") QueryResult findTaxClassificationByParentId(IEntity entity); @SuppressWarnings("unchecked") QueryResult findTaxClassificationByLevel(IEntity entity); @SuppressWarnings("unchecked") T voidRequest(T entity); @SuppressWarnings("unchecked") T upload(T entity, InputStream docContent); List<T> upload(List<UploadEntry> entries); InputStream download(T entity); InputStream downloadPDF(T entity); T sendEmail(T entity); @SuppressWarnings("unchecked") T sendEmail(T entity, String email); boolean isAvailableAsPDF(T entity); boolean isAvailableToEmail(T entity); QueryResult executeQuery(String query); List<CDCQueryResult> executeCDCQuery(List<? extends IEntity> entities, String changedSince); void executeBatch(BatchOperation batchOperation); void findAllAsync(T entity, CallbackHandler callbackHandler); void addAsync(T entity, CallbackHandler callbackHandler); void deleteAsync(T entity, CallbackHandler callbackHandler); void updateAsync(T entity, CallbackHandler callbackHandler); void findByIdAsync(T entity, CallbackHandler callbackHandler); void voidRequestAsync(T entity, CallbackHandler callbackHandler); void uploadAsync(T entity, InputStream docContent, CallbackHandler callbackHandler); void downloadAsync(T entity, CallbackHandler callbackHandler); void downloadPDFAsync(T entity, CallbackHandler callbackHandler); void sendEmailAsync(T entity, CallbackHandler callbackHandler); void sendEmailAsync(T entity, String email, CallbackHandler callbackHandler); void executeQueryAsync(String query, CallbackHandler callbackHandler); void executeCDCQueryAsync(List<? extends IEntity> entities, String changedSince, CallbackHandler callbackHandler); EntitlementsResponse getEntitlements(); void executeBatchAsync(BatchOperation batchOperation, CallbackHandler callbackHandler);  }