Importing core models
Models/POJOs of the dependent service can be imported from digit-core-models library (work on creating library is ongoing). These models will be used in integration with the dependent services.
<dependency>
<groupId>org.egov.services</groupId>
<artifactId>tracer</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.egov.services</groupId>
<artifactId>services-common</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
<repositories>
<repository>
<id>repo.egovernments.org</id>
<name>eGov ERP Releases Repository</name>
<url>https://nexus-repo.egovernments.org/nexus/content/repositories/releases/</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>
These are pre-written libraries which contain tracer support, common models like MDMS, Auth and Auth and capability to raise custom exceptions.
Once these core models are imported, it is safe to delete the RequestInfo, ResponseInfo classes from the models folder and use the ones present under common contract which we just imported.
Before starting development, create/update the following classes -
a) Under models
folder, create RequestInfoWrapper
POJO -
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RequestInfoWrapper {
@JsonProperty("RequestInfo")
private RequestInfo requestInfo;
}
Update the Applicant POJO to have the following content -
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Applicant {
@JsonProperty("id")
private String id = null;
@JsonProperty("userName")
private String userName = null;
@JsonProperty("password")
private String password = null;
@JsonProperty("salutation")
private String salutation = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("gender")
private String gender = null;
@JsonProperty("mobileNumber")
private String mobileNumber = null;
@JsonProperty("emailId")
private String emailId = null;
@JsonProperty("altContactNumber")
private String altContactNumber = null;
@JsonProperty("pan")
private String pan = null;
@JsonProperty("aadhaarNumber")
private String aadhaarNumber = null;
@JsonProperty("permanentAddress")
private String permanentAddress = null;
@JsonProperty("permanentCity")
private String permanentCity = null;
@JsonProperty("permanentPincode")
private String permanentPincode = null;
@JsonProperty("correspondenceCity")
private String correspondenceCity = null;
@JsonProperty("correspondencePincode")
private String correspondencePincode = null;
@JsonProperty("correspondenceAddress")
private String correspondenceAddress = null;
@JsonProperty("active")
private Boolean active = null;
@JsonProperty("locale")
private String locale = null;
@JsonProperty("type")
private String type = null;
@JsonProperty("signature")
private String signature = null;
@JsonProperty("accountLocked")
private Boolean accountLocked = null;
@JsonProperty("roles")
@Valid
private List<Role> roles = null;
@JsonProperty("fatherOrHusbandName")
private String fatherOrHusbandName = null;
@JsonProperty("bloodGroup")
private String bloodGroup = null;
@JsonProperty("identificationMark")
private String identificationMark = null;
@JsonProperty("photo")
private String photo = null;
@JsonProperty("createdBy")
private Long createdBy = null;
@JsonProperty("createdDate")
private LocalDate createdDate = null;
@JsonProperty("lastModifiedBy")
private Long lastModifiedBy = null;
@JsonProperty("lastModifiedDate")
private LocalDate lastModifiedDate = null;
@JsonProperty("otpReference")
private String otpReference = null;
@JsonProperty("tenantId")
private String tenantId = null;
public Applicant addRolesItem(Role rolesItem) {
if (this.roles == null) {
this.roles = new ArrayList<>();
}
this.roles.add(rolesItem);
return this;
}
}
b) Under config
folder, create VTRConfiguration
and MainConfiguration
classes -
@Component
@Data
@Import({TracerConfiguration.class})
@NoArgsConstructor
@AllArgsConstructor
public class VTRConfiguration {
@Value("${app.timezone}")
private String timeZone;
@PostConstruct
public void initialize() {
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
}
@Bean
@Autowired
public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setObjectMapper(objectMapper);
return converter;
}
// 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;
//Idgen Config
@Value("${egov.idgen.host}")
private String idGenHost;
@Value("${egov.idgen.path}")
private String idGenPath;
//Workflow Config
@Value("${egov.workflow.host}")
private String wfHost;
@Value("${egov.workflow.transition.path}")
private String wfTransitionPath;
@Value("${egov.workflow.businessservice.search.path}")
private String wfBusinessServiceSearchPath;
@Value("${egov.workflow.processinstance.search.path}")
private String wfProcessInstanceSearchPath;
@Value("${is.workflow.enabled}")
private Boolean isWorkflowEnabled;
// VTR Variables
@Value("${vtr.kafka.create.topic}")
private String createTopic;
@Value("${vtr.kafka.update.topic}")
private String updateTopic;
@Value("${vtr.default.offset}")
private Integer defaultOffset;
@Value("${vtr.default.limit}")
private Integer defaultLimit;
@Value("${vtr.search.max.limit}")
private Integer maxLimit;
//MDMS
@Value("${egov.mdms.host}")
private String mdmsHost;
@Value("${egov.mdms.search.endpoint}")
private String mdmsEndPoint;
//HRMS
@Value("${egov.hrms.host}")
private String hrmsHost;
@Value("${egov.hrms.search.endpoint}")
private String hrmsEndPoint;
@Value("${egov.url.shortner.host}")
private String urlShortnerHost;
@Value("${egov.url.shortner.endpoint}")
private String urlShortnerEndpoint;
@Value("${egov.sms.notification.topic}")
private String smsNotificationTopic;
}
@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;
}
}