diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java index df126f012..aca1d4b2f 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java @@ -55,6 +55,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import javax.net.ssl.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + @SpringBootApplication @ComponentScan(basePackages = { "org.egov.hrms", "org.egov.hrms.web.controllers" , "org.egov.hrms.config"}) @Import(TracerConfiguration.class) @@ -76,7 +80,36 @@ public ObjectMapper getObjectMapper() { return objectMapper; } + public static void trustSelfSignedSSL() { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + ctx.init(null, new TrustManager[]{tm}, null); + SSLContext.setDefault(ctx); + + // Disable hostname verification + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { + public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { + return true; + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + public static void main(String[] args) { + trustSelfSignedSSL(); SpringApplication.run(EgovEmployeeApplication.class, args); } } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java index e9adc7abb..99ad9107a 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java @@ -125,4 +125,39 @@ public class PropertiesManager { @Value("${egov.hrms.max.pagination.limit}") public Integer hrmsMaxLimit; + + // FuzzyConfigs + @Value("${hrms.search.pagination.default.limit}") + public Long defaultLimit; + + @Value("${hrms.search.pagination.default.offset}") + public Long defaultOffset; + + @Value("${hrms.search.pagination.max.search.limit}") + public Long searchLimit; + + @Value("${hrms.search.pagination.max.search.limit}") + private Long maxSearchLimit; + + @Value("${hrms.fuzzy.search.is.wildcard}") + private Boolean isSearchWildcardBased; + + @Value("${hrms.search.name.fuziness}") + private String nameFuziness; + + // es configs + @Value("${elasticsearch.host}") + private String esHost; + + @Value("${hrms.es.index}") + private String esPTIndex; + + @Value("${elasticsearch.search.endpoint}") + private String esSearchEndpoint; + + @Value("${egov.es.username}") + private String userName; + + @Value("${egov.es.password}") + private String password; } \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java new file mode 100644 index 000000000..767262ca1 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/ElasticSearchRepository.java @@ -0,0 +1,84 @@ +package org.egov.hrms.repository; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.RestTemplate; + +import java.util.Base64; +import java.util.List; + +@Slf4j +@Repository +public class ElasticSearchRepository { + private PropertiesManager config; + + private FuzzySearchQueryBuilder queryBuilder; + + private RestTemplate restTemplate; + + private ObjectMapper mapper; + + @Autowired + public ElasticSearchRepository(PropertiesManager config, FuzzySearchQueryBuilder queryBuilder, RestTemplate restTemplate, ObjectMapper mapper) { + this.config = config; + this.queryBuilder = queryBuilder; + this.restTemplate = restTemplate; + this.mapper = mapper; + } + + public Object fuzzySearchEmployees(EmployeeSearchCriteria criteria, List uuids) { + + + String url = getESURL(); + + String searchQuery = queryBuilder.getFuzzySearchQuery(criteria, uuids); + + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", getESEncodedCredentials()); + headers.setContentType(MediaType.APPLICATION_JSON); + log.info("Headers: " + headers.toString()); + HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); + ResponseEntity response = null; + try { + response = restTemplate.postForEntity(url, requestEntity, Object.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new CustomException("ES_ERROR","Failed to fetch data from ES"); + } + + return response.getBody(); + + } + + + /** + * Generates elasticsearch search url from application properties + * + * @return + */ + private String getESURL() { + + StringBuilder builder = new StringBuilder(config.getEsHost()); + builder.append(config.getEsPTIndex()); + builder.append(config.getEsSearchEndpoint()); + + return builder.toString(); + } + + public String getESEncodedCredentials() { + String credentials = config.getUserName() + ":" + config.getPassword(); + byte[] credentialsBytes = credentials.getBytes(); + byte[] base64CredentialsBytes = Base64.getEncoder().encode(credentialsBytes); + return "Basic " + new String(base64CredentialsBytes); + } +} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java index 8812b302b..61f55da39 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java @@ -105,7 +105,7 @@ public String paginationClause(EmployeeSearchCriteria criteria, StringBuilder bu pagination = pagination.replace("$offset", "0"); if(null != criteria.getLimit()){ - Integer limit = criteria.getLimit() + criteria.getOffset(); + Long limit = criteria.getLimit() + criteria.getOffset(); pagination = pagination.replace("$limit", limit.toString()); } else diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java index 6062a0733..d0c8c10a0 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java @@ -70,7 +70,7 @@ public List fetchEmployees(EmployeeSearchCriteria criteria, RequestInf return employees; } - private List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + public List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { List employeesIds = new ArrayList<>(); List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getAssignmentSearchQuery(criteria, preparedStmtList); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java new file mode 100644 index 000000000..ef80e1369 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/FuzzySearchQueryBuilder.java @@ -0,0 +1,160 @@ +package org.egov.hrms.repository; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.extern.slf4j.Slf4j; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +@Repository +@Slf4j +public class FuzzySearchQueryBuilder { + private ObjectMapper mapper; + + private PropertiesManager config; + + @Autowired + public FuzzySearchQueryBuilder(ObjectMapper mapper, PropertiesManager config) { + this.mapper = mapper; + this.config = config; + } + + private static final String BASE_QUERY = "{\n" + + " \"from\": {{OFFSET}},\n" + + " \"size\": {{LIMIT}},\n" + + " \"sort\": {\n" + + " \"_score\": {\n" + + " \"order\": \"desc\"\n" + + " }\n" + + " },\n" + + " \"query\": {\n" + + " }\n" + + "}"; + + private static final String fuzzyQueryTemplate = "{\n" + + " \"match\": {\n" + + " \"{{VAR}}\": {\n" + + " \"query\": \"{{PARAM}}\",\n" + + " \"fuzziness\": \"{{FUZZINESS}}\"\n" + + " }\n" + + " }\n" + + " }"; + + private static final String wildCardQueryTemplate = "{\n" + + " \"query_string\": {\n" + + " \"default_field\": \"{{VAR}}\",\n" + + " \"query\": \"*{{PARAM}}*\"\n" + + " }\n" + + " }"; + + private static final String filterTemplate = "\"filter\": { " + + " }"; + + public String getFuzzySearchQuery(EmployeeSearchCriteria criteria, List ids) { + String finalQuery = ""; + + try { + String baseQuery = addPagination(criteria); + JsonNode node = mapper.readTree(baseQuery); + ObjectNode insideMatch = (ObjectNode)node.get("query"); + List fuzzyClauses = new LinkedList<>(); + + if(criteria.getName() != null){ + fuzzyClauses.add(getInnerNode(criteria.getName(),"Data.user.name",config.getNameFuziness())); + } + + ArrayNode tenantIdArray = mapper.createArrayNode(); + tenantIdArray.add(criteria.getTenantId()); + ObjectNode tenantIdFilter = mapper.createObjectNode(); + tenantIdFilter.putPOJO("terms", mapper.createObjectNode().putPOJO("Data.tenantId.keyword", tenantIdArray)); + fuzzyClauses.add(tenantIdFilter); + + if (criteria.getRoles() != null && !criteria.getRoles().isEmpty()) { + ArrayNode roleArray = mapper.createArrayNode(); + for (String role : criteria.getRoles()) { + ObjectNode roleNode = mapper.createObjectNode(); + roleNode.put("term", mapper.createObjectNode().put("Data.user.roles.code.keyword", role)); + roleArray.add(roleNode); + } + ObjectNode rolesBoolNode = mapper.createObjectNode(); + rolesBoolNode.putPOJO("bool", mapper.createObjectNode().putPOJO("should", roleArray)); + fuzzyClauses.add(rolesBoolNode); + + ObjectNode boolQuery = mapper.createObjectNode(); + boolQuery.putPOJO("must", fuzzyClauses); + insideMatch.putPOJO("bool", boolQuery); + finalQuery = mapper.writeValueAsString(node); + } + } catch (Exception e) { + log.error("ES_ERROR", e); + throw new CustomException("JSONNODE_ERROR", "Failed to build JSON query for fuzzy search"); + } + + log.info("finalQuery {}",finalQuery); + return finalQuery; + } + + private JsonNode getInnerNode(String param, String var, String fuziness) throws JsonProcessingException { + + String template; + if(config.getIsSearchWildcardBased()) + template = wildCardQueryTemplate; + else + template = fuzzyQueryTemplate; + String innerQuery = template.replace("{{PARAM}}",getEscapedString(param)); + innerQuery = innerQuery.replace("{{VAR}}",var); + + if(!config.getIsSearchWildcardBased()) + innerQuery = innerQuery.replace("{{FUZZINESS}}", fuziness); + + JsonNode innerNode = mapper.readTree(innerQuery); + return innerNode; + } + + private String addPagination(EmployeeSearchCriteria criteria) { + + Long limit = config.getDefaultLimit(); + Long offset = config.getDefaultOffset(); + + if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) + limit = criteria.getLimit(); + + if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) + limit = config.getMaxSearchLimit(); + + if (criteria.getOffset() != null) + offset = criteria.getOffset(); + + String baseQuery = BASE_QUERY.replace("{{OFFSET}}", offset.toString()); + baseQuery = baseQuery.replace("{{LIMIT}}", limit.toString()); + + return baseQuery; + } + + /** + * Escapes special characters in given string + * @param inputString + * @return + */ + private String getEscapedString(String inputString){ + final String[] metaCharacters = {"\\","/","^","$","{","}","[","]","(",")",".","*","+","?","|","<",">","-","&","%"}; + for (int i = 0 ; i < metaCharacters.length ; i++) { + if (inputString.contains(metaCharacters[i])) { + inputString = inputString.replace(metaCharacters[i], "\\\\" + metaCharacters[i]); + } + } + return inputString; + } +} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java index b8d5bbb0d..f105cc7c7 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java @@ -104,6 +104,9 @@ public class EmployeeService { @Autowired private ObjectMapper objectMapper; + @Autowired + private FuzzySearchService fuzzySearchService; + /** * Service method for create employee. Does following: * 1. Sets ids to all the objects using idgen service. @@ -138,11 +141,17 @@ public EmployeeResponse create(EmployeeRequest employeeRequest) { * @return */ public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { + boolean userChecked = false; /*if(null == criteria.getIsActive() || criteria.getIsActive()) criteria.setIsActive(true); else criteria.setIsActive(false);*/ + if(criteria.getName()!=null){ + List fuzzyEmployees = fuzzySearchService.getEmployees(requestInfo, criteria); + return EmployeeResponse.builder().responseInfo(factory.createResponseInfoFromRequestInfo(requestInfo, true)) + .employees(fuzzyEmployees).build(); + } Map mapOfUsers = new HashMap(); if(!StringUtils.isEmpty(criteria.getPhone()) || !CollectionUtils.isEmpty(criteria.getRoles())) { Map userSearchCriteria = new HashMap<>(); diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java new file mode 100644 index 000000000..e8e464343 --- /dev/null +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/FuzzySearchService.java @@ -0,0 +1,120 @@ +package org.egov.hrms.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.JsonPath; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.hrms.config.PropertiesManager; +import org.egov.hrms.model.Employee; +import org.egov.hrms.repository.ElasticSearchRepository; +import org.egov.hrms.repository.EmployeeRepository; +import org.egov.hrms.utils.HRMSConstants; +import org.egov.hrms.utils.HRMSUtils; +import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.hrms.web.contract.User; +import org.egov.hrms.web.contract.UserResponse; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +import static org.egov.hrms.utils.HRMSConstants.ES_DATA_PATH; + +@Slf4j +@Service +public class FuzzySearchService { + @Autowired + private ElasticSearchRepository elasticSearchRepository; + @Autowired + private ObjectMapper mapper; + @Autowired + private EmployeeRepository employeeRepository; + @Autowired + private PropertiesManager config; + @Autowired + private UserService userService; + @Autowired + private HRMSUtils hrmsUtils; + + + public List getEmployees(RequestInfo requestInfo, EmployeeSearchCriteria criteria) { + + if(criteria.getTenantId() == null) + { criteria.setTenantId(config.getStateLevelTenantId()); } + + List idsFromDB = employeeRepository.fetchEmployeesforAssignment(criteria,requestInfo); + +// if(CollectionUtils.isEmpty(idsFromDB)) +// return new LinkedList<>(); + + validateFuzzySearchCriteria(criteria); + + Object esResponse = elasticSearchRepository.fuzzySearchEmployees(criteria, idsFromDB); + + Map> tenantIdToEmpId = getTenantIdToEmpIdMap(esResponse); + + List employees = new LinkedList<>(); + + for (Map.Entry> entry : tenantIdToEmpId.entrySet()) { + String tenantId = entry.getKey(); + Set empIds = entry.getValue(); + List empList = new ArrayList<>(empIds); + + EmployeeSearchCriteria employeeSearchCriteria = EmployeeSearchCriteria.builder().tenantId(tenantId).codes(empList).build(); + + employees.addAll(employeeRepository.fetchEmployees(employeeSearchCriteria, requestInfo)); + Set uuids = employees.stream().map(Employee::getUuid).collect(Collectors.toSet()); + Map map = new HashMap<>(); + map.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); + UserResponse userResponse = userService.getUser(requestInfo, map); + log.info("userResponse {}",userResponse); + List users = userResponse.getUser(); + hrmsUtils.enrichOwner(users, employees); + } + + return employees; + } + private void validateFuzzySearchCriteria(EmployeeSearchCriteria criteria){ + + if(criteria.getName() == null) + throw new CustomException("INVALID_SEARCH_CRITERIA","The search criteria is invalid"); + + } + private Map> getTenantIdToEmpIdMap(Object esResponse) { + + List> data; + Map> tenantIdToEmpIds = new LinkedHashMap<>(); + + + try { + data = JsonPath.read(esResponse, ES_DATA_PATH); + + + if (!CollectionUtils.isEmpty(data)) { + + for (Map map : data) { + + String tenantId = JsonPath.read(map, "$.tenantData.code"); + String empId = JsonPath.read(map, "$.code"); + if (tenantIdToEmpIds.containsKey(tenantId)) + tenantIdToEmpIds.get(tenantId).add(empId); + else { + Set empIds = new HashSet<>(); + empIds.add(empId); + tenantIdToEmpIds.put(tenantId, empIds); + } + + } + + } + + } catch (Exception e) { + throw new CustomException("PARSING_ERROR", "Failed to extract employeeIds from es response"); + } + + return tenantIdToEmpIds; + } +} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java index 645f6f288..994ee578d 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java @@ -53,4 +53,11 @@ public class HRMSConstants { public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE = "EMPLOYEE"; public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE = "userType"; + // Fuzzy Search + public static final String ES_DATA_PATH = "$..Data"; + + public static final String ES_DATA_TENANTID_PATH = "$.tenantData.code"; + + public static final String ES_DATA_PROPERTYID_PATH = "$.propertyId"; + } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java index d9a9f1c8f..64e768b7f 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java @@ -1,14 +1,20 @@ package org.egov.hrms.utils; import java.security.SecureRandom; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Random; +import lombok.extern.slf4j.Slf4j; +import org.egov.hrms.model.Employee; import org.egov.hrms.web.contract.EmployeeSearchCriteria; +import org.egov.hrms.web.contract.User; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +@Slf4j @Service public class HRMSUtils { @@ -61,4 +67,19 @@ public boolean isAssignmentSearchReqd(EmployeeSearchCriteria criteria) { return (! CollectionUtils.isEmpty(criteria.getPositions()) || null != criteria.getAsOnDate() || !CollectionUtils.isEmpty(criteria.getDepartments()) || !CollectionUtils.isEmpty(criteria.getDesignations())); } + + public void enrichOwner(List users, List employees) { + + Map uuidToUserMap = new HashMap<>(); + users.forEach(user -> uuidToUserMap.put(user.getUuid(), user)); + + employees.forEach(employee -> { + User user = uuidToUserMap.get(employee.getUuid()); + if (user == null) { + log.info("USER SEARCH ERROR: The user with UUID : \"" + employee.getUuid() + "\" for the employee with Id \"" + employee.getId() + "\" is not present in user search response"); + } else { + employee.setUser(user); + } + }); + } } diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java index eed0dd147..61915301c 100644 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java +++ b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java @@ -56,9 +56,11 @@ public class EmployeeSearchCriteria { public String phone; - public Integer offset; + public Long offset; - public Integer limit; + public Long limit; + + private String name; public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties index 71a102711..d6b00bbbe 100644 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ b/business-services/egov-hrms/src/main/resources/application.properties @@ -1,18 +1,18 @@ #---------------------------- DATABASE CONFIGURATIONS -----------------------------# spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/egov_hrms +spring.datasource.url=jdbc:postgresql://localhost:5432/demo spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=123 #----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/egov_hrms +spring.flyway.url=jdbc:postgresql://localhost:5432/demo spring.flyway.user=postgres -spring.flyway.password=postgres -#spring.flyway.table=hr_employee_schema_version +spring.flyway.password=123 +spring.flyway.table=hr_employee_schema_version spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true spring.flyway.locations=classpath:/db/migration/main,db/migration/seed -spring.flyway.enabled=true +spring.flyway.enabled=false #--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# server.contextPath=/egov-hrms @@ -73,10 +73,30 @@ egov.hrms.default.pwd.length=8 open.search.enabled.roles=SUPERUSER egov.pwd.allowed.special.characters=@#$% +#FuzzySearch +hrms.search.pagination.default.limit=50 +hrms.search.pagination.default.offset=0 +hrms.search.pagination.max.search.limit=5000 +hrms.fuzzy.search.is.wildcard=false +hrms.search.name.fuziness=2 + +#Elastic serach Properties +elasticsearch.host=http://elasticsearch-data.es-cluster:9200 + +elasticsearch.search.endpoint=/_search +egov.es.username=elastic +egov.es.password=EQYBhZhfrXeOA5IIqiHHCSlN +hrms.es.index=hrmsindex + #------------------------------ KAFKA CONFIGURATIONS ------------------------------# # KAFKA SERVER CONFIGURATIONS -spring.kafka.bootstrap.servers=localhost:9092 +#spring.kafka.bootstrap.servers=localhost:9092 spring.kafka.consumer.properties.spring.json.use.type.headers=false +kafka.enabled=false +spring.kafka.bootstrap.servers=none +spring.kafka.consumer.enable-auto-commit=false +spring.kafka.producer.enabled=false +spring.profiles.active=local # SPRING KAFKA CONSUMER CONFIGURATIONS spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer @@ -106,4 +126,4 @@ logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.S log4j.logger.org.springframework.jdbc.core = TRACE state.level.tenant.id=pb -sms.user.creation.enabled=true \ No newline at end of file +sms.user.creation.enabled=true