Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox tenant data setup #600

Open
wants to merge 49 commits into
base: sandbox
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e31345c
Added default-data-handler consumer
varunreddy-egov Aug 23, 2024
381ab1c
Added implementation of default data addition in localization
varunreddy-egov Aug 29, 2024
8fcaf08
Added Dockerfile and migrate.sh in default-data-handler
varunreddy-egov Aug 30, 2024
13805a4
Modified pom.xml of default-data-handler
varunreddy-egov Aug 30, 2024
db3c487
Modified pom.xml of default-data-handler
varunreddy-egov Aug 30, 2024
087789b
Modified application.properties of default-data-handler
varunreddy-egov Sep 2, 2024
9e17506
Added user creation and user-otp in default-data-handler
varunreddy-egov Sep 2, 2024
8a85969
Added /defaultdata/setup API endpoint
varunreddy-egov Sep 2, 2024
f04d87e
Modified validation logic
varunreddy-egov Sep 3, 2024
cf9d8fc
Added logic to create default tenant config for the target tenant
varunreddy-egov Sep 4, 2024
95707f5
Added API to create default data for a module
varunreddy-egov Sep 4, 2024
510a188
Modified the API response structure
varunreddy-egov Sep 4, 2024
7a76a3f
Added logic to create default wf config for PGR
varunreddy-egov Sep 5, 2024
c8e129d
Added logic to process egov-location.TenantBoundary schema code separ…
varunreddy-egov Sep 5, 2024
8f133f1
Enhanced error handling
varunreddy-egov Sep 5, 2024
17161e9
Added uuid in userInfo
varunreddy-egov Sep 6, 2024
35f55bc
Modified service layer
varunreddy-egov Sep 6, 2024
1429e92
Added functionality to dynamically add tenant code
Rishabh-egov Sep 6, 2024
7868856
add mdms data from json file for action-roles
Rishabh-egov Sep 16, 2024
74b4d49
Modified according to the changes in MDMS and localization
varunreddy-egov Sep 18, 2024
b9d98fd
Modified how pgr and hrms schemacodes loaded
varunreddy-egov Sep 18, 2024
83b0a81
Modified application.properties
varunreddy-egov Sep 18, 2024
8fac806
Modified API payload
varunreddy-egov Sep 19, 2024
6343610
Modified MDMS data create error handling
varunreddy-egov Sep 19, 2024
1c538c9
Modified localization module name
varunreddy-egov Sep 19, 2024
6100f3f
Modified egov-location.TenantBoundary schema code logic
varunreddy-egov Sep 20, 2024
803fcff
Modified digit-tenants localization logic
varunreddy-egov Sep 20, 2024
4ac50f1
Modified to add default data of PGR & HRMS on tenant creation
varunreddy-egov Sep 25, 2024
e500df3
Added default employee creation
Rishabh-egov Oct 4, 2024
6f2642a
Un-commented out the logic
Rishabh-egov Oct 4, 2024
8a7a699
Modified default employees name
Rishabh-egov Oct 4, 2024
ca015ad
Added default Dashbaord Data creation
Rishabh-egov Oct 4, 2024
718bc22
Modified PgrIndexer.json
varunreddy-egov Oct 7, 2024
5dd2bfe
Modified PgrWorkflowConfig.json
varunreddy-egov Oct 8, 2024
9aa9ce8
Modified default employee creation
Rishabh-egov Oct 9, 2024
fa788af
Modified to add default data for more than one locale.
varunreddy-egov Oct 14, 2024
858e23c
Modified the PGR workflow config.
varunreddy-egov Oct 15, 2024
1d6d664
Modified default employee creation
Rishabh-egov Oct 15, 2024
034d67e
Modified default employee creation
Rishabh-egov Oct 15, 2024
d953456
Added welcome email trigger
Rishabh-egov Oct 16, 2024
52bf8ba
Added notification email topic
Rishabh-egov Oct 16, 2024
8f7e4f9
Modified the default employee creation.
varunreddy-egov Oct 16, 2024
9331862
Fixed default employee creation issue
Rishabh-egov Oct 17, 2024
3d30b7d
Added mobile number in HRMS
Rishabh-egov Oct 18, 2024
b07344f
Modified the workflow so that ASSIGNER can create a complaint.
varunreddy-egov Oct 18, 2024
f4e900d
Modified the workflow so that RESOLVER can only perform RESOLVE and R…
varunreddy-egov Oct 22, 2024
b8c863a
Modified the boundary data creation logic.
varunreddy-egov Oct 23, 2024
31ae455
Revert "Modified the boundary data creation logic."
varunreddy-egov Oct 24, 2024
0dadad9
Added default mobile number in default user creation
Rishabh-egov Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions core-services/default-data-handler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

# <Default Data Handler>

This service adds default data for new tenant in the Digit suite of services.

### DB UML Diagram




### Service Dependencies



### Swagger API Contract




## Service Details

Default data handler service listens to create-tenant kafka topic and adds default data for the tenantId received.

### API Details

Default data handler service picks the target tenantId from the kafka topic, mdms schema codes from application.properties, localization locale and modules from application.properties, then creates the default data for the target tenantId in both mdms and localization.


### Kafka Consumers

### Kafka Producers
101 changes: 101 additions & 0 deletions core-services/default-data-handler/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.egov</groupId>
<artifactId>default-data-handler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>default-data-handler</name>
<description>Consumer Service to create default schemas and their data</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- Egov dependencies -->
<dependency>
<groupId>org.egov.services</groupId>
<artifactId>tracer</artifactId>
<version>2.9.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>repo.egovernments.org</id>
<name>eGov DIGIT Releases Repository</name>
<url>https://nexus-repo.digit.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>repo.egovernments.org.snapshots</id>
<name>eGov ERP Releases Repository</name>
<url>https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>repo.egovernments.org.public</id>
<name>eGov Public Repository Group</name>
<url>https://nexus-repo.egovernments.org/nexus/content/groups/public/</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.egov;

import org.egov.tracer.config.TracerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

@Import({TracerConfiguration.class})
@SpringBootApplication
public class DefaultDataHandlerApplication {

public static void main(String[] args) {
SpringApplication.run(DefaultDataHandlerApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.egov.handler.config;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.PostConstruct;
import org.egov.tracer.config.TracerConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

import java.util.TimeZone;

@Import({TracerConfiguration.class})
public class MainConfiguration {

@Value("${app.timezone}")
private String timeZone;

@PostConstruct
public void initialize() {
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
}

@Bean
public ObjectMapper objectMapper(){
return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone));
}

@Bean
@Autowired
public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setObjectMapper(objectMapper);
return converter;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package org.egov.handler.config;

import lombok.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
@Data
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Getter
public class ServiceConfiguration {

@Value("${kafka.topics.create.tenant}")
private String createTopic;

//MDMS Configs
@Value("${egov.mdms.host}${egov.mdms.default.data.create.endpoint}")
private String mdmsDefaultDataCreateURI;

@Value("${egov.mdms.host}${egov.mdms.schema.create.endpoint}")
private String mdmsSchemaCreateURI;

@Value("${egov.mdms.host}${egov.mdms.schema.search.endpoint}")
private String mdmsSchemaSearchURI;

@Value("${egov.mdms.host}${egov.mdms.data.create.endpoint}")
private String mdmsDataCreateURI;

@Value("${egov.mdms.host}${egov.mdms.data.search.endpoint}")
private String mdmsDataSearchURI;

@Value("#{'${default.mdms.schema.create.list}'.split(',')}")
private List<String> defaultMdmsSchemaList;

@Value("#{${mdms.schemacode.map}}")
private Map<String, List<String>> mdmsSchemacodeMap;

//Localization Configs
@Value("${egov.localization.host}${egov.localization.default.data.create.endpoint}")
private String localizationDefaultDataCreateURI;

@Value("${egov.localization.host}${egov.localization.upsert.path}")
private String upsertLocalizationURI;

@Value("#{'${default.localization.locale.list}'.split(',')}")
private List<String> defaultLocalizationLocaleList;

@Value("#{'${default.localization.module.create.list}'.split(',')}")
private List<String> defaultLocalizationModuleList;

@Value("${tenant.localization.module}")
private String tenantLocalizationModule;

// User Config
@Value("${egov.user.host}")
private String userHost;

@Value("${egov.user.context.path}")
private String userContextPath;

@Value("${egov.user.create.path}")
private String userCreateEndpoint;

@Value("${egov.user.search.path}")
private String userSearchEndpoint;

@Value("${egov.user.update.path}")
private String userUpdateEndpoint;

// User OTP Configuration
@Value("${egov.user.otp.host}")
private String userOtpHost;

@Value("${egov.user.otp.send.endpoint}")
private String userOtpSendEndpoint;

// Tenant Management Configuration
@Value("${egov.tenant.management.host}${egov.tenant.management.context.path}${egov.tenant.management.config.create.path}")
private String tenantConfigCreateURI;

@Value("${egov.tenant.management.host}${egov.tenant.management.context.path}${egov.tenant.management.config.search.path}")
private String tenantConfigSearchURI;

// Default Tenant Id
@Value("${default.tenant.id}")
private String defaultTenantId;

// Workflow Configuration
@Value("${egov.workflow.host}${egov.workflow.businessservice.create.path}")
private String wfBusinessServiceCreateURI;

// HRMS configuration
@Value("${egov.hrms.host}")
private String hrmsHost;

@Value("${egov.hrms.path}")
private String hrmsCreatePath;

// Elastic Search Configuration
@Value("${egov.indexer.es.username}")
private String EsUsername;

@Value("${egov.indexer.es.password}")
private String EsPassword;

@Value("${egov.infra.indexer.host}")
private String elasticsearchHost;

@Value("${elasticsearch.port}")
private int elasticsearchPort;

@Value("${egov.bulk.index.path}")
private String bulkIndexPath;

@Value("${topic.notification.mail}")
private String emailTopic;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.egov.handler.config;

import org.springframework.stereotype.Component;

@Component
public class ServiceConstants {

public static final String TENANT_BOUNDARY_SCHEMA = "egov-location.TenantBoundary";

public static final String EXTERNAL_SERVICE_EXCEPTION = "External Service threw an Exception: ";
public static final String SEARCHER_SERVICE_EXCEPTION = "Exception while fetching from searcher: ";

public static final String IDGEN_ERROR = "IDGEN ERROR";
public static final String NO_IDS_FOUND_ERROR = "No ids returned from idgen Service";

public static final String ERROR_WHILE_FETCHING_FROM_MDMS = "Exception occurred while fetching category lists from mdms: ";

public static final String RES_MSG_ID = "uief87324";
public static final String SUCCESSFUL = "successful";
public static final String FAILED = "failed";

public static final String URL = "url";
public static final String URL_SHORTENING_ERROR_CODE = "URL_SHORTENING_ERROR";
public static final String URL_SHORTENING_ERROR_MESSAGE = "Unable to shorten url: ";

public static final String DOB_FORMAT_Y_M_D = "yyyy-MM-dd";
public static final String DOB_FORMAT_D_M_Y = "dd/MM/yyyy";
public static final String ILLEGAL_ARGUMENT_EXCEPTION_CODE = "IllegalArgumentException";
public static final String OBJECTMAPPER_UNABLE_TO_CONVERT = "ObjectMapper not able to convertValue in userCall";
public static final String DOB_FORMAT_D_M_Y_H_M_S = "dd-MM-yyyy HH:mm:ss";
public static final String CREATED_DATE = "createdDate";
public static final String LAST_MODIFIED_DATE = "lastModifiedDate";
public static final String DOB = "dob";
public static final String PWD_EXPIRY_DATE = "pwdExpiryDate";
public static final String INVALID_DATE_FORMAT_CODE = "INVALID_DATE_FORMAT";
public static final String INVALID_DATE_FORMAT_MESSAGE = "Failed to parse date format in user";
public static final String CITIZEN_UPPER = "CITIZEN";
public static final String CITIZEN_LOWER = "Citizen";
public static final String USER = "user";

public static final String PARSING_ERROR = "PARSING ERROR";
public static final String FAILED_TO_PARSE_BUSINESS_SERVICE_SEARCH = "Failed to parse response of workflow business service search";
public static final String BUSINESS_SERVICE_NOT_FOUND = "BUSINESSSERVICE_NOT_FOUND";
public static final String THE_BUSINESS_SERVICE = "The businessService ";
public static final String NOT_FOUND = " is not found";
public static final String TENANTID = "?tenantId=";
public static final String BUSINESS_SERVICES = "&businessServices=";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.egov.handler.constants;

public class OtpConstants {

public static final String OTP_TYPE_LOGIN = "LOGIN";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.egov.handler.constants;

import lombok.NoArgsConstructor;

@NoArgsConstructor
public class UserConstants {


public static final String USER_TYPE_EMPLOYEE = "EMPLOYEE";

public static final String DEFAULT_ROOT_USER_ROLE = "SUPERUSER";

public static final String PGR_LME = "PGR_LME";

public static final String ASSIGNER = "Assigner";

public static final String EMPLOYEE = "EMPLOYEE";

public static final String RESOLVER = "Resolver";

public static final String HRMS_CLASSPATH = "classpath:HRMS.json";

public static final String WELCOME_MAIL_CLASSPATH = "classpath:WelcomeEmail.HTML";

public static final String WELCOME_MAIL_SUBJECT = "Welcome to Sandbox";

}
Loading