@Test public void testCreateDisposal() { final RequestInfo requestInfo = new RequestInfo(); final User user = new User(); user.setId(1l); requestInfo.setUserInfo(user); final Disposal disposal = getDisposalFromDB(); final DisposalRequest disposalRequest = new DisposalRequest(); disposalRequest.setRequestInfo(requestInfo); disposalRequest.setDisposal(disposal); when(jdbcTemplate.update(any(String.class), any(Object[].class))).thenReturn(1); disposalRepository.create(disposalRequest); }
public void create(final DisposalRequest disposalRequest) { final RequestInfo requestInfo = disposalRequest.getRequestInfo(); final Disposal disposal = disposalRequest.getDisposal(); final List<Document> documents = disposal.getDocuments(); if (documents != null) { final String sql = "INSERT INTO egasset_document (id,asset,filestore,tenantid,documenttype) values " + "(nextval('seq_egasset_document'),?,?,?,?);"; log.info("the insert query for assets docs : " + sql); final List<Object[]> documentBatchArgs = new ArrayList<>(); for (final Document document : documents) { final Object[] documentRecord = { disposal.getAssetId(), document.getFileStore(), disposal.getTenantId(),document.getDocumentType() }; documentBatchArgs.add(documentRecord); } try { jdbcTemplate.batchUpdate(sql, documentBatchArgs); } catch (final DataAccessException ex) { log.info("exception saving Sale/Disposal document details" + ex); throw new RuntimeException("exception saving Sale/Disposal document details"); } } final Object[] values = { disposal.getId(), disposal.getTenantId(), disposal.getAssetId(), disposal.getBuyerName(), disposal.getBuyerAddress(), disposal.getDisposalReason(), disposal.getDisposalDate(), disposal.getPanCardNumber(), disposal.getAadharCardNumber(), disposal.getAssetCurrentValue(), disposal.getSaleValue(), disposal.getTransactionType().toString(), disposal.getAssetSaleAccount(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), disposal.getProfitLossVoucherReference() }; try { jdbcTemplate.update(DisposalQueryBuilder.INSERT_QUERY, values); } catch (final Exception ex) { log.info("DisposalRepository:", ex); throw new RuntimeException("exceptions occured while persisting the disposal : " + ex.getMessage()); } }
DisposalRepository { public void create(final DisposalRequest disposalRequest) { final RequestInfo requestInfo = disposalRequest.getRequestInfo(); final Disposal disposal = disposalRequest.getDisposal(); final List<Document> documents = disposal.getDocuments(); if (documents != null) { final String sql = "INSERT INTO egasset_document (id,asset,filestore,tenantid,documenttype) values " + "(nextval('seq_egasset_document'),?,?,?,?);"; log.info("the insert query for assets docs : " + sql); final List<Object[]> documentBatchArgs = new ArrayList<>(); for (final Document document : documents) { final Object[] documentRecord = { disposal.getAssetId(), document.getFileStore(), disposal.getTenantId(),document.getDocumentType() }; documentBatchArgs.add(documentRecord); } try { jdbcTemplate.batchUpdate(sql, documentBatchArgs); } catch (final DataAccessException ex) { log.info("exception saving Sale/Disposal document details" + ex); throw new RuntimeException("exception saving Sale/Disposal document details"); } } final Object[] values = { disposal.getId(), disposal.getTenantId(), disposal.getAssetId(), disposal.getBuyerName(), disposal.getBuyerAddress(), disposal.getDisposalReason(), disposal.getDisposalDate(), disposal.getPanCardNumber(), disposal.getAadharCardNumber(), disposal.getAssetCurrentValue(), disposal.getSaleValue(), disposal.getTransactionType().toString(), disposal.getAssetSaleAccount(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), disposal.getProfitLossVoucherReference() }; try { jdbcTemplate.update(DisposalQueryBuilder.INSERT_QUERY, values); } catch (final Exception ex) { log.info("DisposalRepository:", ex); throw new RuntimeException("exceptions occured while persisting the disposal : " + ex.getMessage()); } } }
DisposalRepository { public void create(final DisposalRequest disposalRequest) { final RequestInfo requestInfo = disposalRequest.getRequestInfo(); final Disposal disposal = disposalRequest.getDisposal(); final List<Document> documents = disposal.getDocuments(); if (documents != null) { final String sql = "INSERT INTO egasset_document (id,asset,filestore,tenantid,documenttype) values " + "(nextval('seq_egasset_document'),?,?,?,?);"; log.info("the insert query for assets docs : " + sql); final List<Object[]> documentBatchArgs = new ArrayList<>(); for (final Document document : documents) { final Object[] documentRecord = { disposal.getAssetId(), document.getFileStore(), disposal.getTenantId(),document.getDocumentType() }; documentBatchArgs.add(documentRecord); } try { jdbcTemplate.batchUpdate(sql, documentBatchArgs); } catch (final DataAccessException ex) { log.info("exception saving Sale/Disposal document details" + ex); throw new RuntimeException("exception saving Sale/Disposal document details"); } } final Object[] values = { disposal.getId(), disposal.getTenantId(), disposal.getAssetId(), disposal.getBuyerName(), disposal.getBuyerAddress(), disposal.getDisposalReason(), disposal.getDisposalDate(), disposal.getPanCardNumber(), disposal.getAadharCardNumber(), disposal.getAssetCurrentValue(), disposal.getSaleValue(), disposal.getTransactionType().toString(), disposal.getAssetSaleAccount(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), disposal.getProfitLossVoucherReference() }; try { jdbcTemplate.update(DisposalQueryBuilder.INSERT_QUERY, values); } catch (final Exception ex) { log.info("DisposalRepository:", ex); throw new RuntimeException("exceptions occured while persisting the disposal : " + ex.getMessage()); } }  }
DisposalRepository { public void create(final DisposalRequest disposalRequest) { final RequestInfo requestInfo = disposalRequest.getRequestInfo(); final Disposal disposal = disposalRequest.getDisposal(); final List<Document> documents = disposal.getDocuments(); if (documents != null) { final String sql = "INSERT INTO egasset_document (id,asset,filestore,tenantid,documenttype) values " + "(nextval('seq_egasset_document'),?,?,?,?);"; log.info("the insert query for assets docs : " + sql); final List<Object[]> documentBatchArgs = new ArrayList<>(); for (final Document document : documents) { final Object[] documentRecord = { disposal.getAssetId(), document.getFileStore(), disposal.getTenantId(),document.getDocumentType() }; documentBatchArgs.add(documentRecord); } try { jdbcTemplate.batchUpdate(sql, documentBatchArgs); } catch (final DataAccessException ex) { log.info("exception saving Sale/Disposal document details" + ex); throw new RuntimeException("exception saving Sale/Disposal document details"); } } final Object[] values = { disposal.getId(), disposal.getTenantId(), disposal.getAssetId(), disposal.getBuyerName(), disposal.getBuyerAddress(), disposal.getDisposalReason(), disposal.getDisposalDate(), disposal.getPanCardNumber(), disposal.getAadharCardNumber(), disposal.getAssetCurrentValue(), disposal.getSaleValue(), disposal.getTransactionType().toString(), disposal.getAssetSaleAccount(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), disposal.getProfitLossVoucherReference() }; try { jdbcTemplate.update(DisposalQueryBuilder.INSERT_QUERY, values); } catch (final Exception ex) { log.info("DisposalRepository:", ex); throw new RuntimeException("exceptions occured while persisting the disposal : " + ex.getMessage()); } }  List<Disposal> search(final DisposalCriteria disposalCriteria); void create(final DisposalRequest disposalRequest); }
DisposalRepository { public void create(final DisposalRequest disposalRequest) { final RequestInfo requestInfo = disposalRequest.getRequestInfo(); final Disposal disposal = disposalRequest.getDisposal(); final List<Document> documents = disposal.getDocuments(); if (documents != null) { final String sql = "INSERT INTO egasset_document (id,asset,filestore,tenantid,documenttype) values " + "(nextval('seq_egasset_document'),?,?,?,?);"; log.info("the insert query for assets docs : " + sql); final List<Object[]> documentBatchArgs = new ArrayList<>(); for (final Document document : documents) { final Object[] documentRecord = { disposal.getAssetId(), document.getFileStore(), disposal.getTenantId(),document.getDocumentType() }; documentBatchArgs.add(documentRecord); } try { jdbcTemplate.batchUpdate(sql, documentBatchArgs); } catch (final DataAccessException ex) { log.info("exception saving Sale/Disposal document details" + ex); throw new RuntimeException("exception saving Sale/Disposal document details"); } } final Object[] values = { disposal.getId(), disposal.getTenantId(), disposal.getAssetId(), disposal.getBuyerName(), disposal.getBuyerAddress(), disposal.getDisposalReason(), disposal.getDisposalDate(), disposal.getPanCardNumber(), disposal.getAadharCardNumber(), disposal.getAssetCurrentValue(), disposal.getSaleValue(), disposal.getTransactionType().toString(), disposal.getAssetSaleAccount(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), requestInfo.getUserInfo().getId(), System.currentTimeMillis(), disposal.getProfitLossVoucherReference() }; try { jdbcTemplate.update(DisposalQueryBuilder.INSERT_QUERY, values); } catch (final Exception ex) { log.info("DisposalRepository:", ex); throw new RuntimeException("exceptions occured while persisting the disposal : " + ex.getMessage()); } }  List<Disposal> search(final DisposalCriteria disposalCriteria); void create(final DisposalRequest disposalRequest);  }