@Test public void test_Should_Modify_DocumentType() throws Exception { final DocumentTypeReq docTypeRequest = new DocumentTypeReq(); final RequestInfo requestInfo = new RequestInfo(); final User user = new User(); user.setId(1L); requestInfo.setUserInfo(user); final List<DocumentType> docTypeList = new ArrayList<>(); docTypeList.add(getDocumentType()); docTypeRequest.setRequestInfo(requestInfo); docTypeRequest.setDocumentTypes(docTypeList); assertNotNull(docTypeRepository.update(docTypeRequest)); }
public DocumentTypeReq update(final DocumentTypeReq documentTypeReq) { log.info("DocumentTypeRequest::" + documentTypeReq); final String documentTypeUpdate = DocumentTypeQueryBuilder.updateDocumentTypeQuery(); final List<DocumentType> documentTypeList = documentTypeReq.getDocumentTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(documentTypeList.size()); for (final DocumentType documentType : documentTypeList) batchValues.add(new MapSqlParameterSource("name", documentType.getName()) .addValue("description", documentType.getDescription()) .addValue("active", documentType.getActive()) .addValue("lastmodifiedby", Long.valueOf(documentTypeReq.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", documentType.getCode()) .addValue("tenantid", documentType.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(documentTypeUpdate, batchValues.toArray(new Map[documentTypeList.size()])); return documentTypeReq; }
DocumentTypeRepository { public DocumentTypeReq update(final DocumentTypeReq documentTypeReq) { log.info("DocumentTypeRequest::" + documentTypeReq); final String documentTypeUpdate = DocumentTypeQueryBuilder.updateDocumentTypeQuery(); final List<DocumentType> documentTypeList = documentTypeReq.getDocumentTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(documentTypeList.size()); for (final DocumentType documentType : documentTypeList) batchValues.add(new MapSqlParameterSource("name", documentType.getName()) .addValue("description", documentType.getDescription()) .addValue("active", documentType.getActive()) .addValue("lastmodifiedby", Long.valueOf(documentTypeReq.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", documentType.getCode()) .addValue("tenantid", documentType.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(documentTypeUpdate, batchValues.toArray(new Map[documentTypeList.size()])); return documentTypeReq; } }
DocumentTypeRepository { public DocumentTypeReq update(final DocumentTypeReq documentTypeReq) { log.info("DocumentTypeRequest::" + documentTypeReq); final String documentTypeUpdate = DocumentTypeQueryBuilder.updateDocumentTypeQuery(); final List<DocumentType> documentTypeList = documentTypeReq.getDocumentTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(documentTypeList.size()); for (final DocumentType documentType : documentTypeList) batchValues.add(new MapSqlParameterSource("name", documentType.getName()) .addValue("description", documentType.getDescription()) .addValue("active", documentType.getActive()) .addValue("lastmodifiedby", Long.valueOf(documentTypeReq.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", documentType.getCode()) .addValue("tenantid", documentType.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(documentTypeUpdate, batchValues.toArray(new Map[documentTypeList.size()])); return documentTypeReq; }  }
DocumentTypeRepository { public DocumentTypeReq update(final DocumentTypeReq documentTypeReq) { log.info("DocumentTypeRequest::" + documentTypeReq); final String documentTypeUpdate = DocumentTypeQueryBuilder.updateDocumentTypeQuery(); final List<DocumentType> documentTypeList = documentTypeReq.getDocumentTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(documentTypeList.size()); for (final DocumentType documentType : documentTypeList) batchValues.add(new MapSqlParameterSource("name", documentType.getName()) .addValue("description", documentType.getDescription()) .addValue("active", documentType.getActive()) .addValue("lastmodifiedby", Long.valueOf(documentTypeReq.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", documentType.getCode()) .addValue("tenantid", documentType.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(documentTypeUpdate, batchValues.toArray(new Map[documentTypeList.size()])); return documentTypeReq; }  DocumentTypeReq create(final DocumentTypeReq documentTypeReq); DocumentTypeReq update(final DocumentTypeReq documentTypeReq); boolean checkDocumentTypeByNameAndCode(final String code, final String name, final String tenantId); List<DocumentType> findForCriteria(final DocumentTypeGetReq documentTypeGetRequest); List<Long> getMandatoryocs(final String applicationType); }
DocumentTypeRepository { public DocumentTypeReq update(final DocumentTypeReq documentTypeReq) { log.info("DocumentTypeRequest::" + documentTypeReq); final String documentTypeUpdate = DocumentTypeQueryBuilder.updateDocumentTypeQuery(); final List<DocumentType> documentTypeList = documentTypeReq.getDocumentTypes(); final List<Map<String, Object>> batchValues = new ArrayList<>(documentTypeList.size()); for (final DocumentType documentType : documentTypeList) batchValues.add(new MapSqlParameterSource("name", documentType.getName()) .addValue("description", documentType.getDescription()) .addValue("active", documentType.getActive()) .addValue("lastmodifiedby", Long.valueOf(documentTypeReq.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())) .addValue("code", documentType.getCode()) .addValue("tenantid", documentType.getTenantId()).getValues()); namedParameterJdbcTemplate.batchUpdate(documentTypeUpdate, batchValues.toArray(new Map[documentTypeList.size()])); return documentTypeReq; }  DocumentTypeReq create(final DocumentTypeReq documentTypeReq); DocumentTypeReq update(final DocumentTypeReq documentTypeReq); boolean checkDocumentTypeByNameAndCode(final String code, final String name, final String tenantId); List<DocumentType> findForCriteria(final DocumentTypeGetReq documentTypeGetRequest); List<Long> getMandatoryocs(final String applicationType);  }