@Test public void test_Should_Update_ApplicationTypeDocumentType() { final DocumentTypeApplicationTypeReq documentTypeApplicationTypeReq = new DocumentTypeApplicationTypeReq(); final RequestInfo requestInfo = new RequestInfo(); final User user = new User(); user.setId(1l); requestInfo.setUserInfo(user); documentTypeApplicationTypeReq.setRequestInfo(requestInfo); final List<DocumentTypeApplicationType> documentTypeApplicationTypeList = new ArrayList<>(); final DocumentTypeApplicationType documentApplication = getDocumentTypeApplicationType(); documentTypeApplicationTypeList.add(documentApplication); when(jdbcTemplate.update(any(String.class), any(Object[].class))).thenReturn(1); assertTrue(documentTypeApplicationTypeReq .equals(docTypeAppTypeRepository.update(documentTypeApplicationTypeReq))); }
public DocumentTypeApplicationTypeReq update( final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest) { log.info("DocumentTypeApplicationTypeRequest::" + docTypeAppliTypeRequest); final String documentTypeApplicationTypeUpdate = DocumentTypeApplicationTypeQueryBuilder .updateDocumentTypeApplicationTypeQuery(); final List<DocumentTypeApplicationType> docApplicationList = docTypeAppliTypeRequest.getDocumentTypeApplicationTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(docApplicationList.size()); for (final DocumentTypeApplicationType docApplication : docApplicationList) { final String documentQuery = DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(); Long documentId = 0L; try { documentId = jdbcTemplate.queryForObject(documentQuery, new Object[] { docApplication.getDocumentType(), docApplication.getTenantId() }, Long.class); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty result set"); } if (documentId == null) log.info("Invalid input."); batchValues.add(new MapSqlParameterSource("applicationtype", docApplication.getApplicationType()) .addValue("documenttypeid", documentId) .addValue("mandatory", docApplication.getMandatory()).addValue("active", docApplication.getActive()) .addValue("lastmodifiedby", Long.valueOf(docTypeAppliTypeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", docApplication.getCode()).addValue("tenantid", docApplication.getTenantId()) .getValues()); } namedParameterJdbcTemplate.batchUpdate(documentTypeApplicationTypeUpdate, batchValues.toArray(new Map[docApplicationList.size()])); return docTypeAppliTypeRequest; }
DocumentTypeApplicationTypeRepository { public DocumentTypeApplicationTypeReq update( final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest) { log.info("DocumentTypeApplicationTypeRequest::" + docTypeAppliTypeRequest); final String documentTypeApplicationTypeUpdate = DocumentTypeApplicationTypeQueryBuilder .updateDocumentTypeApplicationTypeQuery(); final List<DocumentTypeApplicationType> docApplicationList = docTypeAppliTypeRequest.getDocumentTypeApplicationTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(docApplicationList.size()); for (final DocumentTypeApplicationType docApplication : docApplicationList) { final String documentQuery = DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(); Long documentId = 0L; try { documentId = jdbcTemplate.queryForObject(documentQuery, new Object[] { docApplication.getDocumentType(), docApplication.getTenantId() }, Long.class); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty result set"); } if (documentId == null) log.info("Invalid input."); batchValues.add(new MapSqlParameterSource("applicationtype", docApplication.getApplicationType()) .addValue("documenttypeid", documentId) .addValue("mandatory", docApplication.getMandatory()).addValue("active", docApplication.getActive()) .addValue("lastmodifiedby", Long.valueOf(docTypeAppliTypeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", docApplication.getCode()).addValue("tenantid", docApplication.getTenantId()) .getValues()); } namedParameterJdbcTemplate.batchUpdate(documentTypeApplicationTypeUpdate, batchValues.toArray(new Map[docApplicationList.size()])); return docTypeAppliTypeRequest; } }
DocumentTypeApplicationTypeRepository { public DocumentTypeApplicationTypeReq update( final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest) { log.info("DocumentTypeApplicationTypeRequest::" + docTypeAppliTypeRequest); final String documentTypeApplicationTypeUpdate = DocumentTypeApplicationTypeQueryBuilder .updateDocumentTypeApplicationTypeQuery(); final List<DocumentTypeApplicationType> docApplicationList = docTypeAppliTypeRequest.getDocumentTypeApplicationTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(docApplicationList.size()); for (final DocumentTypeApplicationType docApplication : docApplicationList) { final String documentQuery = DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(); Long documentId = 0L; try { documentId = jdbcTemplate.queryForObject(documentQuery, new Object[] { docApplication.getDocumentType(), docApplication.getTenantId() }, Long.class); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty result set"); } if (documentId == null) log.info("Invalid input."); batchValues.add(new MapSqlParameterSource("applicationtype", docApplication.getApplicationType()) .addValue("documenttypeid", documentId) .addValue("mandatory", docApplication.getMandatory()).addValue("active", docApplication.getActive()) .addValue("lastmodifiedby", Long.valueOf(docTypeAppliTypeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", docApplication.getCode()).addValue("tenantid", docApplication.getTenantId()) .getValues()); } namedParameterJdbcTemplate.batchUpdate(documentTypeApplicationTypeUpdate, batchValues.toArray(new Map[docApplicationList.size()])); return docTypeAppliTypeRequest; }  }
DocumentTypeApplicationTypeRepository { public DocumentTypeApplicationTypeReq update( final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest) { log.info("DocumentTypeApplicationTypeRequest::" + docTypeAppliTypeRequest); final String documentTypeApplicationTypeUpdate = DocumentTypeApplicationTypeQueryBuilder .updateDocumentTypeApplicationTypeQuery(); final List<DocumentTypeApplicationType> docApplicationList = docTypeAppliTypeRequest.getDocumentTypeApplicationTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(docApplicationList.size()); for (final DocumentTypeApplicationType docApplication : docApplicationList) { final String documentQuery = DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(); Long documentId = 0L; try { documentId = jdbcTemplate.queryForObject(documentQuery, new Object[] { docApplication.getDocumentType(), docApplication.getTenantId() }, Long.class); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty result set"); } if (documentId == null) log.info("Invalid input."); batchValues.add(new MapSqlParameterSource("applicationtype", docApplication.getApplicationType()) .addValue("documenttypeid", documentId) .addValue("mandatory", docApplication.getMandatory()).addValue("active", docApplication.getActive()) .addValue("lastmodifiedby", Long.valueOf(docTypeAppliTypeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", docApplication.getCode()).addValue("tenantid", docApplication.getTenantId()) .getValues()); } namedParameterJdbcTemplate.batchUpdate(documentTypeApplicationTypeUpdate, batchValues.toArray(new Map[docApplicationList.size()])); return docTypeAppliTypeRequest; }  DocumentTypeApplicationTypeReq create(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); DocumentTypeApplicationTypeReq update(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); List<DocumentTypeApplicationType> findForCriteria(
            final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest); boolean checkDocumentTypeApplicationTypeExist(final String code, final String applicationType,
            final String documentType, final String tenantId); boolean checkDocumentTypeExists(final String documentType, final String tenantId); }
DocumentTypeApplicationTypeRepository { public DocumentTypeApplicationTypeReq update( final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest) { log.info("DocumentTypeApplicationTypeRequest::" + docTypeAppliTypeRequest); final String documentTypeApplicationTypeUpdate = DocumentTypeApplicationTypeQueryBuilder .updateDocumentTypeApplicationTypeQuery(); final List<DocumentTypeApplicationType> docApplicationList = docTypeAppliTypeRequest.getDocumentTypeApplicationTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(docApplicationList.size()); for (final DocumentTypeApplicationType docApplication : docApplicationList) { final String documentQuery = DocumentTypeApplicationTypeQueryBuilder.getDocumentTypeIdQuery(); Long documentId = 0L; try { documentId = jdbcTemplate.queryForObject(documentQuery, new Object[] { docApplication.getDocumentType(), docApplication.getTenantId() }, Long.class); } catch (final EmptyResultDataAccessException e) { log.info("EmptyResultDataAccessException: Query returned empty result set"); } if (documentId == null) log.info("Invalid input."); batchValues.add(new MapSqlParameterSource("applicationtype", docApplication.getApplicationType()) .addValue("documenttypeid", documentId) .addValue("mandatory", docApplication.getMandatory()).addValue("active", docApplication.getActive()) .addValue("lastmodifiedby", Long.valueOf(docTypeAppliTypeRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", docApplication.getCode()).addValue("tenantid", docApplication.getTenantId()) .getValues()); } namedParameterJdbcTemplate.batchUpdate(documentTypeApplicationTypeUpdate, batchValues.toArray(new Map[docApplicationList.size()])); return docTypeAppliTypeRequest; }  DocumentTypeApplicationTypeReq create(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); DocumentTypeApplicationTypeReq update(
            final DocumentTypeApplicationTypeReq docTypeAppliTypeRequest); List<DocumentTypeApplicationType> findForCriteria(
            final DocumentTypeApplicationTypeGetRequest docTypeAppliTypeGetRequest); boolean checkDocumentTypeApplicationTypeExist(final String code, final String applicationType,
            final String documentType, final String tenantId); boolean checkDocumentTypeExists(final String documentType, final String tenantId);  }