@Test(expected = Exception.class) public void test_throwException_Modify_PipeSize() throws Exception { final PipeSizeRequest pipeSizeRequest = new PipeSizeRequest(); final RequestInfo requestInfo = new RequestInfo(); final List<PipeSize> pipeSizeList = new ArrayList<>(); pipeSizeList.add(getPipeSize()); pipeSizeRequest.setRequestInfo(requestInfo); pipeSizeRequest.setPipeSizes(pipeSizeList); assertNotNull(pipeSizeRepository.update(pipeSizeRequest)); }
public PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest) { log.info("PipeSizeRequest::" + pipeSizeRequest); final String pipeSizeUpdate = PipeSizeQueryBuilder.updatePipeSizeQuery(); final List<PipeSize> pipeSizeList = pipeSizeRequest.getPipeSizes(); final List<Map<String, Object>> batchValues = new ArrayList<>(pipeSizeList.size()); for (final PipeSize pipeSize : pipeSizeList) batchValues.add( new MapSqlParameterSource("sizeinmilimeter", pipeSize.getSizeInMilimeter()) .addValue("sizeininch", pipeSize.getSizeInInch()) .addValue("description", pipeSize.getDescription()).addValue("active", pipeSize.getActive()) .addValue("lastmodifiedby", Long.valueOf(pipeSizeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", pipeSize.getCode()) .addValue("tenantid", pipeSize.getTenantId()) .getValues()); namedParameterJdbcTemplate.batchUpdate(pipeSizeUpdate, batchValues.toArray(new Map[pipeSizeList.size()])); return pipeSizeRequest; }
PipeSizeRepository { public PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest) { log.info("PipeSizeRequest::" + pipeSizeRequest); final String pipeSizeUpdate = PipeSizeQueryBuilder.updatePipeSizeQuery(); final List<PipeSize> pipeSizeList = pipeSizeRequest.getPipeSizes(); final List<Map<String, Object>> batchValues = new ArrayList<>(pipeSizeList.size()); for (final PipeSize pipeSize : pipeSizeList) batchValues.add( new MapSqlParameterSource("sizeinmilimeter", pipeSize.getSizeInMilimeter()) .addValue("sizeininch", pipeSize.getSizeInInch()) .addValue("description", pipeSize.getDescription()).addValue("active", pipeSize.getActive()) .addValue("lastmodifiedby", Long.valueOf(pipeSizeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", pipeSize.getCode()) .addValue("tenantid", pipeSize.getTenantId()) .getValues()); namedParameterJdbcTemplate.batchUpdate(pipeSizeUpdate, batchValues.toArray(new Map[pipeSizeList.size()])); return pipeSizeRequest; } }
PipeSizeRepository { public PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest) { log.info("PipeSizeRequest::" + pipeSizeRequest); final String pipeSizeUpdate = PipeSizeQueryBuilder.updatePipeSizeQuery(); final List<PipeSize> pipeSizeList = pipeSizeRequest.getPipeSizes(); final List<Map<String, Object>> batchValues = new ArrayList<>(pipeSizeList.size()); for (final PipeSize pipeSize : pipeSizeList) batchValues.add( new MapSqlParameterSource("sizeinmilimeter", pipeSize.getSizeInMilimeter()) .addValue("sizeininch", pipeSize.getSizeInInch()) .addValue("description", pipeSize.getDescription()).addValue("active", pipeSize.getActive()) .addValue("lastmodifiedby", Long.valueOf(pipeSizeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", pipeSize.getCode()) .addValue("tenantid", pipeSize.getTenantId()) .getValues()); namedParameterJdbcTemplate.batchUpdate(pipeSizeUpdate, batchValues.toArray(new Map[pipeSizeList.size()])); return pipeSizeRequest; }  }
PipeSizeRepository { public PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest) { log.info("PipeSizeRequest::" + pipeSizeRequest); final String pipeSizeUpdate = PipeSizeQueryBuilder.updatePipeSizeQuery(); final List<PipeSize> pipeSizeList = pipeSizeRequest.getPipeSizes(); final List<Map<String, Object>> batchValues = new ArrayList<>(pipeSizeList.size()); for (final PipeSize pipeSize : pipeSizeList) batchValues.add( new MapSqlParameterSource("sizeinmilimeter", pipeSize.getSizeInMilimeter()) .addValue("sizeininch", pipeSize.getSizeInInch()) .addValue("description", pipeSize.getDescription()).addValue("active", pipeSize.getActive()) .addValue("lastmodifiedby", Long.valueOf(pipeSizeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", pipeSize.getCode()) .addValue("tenantid", pipeSize.getTenantId()) .getValues()); namedParameterJdbcTemplate.batchUpdate(pipeSizeUpdate, batchValues.toArray(new Map[pipeSizeList.size()])); return pipeSizeRequest; }  PipeSizeRequest create(final PipeSizeRequest pipeSizeRequest); PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest); boolean checkPipeSizeInmmAndCode(final String code, final Double sizeInMilimeter, final String tenantId); List<PipeSize> findForCriteria(final PipeSizeGetRequest pipeSizeGetRequest); }
PipeSizeRepository { public PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest) { log.info("PipeSizeRequest::" + pipeSizeRequest); final String pipeSizeUpdate = PipeSizeQueryBuilder.updatePipeSizeQuery(); final List<PipeSize> pipeSizeList = pipeSizeRequest.getPipeSizes(); final List<Map<String, Object>> batchValues = new ArrayList<>(pipeSizeList.size()); for (final PipeSize pipeSize : pipeSizeList) batchValues.add( new MapSqlParameterSource("sizeinmilimeter", pipeSize.getSizeInMilimeter()) .addValue("sizeininch", pipeSize.getSizeInInch()) .addValue("description", pipeSize.getDescription()).addValue("active", pipeSize.getActive()) .addValue("lastmodifiedby", Long.valueOf(pipeSizeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", pipeSize.getCode()) .addValue("tenantid", pipeSize.getTenantId()) .getValues()); namedParameterJdbcTemplate.batchUpdate(pipeSizeUpdate, batchValues.toArray(new Map[pipeSizeList.size()])); return pipeSizeRequest; }  PipeSizeRequest create(final PipeSizeRequest pipeSizeRequest); PipeSizeRequest update(final PipeSizeRequest pipeSizeRequest); boolean checkPipeSizeInmmAndCode(final String code, final Double sizeInMilimeter, final String tenantId); List<PipeSize> findForCriteria(final PipeSizeGetRequest pipeSizeGetRequest);  }