@Test public void test_Should_Create_StorageReservoir() { final StorageReservoirRequest storageReservoirRequest = new StorageReservoirRequest(); final RequestInfo requestInfo = new RequestInfo(); final User user = new User(); user.setId(1l); requestInfo.setUserInfo(user); storageReservoirRequest.setRequestInfo(requestInfo); final List<StorageReservoir> storageReservoirList = new ArrayList<>(); final StorageReservoir storageReservoir = getStorageReservoir(); storageReservoirList.add(storageReservoir); storageReservoirRequest.setStorageReservoirs(storageReservoirList); final StorageReservoirRequest storageReserviorReq = storageReservoirRepository .create(storageReservoirRequest); assertThat(storageReserviorReq.getStorageReservoirs().size()).isEqualTo(1); }
public StorageReservoirRequest create( final StorageReservoirRequest storageReservoirRequest) { log.info("storageReservoirRequest::" + storageReservoirRequest); final String storageReservoirInsert = StorageReservoirQueryBuilder.insertStorageReserviorQuery(); final List<Map<String, Object>> batchValues = new ArrayList<>(storageReservoirRequest.getStorageReservoirs().size()); for (final StorageReservoir storageReservoir : storageReservoirRequest.getStorageReservoirs()) batchValues.add(new MapSqlParameterSource("id", Long.valueOf(storageReservoir.getCode())) .addValue("code", storageReservoir.getCode()).addValue("name", storageReservoir.getName()) .addValue("reservoirtype", storageReservoir.getReservoirType()) .addValue("location", storageReservoir.getLocation()) .addValue("capacity", storageReservoir.getCapacity()) .addValue("noofsublines", storageReservoir.getNoOfSubLines()) .addValue("noofmaindistributionlines", storageReservoir.getNoOfMainDistributionLines()) .addValue("noofconnection", storageReservoir.getNoOfConnection()) .addValue("createdby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("tenantid", storageReservoir.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(storageReservoirInsert, batchValues.toArray(new Map[storageReservoirRequest.getStorageReservoirs().size()])); return storageReservoirRequest; }
StorageReservoirRepository { public StorageReservoirRequest create( final StorageReservoirRequest storageReservoirRequest) { log.info("storageReservoirRequest::" + storageReservoirRequest); final String storageReservoirInsert = StorageReservoirQueryBuilder.insertStorageReserviorQuery(); final List<Map<String, Object>> batchValues = new ArrayList<>(storageReservoirRequest.getStorageReservoirs().size()); for (final StorageReservoir storageReservoir : storageReservoirRequest.getStorageReservoirs()) batchValues.add(new MapSqlParameterSource("id", Long.valueOf(storageReservoir.getCode())) .addValue("code", storageReservoir.getCode()).addValue("name", storageReservoir.getName()) .addValue("reservoirtype", storageReservoir.getReservoirType()) .addValue("location", storageReservoir.getLocation()) .addValue("capacity", storageReservoir.getCapacity()) .addValue("noofsublines", storageReservoir.getNoOfSubLines()) .addValue("noofmaindistributionlines", storageReservoir.getNoOfMainDistributionLines()) .addValue("noofconnection", storageReservoir.getNoOfConnection()) .addValue("createdby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("tenantid", storageReservoir.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(storageReservoirInsert, batchValues.toArray(new Map[storageReservoirRequest.getStorageReservoirs().size()])); return storageReservoirRequest; } }
StorageReservoirRepository { public StorageReservoirRequest create( final StorageReservoirRequest storageReservoirRequest) { log.info("storageReservoirRequest::" + storageReservoirRequest); final String storageReservoirInsert = StorageReservoirQueryBuilder.insertStorageReserviorQuery(); final List<Map<String, Object>> batchValues = new ArrayList<>(storageReservoirRequest.getStorageReservoirs().size()); for (final StorageReservoir storageReservoir : storageReservoirRequest.getStorageReservoirs()) batchValues.add(new MapSqlParameterSource("id", Long.valueOf(storageReservoir.getCode())) .addValue("code", storageReservoir.getCode()).addValue("name", storageReservoir.getName()) .addValue("reservoirtype", storageReservoir.getReservoirType()) .addValue("location", storageReservoir.getLocation()) .addValue("capacity", storageReservoir.getCapacity()) .addValue("noofsublines", storageReservoir.getNoOfSubLines()) .addValue("noofmaindistributionlines", storageReservoir.getNoOfMainDistributionLines()) .addValue("noofconnection", storageReservoir.getNoOfConnection()) .addValue("createdby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("tenantid", storageReservoir.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(storageReservoirInsert, batchValues.toArray(new Map[storageReservoirRequest.getStorageReservoirs().size()])); return storageReservoirRequest; }  }
StorageReservoirRepository { public StorageReservoirRequest create( final StorageReservoirRequest storageReservoirRequest) { log.info("storageReservoirRequest::" + storageReservoirRequest); final String storageReservoirInsert = StorageReservoirQueryBuilder.insertStorageReserviorQuery(); final List<Map<String, Object>> batchValues = new ArrayList<>(storageReservoirRequest.getStorageReservoirs().size()); for (final StorageReservoir storageReservoir : storageReservoirRequest.getStorageReservoirs()) batchValues.add(new MapSqlParameterSource("id", Long.valueOf(storageReservoir.getCode())) .addValue("code", storageReservoir.getCode()).addValue("name", storageReservoir.getName()) .addValue("reservoirtype", storageReservoir.getReservoirType()) .addValue("location", storageReservoir.getLocation()) .addValue("capacity", storageReservoir.getCapacity()) .addValue("noofsublines", storageReservoir.getNoOfSubLines()) .addValue("noofmaindistributionlines", storageReservoir.getNoOfMainDistributionLines()) .addValue("noofconnection", storageReservoir.getNoOfConnection()) .addValue("createdby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("tenantid", storageReservoir.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(storageReservoirInsert, batchValues.toArray(new Map[storageReservoirRequest.getStorageReservoirs().size()])); return storageReservoirRequest; }  StorageReservoirRequest create(
            final StorageReservoirRequest storageReservoirRequest); StorageReservoirRequest update(
            final StorageReservoirRequest storageReservoirRequest); List<StorageReservoir> findForCriteria(final StorageReservoirGetRequest storageReservoirGetRequest); boolean checkStorageReservoirByNameAndCode(final String code, final String name, final String tenantId); }
StorageReservoirRepository { public StorageReservoirRequest create( final StorageReservoirRequest storageReservoirRequest) { log.info("storageReservoirRequest::" + storageReservoirRequest); final String storageReservoirInsert = StorageReservoirQueryBuilder.insertStorageReserviorQuery(); final List<Map<String, Object>> batchValues = new ArrayList<>(storageReservoirRequest.getStorageReservoirs().size()); for (final StorageReservoir storageReservoir : storageReservoirRequest.getStorageReservoirs()) batchValues.add(new MapSqlParameterSource("id", Long.valueOf(storageReservoir.getCode())) .addValue("code", storageReservoir.getCode()).addValue("name", storageReservoir.getName()) .addValue("reservoirtype", storageReservoir.getReservoirType()) .addValue("location", storageReservoir.getLocation()) .addValue("capacity", storageReservoir.getCapacity()) .addValue("noofsublines", storageReservoir.getNoOfSubLines()) .addValue("noofmaindistributionlines", storageReservoir.getNoOfMainDistributionLines()) .addValue("noofconnection", storageReservoir.getNoOfConnection()) .addValue("createdby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(storageReservoirRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("tenantid", storageReservoir.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(storageReservoirInsert, batchValues.toArray(new Map[storageReservoirRequest.getStorageReservoirs().size()])); return storageReservoirRequest; }  StorageReservoirRequest create(
            final StorageReservoirRequest storageReservoirRequest); StorageReservoirRequest update(
            final StorageReservoirRequest storageReservoirRequest); List<StorageReservoir> findForCriteria(final StorageReservoirGetRequest storageReservoirGetRequest); boolean checkStorageReservoirByNameAndCode(final String code, final String name, final String tenantId);  }