@Test public void test_Should_Update_Gapcode() { final GapcodeRequest gapcodeRequest = new GapcodeRequest(); final RequestInfo requestInfo = new RequestInfo(); final User user = new User(); user.setId(1l); requestInfo.setUserInfo(user); gapcodeRequest.setRequestInfo(requestInfo); final List<Gapcode> gapcodeList = new ArrayList<>(); final Gapcode gapcode = getCategory(); gapcodeList.add(gapcode); when(jdbcTemplate.update(any(String.class), any(Object[].class))) .thenReturn(1); assertTrue(gapcodeRequest.equals(gapcodeRepository .update(gapcodeRequest))); }
public GapcodeRequest update(final GapcodeRequest gapcodeRequest) { try { log.info("GapcodeRequest::" + gapcodeRequest); final String updateGapcode = GapcodeQueryBuilder.updateQuery(); final List<Gapcode> gapcodeList = gapcodeRequest.getGapcode(); final List<Map<String, Object>> batchValues = new ArrayList<>( gapcodeList.size()); for (final Gapcode gapcode : gapcodeList) batchValues.add(new MapSqlParameterSource("name", gapcode .getName()) .addValue("outSideUlb", gapcode.getOutSideUlb()) .addValue("noOfLastMonths", gapcode.getNoOfMonths()) .addValue("logic", gapcode.getLogic()) .addValue("description", gapcode.getDescription()) .addValue("active", gapcode.getActive()) .addValue( "lastUpdatedBy", Long.valueOf(gapcodeRequest.getRequestInfo() .getUserInfo().getId())) .addValue("lastUpdatedDate", new Date().getTime()) .addValue("code", gapcode.getCode()).getValues()); namedParameterJdbcTemplate.batchUpdate(updateGapcode, batchValues.toArray(new Map[gapcodeList.size()])); } catch (final Exception exception) { log.error("Exception Encountered : " + exception); } return gapcodeRequest; }
GapcodeRepository { public GapcodeRequest update(final GapcodeRequest gapcodeRequest) { try { log.info("GapcodeRequest::" + gapcodeRequest); final String updateGapcode = GapcodeQueryBuilder.updateQuery(); final List<Gapcode> gapcodeList = gapcodeRequest.getGapcode(); final List<Map<String, Object>> batchValues = new ArrayList<>( gapcodeList.size()); for (final Gapcode gapcode : gapcodeList) batchValues.add(new MapSqlParameterSource("name", gapcode .getName()) .addValue("outSideUlb", gapcode.getOutSideUlb()) .addValue("noOfLastMonths", gapcode.getNoOfMonths()) .addValue("logic", gapcode.getLogic()) .addValue("description", gapcode.getDescription()) .addValue("active", gapcode.getActive()) .addValue( "lastUpdatedBy", Long.valueOf(gapcodeRequest.getRequestInfo() .getUserInfo().getId())) .addValue("lastUpdatedDate", new Date().getTime()) .addValue("code", gapcode.getCode()).getValues()); namedParameterJdbcTemplate.batchUpdate(updateGapcode, batchValues.toArray(new Map[gapcodeList.size()])); } catch (final Exception exception) { log.error("Exception Encountered : " + exception); } return gapcodeRequest; } }
GapcodeRepository { public GapcodeRequest update(final GapcodeRequest gapcodeRequest) { try { log.info("GapcodeRequest::" + gapcodeRequest); final String updateGapcode = GapcodeQueryBuilder.updateQuery(); final List<Gapcode> gapcodeList = gapcodeRequest.getGapcode(); final List<Map<String, Object>> batchValues = new ArrayList<>( gapcodeList.size()); for (final Gapcode gapcode : gapcodeList) batchValues.add(new MapSqlParameterSource("name", gapcode .getName()) .addValue("outSideUlb", gapcode.getOutSideUlb()) .addValue("noOfLastMonths", gapcode.getNoOfMonths()) .addValue("logic", gapcode.getLogic()) .addValue("description", gapcode.getDescription()) .addValue("active", gapcode.getActive()) .addValue( "lastUpdatedBy", Long.valueOf(gapcodeRequest.getRequestInfo() .getUserInfo().getId())) .addValue("lastUpdatedDate", new Date().getTime()) .addValue("code", gapcode.getCode()).getValues()); namedParameterJdbcTemplate.batchUpdate(updateGapcode, batchValues.toArray(new Map[gapcodeList.size()])); } catch (final Exception exception) { log.error("Exception Encountered : " + exception); } return gapcodeRequest; }  }
GapcodeRepository { public GapcodeRequest update(final GapcodeRequest gapcodeRequest) { try { log.info("GapcodeRequest::" + gapcodeRequest); final String updateGapcode = GapcodeQueryBuilder.updateQuery(); final List<Gapcode> gapcodeList = gapcodeRequest.getGapcode(); final List<Map<String, Object>> batchValues = new ArrayList<>( gapcodeList.size()); for (final Gapcode gapcode : gapcodeList) batchValues.add(new MapSqlParameterSource("name", gapcode .getName()) .addValue("outSideUlb", gapcode.getOutSideUlb()) .addValue("noOfLastMonths", gapcode.getNoOfMonths()) .addValue("logic", gapcode.getLogic()) .addValue("description", gapcode.getDescription()) .addValue("active", gapcode.getActive()) .addValue( "lastUpdatedBy", Long.valueOf(gapcodeRequest.getRequestInfo() .getUserInfo().getId())) .addValue("lastUpdatedDate", new Date().getTime()) .addValue("code", gapcode.getCode()).getValues()); namedParameterJdbcTemplate.batchUpdate(updateGapcode, batchValues.toArray(new Map[gapcodeList.size()])); } catch (final Exception exception) { log.error("Exception Encountered : " + exception); } return gapcodeRequest; }  GapcodeRequest create(final GapcodeRequest gapcodeRequest); GapcodeRequest update(final GapcodeRequest gapcodeRequest); List<Gapcode> findForCriteria(
            final GapcodeGetRequest gapcodeGetRequest); List<CommonDataModel> getFormulaQuery(); }
GapcodeRepository { public GapcodeRequest update(final GapcodeRequest gapcodeRequest) { try { log.info("GapcodeRequest::" + gapcodeRequest); final String updateGapcode = GapcodeQueryBuilder.updateQuery(); final List<Gapcode> gapcodeList = gapcodeRequest.getGapcode(); final List<Map<String, Object>> batchValues = new ArrayList<>( gapcodeList.size()); for (final Gapcode gapcode : gapcodeList) batchValues.add(new MapSqlParameterSource("name", gapcode .getName()) .addValue("outSideUlb", gapcode.getOutSideUlb()) .addValue("noOfLastMonths", gapcode.getNoOfMonths()) .addValue("logic", gapcode.getLogic()) .addValue("description", gapcode.getDescription()) .addValue("active", gapcode.getActive()) .addValue( "lastUpdatedBy", Long.valueOf(gapcodeRequest.getRequestInfo() .getUserInfo().getId())) .addValue("lastUpdatedDate", new Date().getTime()) .addValue("code", gapcode.getCode()).getValues()); namedParameterJdbcTemplate.batchUpdate(updateGapcode, batchValues.toArray(new Map[gapcodeList.size()])); } catch (final Exception exception) { log.error("Exception Encountered : " + exception); } return gapcodeRequest; }  GapcodeRequest create(final GapcodeRequest gapcodeRequest); GapcodeRequest update(final GapcodeRequest gapcodeRequest); List<Gapcode> findForCriteria(
            final GapcodeGetRequest gapcodeGetRequest); List<CommonDataModel> getFormulaQuery();  }