Commit 798038fe by neel

Initial commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
/target
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>iRecruit</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="iRecruit-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="iRecruit"/>
<property name="java-output-path" value="/iRecruit/target/classes"/>
<property name="component.exclusion.patterns"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.8"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="4.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Window
\ No newline at end of file
disabled=06target
eclipse.preferences.version=1
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/maven-plugin/)
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications)
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/reference/htmlsingle/#boot-features-jpa-and-spring-data)
* [Spring Security](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/reference/htmlsingle/#boot-features-security)
### Guides
The following guides illustrate how to use some features concretely:
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
* [Securing a Web Application](https://spring.io/guides/gs/securing-web/)
* [Spring Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/)
* [Authenticating a User with LDAP](https://spring.io/guides/gs/authenticating-ldap/)
**Edit a file, create a new file, and clone from Bitbucket in under 2 minutes**
When you're done, you can delete the content in this README and update the file with details for others getting started with your repository.
*We recommend that you open this README in another tab as you perform the tasks below. You can [watch our video](https://youtu.be/0ocf7u76WSo) for a full demo of all the steps in this tutorial. Open the video in a new tab to avoid leaving Bitbucket.*
---
## Edit a file
You’ll start by editing this README file to learn how to edit a file in Bitbucket.
1. Click **Source** on the left side.
2. Click the README.md link from the list of files.
3. Click the **Edit** button.
4. Delete the following text: *Delete this line to make a change to the README from Bitbucket.*
5. After making your change, click **Commit** and then **Commit** again in the dialog. The commit page will open and you’ll see the change you just made.
6. Go back to the **Source** page.
---
## Create a file
Next, you’ll add a new file to this repository.
1. Click the **New file** button at the top of the **Source** page.
2. Give the file a filename of **contributors.txt**.
3. Enter your name in the empty file space.
4. Click **Commit** and then **Commit** again in the dialog.
5. Go back to the **Source** page.
Before you move on, go ahead and explore the repository. You've already seen the **Source** page, but check out the **Commits**, **Branches**, and **Settings** pages.
---
## Clone a repository
Use these steps to clone from SourceTree, our client for using the repository command-line free. Cloning allows you to work on your files locally. If you don't yet have SourceTree, [download and install first](https://www.sourcetreeapp.com/). If you prefer to clone from the command line, see [Clone a repository](https://confluence.atlassian.com/x/4whODQ).
1. You’ll see the clone button under the **Source** heading. Click that button.
2. Now click **Check out in SourceTree**. You may need to create a SourceTree account or log in.
3. When you see the **Clone New** dialog in SourceTree, update the destination path and name if you’d like to and then click **Clone**.
4. Open the directory you just created to see your repository’s files.
Now that you're more familiar with your Bitbucket repository, go ahead and add a new file locally. You can [push your change back to Bitbucket with SourceTree](https://confluence.atlassian.com/x/iqyBMg), or you can [add, commit,](https://confluence.atlassian.com/x/8QhODQ) and [push from the command line](https://confluence.atlassian.com/x/NQ0zDQ).
## New SQl file for schema
1) If you get new 1.0 initial file for tenant then you have to take data(inserts) backup of all society schemas.Except table (schema_version,tbl_blocks,tbl_document_list,tbl_properties_type,tbl_roles)
2) Remove society schemas
3) start server (It will create new schemas)
4) Dump your data backup to society schemas.
## Steps to call a service with authorization (for invoice)
1. Login with the admin credentials
2. Add a column **notificationId** with datatype **varchar** in **tbl_users** table
3. Sign in with the admin user(9033882640:nirav123) in swagger-ui and follow below activities in swagger ui only
4. Authorise with the returned token like **Bearer <TOKEN>**
5. Create a society of your choice
6. Update admin tenant(for input field **id**, please see database entry in table **tenants** that is created when you registered the new society)
7. Use the response Bearer token to authorise all society related requests in swagger ui as well as in your code
8. create builder
9. add users for builder and register user.
10. create property (provide name in property type)
11. add member and owners to property and register them
12. If you login with builder/owner/member you don't need to change tenant only if user is not in multiple tenant.
13. You can use all society related service using token.
\ No newline at end of file
This diff is collapsed. Click to expand it.
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
<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>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com</groupId>
<artifactId>iRecruit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>iRecruit</name>
<description>Demo project for Spring Boot</description>
<packaging>war</packaging>
<properties>
<!--<start-class>com.iRecruit.IRecruitApplication</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>-->
<maven.test.skip>true</maven.test.skip>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<!-- For Java 8 Date/Time Support -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.8.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.12.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
<version>9.1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>r938</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.1.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<directory>target</directory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<outputDirectory>spring</outputDirectory>
<skipTests>true</skipTests>
<mainClass>com.iRecruit.IRecruitApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.iRecruit;
import java.util.TimeZone;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
import com.iRecruit.audit.SpringSecurityAuditorAware;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.TemplateConfig;
//@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, MultipartAutoConfiguration.class })
@SpringBootApplication
@EnableCaching
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
public class IRecruitApplication {
@PostConstruct
void init() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
@Autowired
DBConfig DBConfig;
@Autowired
TemplateConfig TemplateConfig;
@Bean
public AuditorAware<String> auditorAware() {
return new SpringSecurityAuditorAware();
}
/*@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(IRecruitApplication.class);
}*/
public static void main(String[] args) {
SpringApplication.run(IRecruitApplication.class, args);
}
}
\ No newline at end of file
package com.iRecruit.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AuditLogs {
public boolean isResponse() default true;
public boolean isRequest() default true;
public String service() default "";
}
\ No newline at end of file
package com.iRecruit.audit;
import java.util.Optional;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import com.iRecruit.security.UserPrincipal;
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
public Optional<String> getCurrentAuditor() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null ||
!authentication.isAuthenticated() ||
authentication instanceof AnonymousAuthenticationToken) {
return Optional.empty();
}
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
return Optional.ofNullable(userPrincipal.getUsername());
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.util.Date;
import javax.validation.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.iRecruit.modules.auth.model.AuditLogs;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.AuditLogsService;
import com.iRecruit.security.UserPrincipal;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ControllerAdvice
public class APIExceptionHandler extends ResponseEntityExceptionHandler {
/*
* private Object request;
*
* @ModelAttribute public void setRequest(@RequestBody Object request) {
* this.request = request; }
*/
@Autowired
AuditLogsService auditLogsService;
/*@Override
protected ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
log.error(ex.getMessage(), ex);
String error = "";
for(ObjectError oe : ex.getBindingResult().getAllErrors()) {
DefaultMessageSourceResolvable dmsr = null;
for(Object a : oe.getArguments()) {
if(a instanceof DefaultMessageSourceResolvable) {
dmsr = (DefaultMessageSourceResolvable)a;
break;
}
}
if(dmsr != null) {
error += dmsr.getDefaultMessage()+" = " + oe.getDefaultMessage()+",";
}else {
error += oe.getDefaultMessage()+",";
}
}
FieldError fieldError = ex.getBindingResult().getFieldError();
ApiResponse responseDTO = new ApiResponse(status.value(), true, error, null);
String remoteAddr = "";
if (headers != null) {
remoteAddr = request.getHeader("X-FORWARDED-FOR");
if (remoteAddr == null || "".equals(remoteAddr)) {
remoteAddr = request.getHeader("REMOTE_ADDR");
}
}
UserPrincipal userPrincipal = (UserPrincipal)request.getUserPrincipal();
log.info(userPrincipal.toString());
AuditLogs auditLogs = new AuditLogs(null, ex.getBindingResult().getNestedPath(), remoteAddr,
userPrincipal.getDeviceInfo(), userPrincipal.getBrowserInfo(), userPrincipal.getUsername(), userPrincipal.getOS(),
status.value(), error, 1L, "" , ex.getMessage(),new Date());
AuditLogsDto auditLogsDto = new AuditLogsDto(auditLogs);
auditLogsService.save(auditLogsDto);
return ResponseEntity.badRequest().body(responseDTO);
}*/
@ExceptionHandler(ConstraintViolationException.class)
public final ResponseEntity<Object> handleConstraintViolationException(Exception ex, WebRequest request) {
log.error(ex.getMessage(), ex);
ApiResponse responseDTO = new ApiResponse(HttpStatus.BAD_REQUEST.value(), true, ex.getMessage(), null);
return ResponseEntity.badRequest().body(responseDTO);
}
}
package com.iRecruit.config;
import java.util.HashMap;
import javax.sql.DataSource;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
public class CommonRoutingDataSource extends AbstractRoutingDataSource {
@Override
protected Object determineCurrentLookupKey() {
return DataSourceContextHolder.getDataSourceName();
}
public void initDataSources(final DataSource dataSource1, final DataSource dataSource2,
final String defaultDataSourceKey) {
final java.util.Map<Object, Object> dataSourceMap = new HashMap<Object, Object>();
dataSourceMap.put("iRecruitSchemaDataSource", dataSource1);
dataSourceMap.put("NAAFSchemaDataSource", dataSource2);
this.setDefaultTargetDataSource(dataSourceMap.get("iRecruitSchemaDataSource"));
this.setTargetDataSources(dataSourceMap);
}
}
package com.iRecruit.config;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
public class CustomPhysicalNamingStrategy implements PhysicalNamingStrategy {
@Override
public Identifier toPhysicalCatalogName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return identifier;
}
@Override
public Identifier toPhysicalColumnName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return convertToSnakeCase(identifier);
}
@Override
public Identifier toPhysicalSchemaName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return identifier;
}
@Override
public Identifier toPhysicalSequenceName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return convertToSnakeCase(identifier);
}
@Override
public Identifier toPhysicalTableName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return convertToSnakeCase(identifier);
}
private Identifier convertToSnakeCase(final Identifier identifier) {
final String regex = "([a-z])([A-Z])";
final String replacement = "$1_$2";
final String newName = identifier.getText()
.replaceAll(regex, replacement)
.toLowerCase();
return Identifier.toIdentifier(newName);
}
}
package com.iRecruit.config;
public class DataSourceContextHolder {
private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
private DataSourceContextHolder() {
// private no-op constructor
}
public static final void setDataSourceName(final String dataSourceName) {
contextHolder.set(dataSourceName);
}
public static final String getDataSourceName() {
return contextHolder.get();
}
public static final void clearDataSourceName() {
contextHolder.remove();
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.util.HashMap;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.cfg.AvailableSettings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@PropertySource("classpath:application.properties")
@EnableTransactionManagement
@EnableJpaRepositories(
entityManagerFactoryRef = "iRecruitSchemaEntityManagerFactory",
transactionManagerRef = "iRecruitSchemaTransactionManager",
basePackages = {
"com.iRecruit.modules.auth.repository",
})
//@Resource(name="jdbc/", type=javax.sql.DataSource.class, lookup="jdbc/fileUploadDS")
public class IRecruitSchemaConfig {
@Autowired
Environment environment;
//@Value("${irecruit.datasource.jndi-name}")
//private static String JNDI_NAME;
private static final String JNDI_NAME = "jdbc/irecruit";
@Primary
@Bean(name = "iRecruitSchemaDataSource")
//@ConfigurationProperties(prefix = "irecruit.datasource")
//@Resource(name = JNDI_NAME)
public DataSource iRecruitSchemaDataSource() {
//HikariDataSource dataSource = new HikariDataSource();
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.driverClassName(environment.getProperty("irecruit.datasource.driver-class-name"));
dataSourceBuilder.url(environment.getProperty("spring.datasource.url"));
dataSourceBuilder.username(environment.getProperty("irecruit.datasource.username"));
dataSourceBuilder.password(environment.getProperty("irecruit.datasource.password"));
return dataSourceBuilder.build();
//dataSource.setDataSourceJNDI(environment.getProperty("irecruit.datasource.jndi-name"));
/*dataSource.setDriverClassName(environment.getProperty("irecruit.datasource.driver-class-name"));
dataSource.setJdbcUrl(environment.getProperty("spring.datasource.url"));
dataSource.setUsername(environment.getProperty("irecruit.datasource.username"));
dataSource.setPassword(environment.getProperty("irecruit.datasource.password"));
dataSource.setCatalog("irecruitCat");
/*dataSource.setConnectionTimeout(Long.parseLong(environment.getProperty("spring.datasource.hikari.connectionTimeout")));
dataSource.setValidationTimeout(Long.parseLong(environment.getProperty("spring.datasource.hikari.validationTimeout")));
dataSource.setMaximumPoolSize(Integer.parseInt(environment.getProperty("spring.datasource.hikari.maximumPoolSize")));
dataSource.setMaxLifetime(Long.parseLong(environment.getProperty("spring.datasource.hikari.maxLifetime")));
dataSource.setIdleTimeout(Long.parseLong(environment.getProperty("spring.datasource.hikari.idleTimeout")));
dataSource.setMinimumIdle(Integer.parseInt(environment.getProperty("spring.datasource.hikari.minimumIdle")));
return dataSource;*/
/*JndiDataSourceLookup jndiDataSourceLookup = new JndiDataSourceLookup();
jndiDataSourceLookup.setResourceRef(true);
return jndiDataSourceLookup.getDataSource(JNDI_NAME);
*/
//return DataSourceBuilder.create().build();
}
@Primary
@Bean(name = "iRecruitSchemaEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(iRecruitSchemaDataSource());
em.setPersistenceUnitName("iRecruitSchema");
em.setPackagesToScan(new String[] { "com.iRecruit.modules.auth.model",
});
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
HashMap<String, Object> properties = new HashMap<>();
properties.put(AvailableSettings.HBM2DDL_AUTO, environment.getProperty("irecruit.jpa.hibernate.ddl-auto"));
properties.put(AvailableSettings.GLOBALLY_QUOTED_IDENTIFIERS, environment.getProperty("irecruit.jpa.hibernate.globally_quoted_identifiers"));
properties.put(AvailableSettings.PHYSICAL_NAMING_STRATEGY, CustomPhysicalNamingStrategy.class.getName());
em.setJpaPropertyMap(properties);
return em;
}
@Primary
@Bean(name = "iRecruitSchemaTransactionManager")
public PlatformTransactionManager iRecruitSchemaTransactionManager(
@Qualifier("iRecruitSchemaEntityManagerFactory") EntityManagerFactory iRecruitSchemaEntityManagerFactory) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
//return new JpaTransactionManager(iRecruitSchemaEntityManagerFactory);
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.io.Serializable;
import java.util.Properties;
import org.hibernate.HibernateException;
import org.hibernate.boot.MappingException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.LongType;
import org.hibernate.type.Type;
public class IdGenerator extends SequenceStyleGenerator {
public static final String VALUE_PREFIX_PARAMETER = "valuePrefix";
public static final String VALUE_PREFIX_DEFAULT = "";
private String valuePrefix;
public static final String NUMBER_FORMAT_PARAMETER = "numberFormat";
public static final String NUMBER_FORMAT_DEFAULT = "%d";
private String numberFormat;
@Override
public Serializable generate(SharedSessionContractImplementor session,
Object object) throws HibernateException {
return valuePrefix + String.format(numberFormat, super.generate(session, object));
}
@Override
public void configure(Type type, Properties params,
ServiceRegistry serviceRegistry) throws MappingException {
super.configure(LongType.INSTANCE, params, serviceRegistry);
valuePrefix = ConfigurationHelper.getString(VALUE_PREFIX_PARAMETER,
params, VALUE_PREFIX_DEFAULT);
numberFormat = ConfigurationHelper.getString(NUMBER_FORMAT_PARAMETER,
params, NUMBER_FORMAT_DEFAULT);
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.iRecruit.config;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.data.jpa.domain.Specification;
import com.iRecruit.modules.auth.payload.request.Condition;
public class QuerySpecification {
public static Specification<?> generateQuery(List<Condition> conditions) {
return (root, query, cb) ->{
List<Predicate> predicates = getPredicate(conditions,root,query,cb);
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
}
public static List<Condition> getConditionByKey(List<Condition> conditions,String key ) {
List<Condition> conditionArr = new ArrayList<Condition>();
for(int cnt=0;cnt<conditions.size();cnt++) {
Condition condition = conditions.get(cnt);
if(condition.getIsGroup()) {
conditionArr.addAll(getConditionByKey(condition.getGroupConditions(),key));
}else {
if(condition.getKey().equalsIgnoreCase(key)) {
conditionArr.add(condition);
}
}
}
return conditionArr;
}
public static List<Predicate> getPredicate(List<Condition> conditions,Root<?> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder){
List<Predicate> predicates = new ArrayList<>();
for(int cnt=0;cnt<conditions.size();cnt++) {
Condition condition = conditions.get(cnt);
if(condition.getIsGroup()) {
List<Predicate> predicatesGroup = getPredicate(condition.getGroupConditions(),root,query,criteriaBuilder);
if(condition.getGroupCondition().equalsIgnoreCase("AND")) {
predicates.add(criteriaBuilder.and(predicatesGroup.toArray(new Predicate[predicatesGroup.size()])));
}else {
predicates.add(criteriaBuilder.or(predicatesGroup.toArray(new Predicate[predicatesGroup.size()])));
}
}else {
if(condition.getCriteria().equalsIgnoreCase("like")) {
predicates.add(criteriaBuilder.like(root.get(condition.getKey()), "%" + (String)condition.getValue() + "%"));
}else if(condition.getCriteria().equalsIgnoreCase("=")) {
predicates.add(criteriaBuilder.equal(root.get(condition.getKey()),condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase(">")) {
predicates.add(criteriaBuilder.gt(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase(">=")) {
predicates.add(criteriaBuilder.ge(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("<")) {
predicates.add(criteriaBuilder.lt(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("<=")) {
predicates.add(criteriaBuilder.le(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("in")) {
predicates.add(root.get(condition.getKey()).in(condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("notin")) {
predicates.add(root.get(condition.getKey()).in(condition.getValue()).not());
}else if(condition.getCriteria().equalsIgnoreCase("isNull")) {
predicates.add(root.get(condition.getKey()).isNull());
}else if(condition.getCriteria().equalsIgnoreCase("isNotNull")) {
predicates.add(root.get(condition.getKey()).isNotNull());
}
}
}
return predicates;
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import com.iRecruit.security.AuthProvider;
import com.iRecruit.security.CustomUserDetailsService;
import com.iRecruit.security.JwtAuthenticationEntryPoint;
import com.iRecruit.security.JwtAuthenticationFilter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(
securedEnabled = true,
jsr250Enabled = true,
prePostEnabled = true
)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
CustomUserDetailsService customUserDetailsService;
@Autowired
private JwtAuthenticationEntryPoint unauthorizedHandler;
@Bean
public JwtAuthenticationFilter jwtAuthenticationFilter() {
return new JwtAuthenticationFilter();
}
public SecurityConfig() {
super(false);
}
@Override
public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
authenticationManagerBuilder
.userDetailsService(customUserDetailsService)
.passwordEncoder(passwordEncoder());
}
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return new ProviderManager(Arrays.asList((AuthenticationProvider) new AuthProvider()));
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.cors()
.and()
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(unauthorizedHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/",
"/favicon.ico",
"/**/*.png",
"/**/*.gif",
"/**/*.svg",
"/**/*.jpg",
"/**/*.html",
"/**/*.css",
"/**/*.js")
.permitAll()
.antMatchers("/api/v1/configurations/**","/api/v1/auth/signin/**","/api/v1/msamapping/**","/api/v1/mdbmapping/**","/api/v1/l1salbsmapping/**","/api/v1/ngpatongplCalculation/**","/api/v1/ngpaCalculation/**","/api/v1/l2salbsmapping/**","/api/v1/mpbmapping/**","/api/v1/leaderCalculation/**","/api/v1/fycmapping/**","/api/v1/auth/P100Login","/api/v1/auth/SendOTP","/v2/api-docs","/api/v1/auth/ValidateOTP", "/configuration/ui", "/swagger-resources/**", "/configuration/security", "/swagger-ui.html", "/webjars/**")
.permitAll()
.antMatchers("/api/userPhoto", "/api/user/checkEmailAvailability")
.permitAll()
//.antMatchers("/api/users/**")
// .permitAll()
.anyRequest()
.authenticated();
// Add our custom JWT security filter
http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}
}
\ No newline at end of file
package com.iRecruit.config;
import static springfox.documentation.builders.PathSelectors.regex;
import java.util.Collections;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.collect.Lists;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage("com.iRecruit")).paths(regex("/api.*"))
.build().apiInfo(apiInfo()).securitySchemes(Lists.newArrayList(apiKey()))
.securityContexts(Lists.newArrayList(securityContext()));
}
private ApiKey apiKey() {
return new ApiKey("JWT", "Authorization", "header");
}
private SecurityContext securityContext() {
return SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("/api/.*"))
.build();
}
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return Lists.newArrayList(new SecurityReference("JWT", authorizationScopes));
}
private ApiInfo apiInfo() {
return new ApiInfo("Tata AIA IRecruit Rest API", "IRecruit Rest API.", "API TOS", "Terms of service",
new Contact("ADMIN", "http://test.tech", "info@test.tech"), "License of API", "API license URL",
Collections.emptyList());
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.net.URI;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
public class Utility {
public static String generatorOTP(int length)
{
Random obj = new Random();
String OTP = "";
for (int i=0; i<length; i++)
{
OTP += (char)(obj.nextInt(10)+48);
}
return OTP;
}
public static ResponseEntity proxyPostRequest(String body,HttpServletRequest request,JSONObject newHeaders) throws Exception{
String requestUrl = request.getRequestURI();
//System.out.println(request.getServerName()+" "+request.getLocalAddr());
URI uri = new URI("http", null, request.getServerName(), request.getServerPort(), null, null, null);
uri = UriComponentsBuilder.fromUri(uri)
.path(requestUrl)
.query(request.getQueryString())
.build(true).toUri();
HttpHeaders headers = new HttpHeaders();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
if(newHeaders.has(headerName)) {
headers.set(headerName,(String)newHeaders.get(headerName));
newHeaders.remove(headerName);
}else {
headers.set(headerName, request.getHeader(headerName));
}
}
Iterator<String> keys = newHeaders.keys();
while(keys.hasNext()) {
String key = keys.next();
headers.set(key, (String)newHeaders.get(key));
}
HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
RestTemplate restTemplate = new RestTemplate();
try {
return restTemplate.exchange(uri,HttpMethod.valueOf(request.getMethod()), httpEntity, String.class);
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode())
.headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
}
package com.iRecruit.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
private final long MAX_AGE_SECS = 3600;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
.maxAge(MAX_AGE_SECS);
}
/*
@Autowired
TenantInterceptor tenantInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(tenantInterceptor);
}*/
}
package com.iRecruit.constant;
public enum BooleanType {
Y,N
}
\ No newline at end of file
package com.iRecruit.constant;
import java.util.List;
import javax.annotation.PostConstruct;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.service.ConfigurationsService;
import groovy.util.logging.Log;
@Service
public class DBConfig {
private static JSONObject configs;
private static final Logger LOG = LoggerFactory.getLogger(DBConfig.class);
@Autowired
ConfigurationsService configurationsService;
@PostConstruct
public void init() {
refreshConfig();
}
public void refreshConfig() {
List<Configurations> configurations = configurationsService.findAll();
configs = new JSONObject();
for(Configurations configuration : configurations) {
System.out.println("configurations");
System.out.println(configurations);
configs.put(configuration.getConfig(), configuration.getValue());
System.out.println("configs");
System.out.println(configs);
}
}
public String getValue(String key) {
System.out.println(configs);
return configs.getString(key);
}
public void setValue(String key,String value) {
if(configs.has(key)) {
configs.put(key,value);
}
}
}
\ No newline at end of file
package com.iRecruit.constant;
public class GlobalConstants {
public static final int ROLE_USER = 1;
public static final int ROLE_ADMIN = 2;
public static final String ROLE_ADMIN_STR = "Admin";
public static final int Mobile = 1;
public static final int Mail = 2;
public static final int MobileAndMail = 3;
public static final int OTPFailed = 4;
public static final int OTPSuccess = 5;
}
package com.iRecruit.constant;
import java.util.List;
import javax.annotation.PostConstruct;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.model.MsaMapping;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.L2slabsMappingService;
import com.iRecruit.modules.auth.service.MDBMappingService;
import com.iRecruit.modules.auth.service.MpbMappingService;
import com.iRecruit.modules.auth.service.MsaMappingService;
import com.iRecruit.modules.auth.service.TemplatesService;
@Service
public class LeaderCalcConfig {
private static JSONObject LeaderMpbMappingJSon;
private static JSONArray jarray;
private static JSONArray jarraympbconfig;
private static JSONArray jarrayfycconfig;
private static JSONArray jarrayl1slabsconfig;
private static JSONArray jarrayl2slabsconfig;
private static JSONObject LeaderFycMapping;
private static JSONObject LeaderL1SlabsMapping;
private static JSONObject LeaderL2SlabsMapping;
private static JSONArray jarrayfyc;
private static JSONArray jarrayMsa;
private static JSONObject LeaderMdbMapping;
private static JSONObject LeaderMsaMapping;
private static JSONArray jarrayl1slabs;
private static JSONArray jarrayMdbslabs;
private static JSONArray jarrayl2slabs;
private static JSONArray jarrayMDBconfig;
private static final Logger LOG = LoggerFactory.getLogger(LeaderCalcConfig.class);
@Autowired
MpbMappingService mpbMappingService;
@Autowired
FycMappingService fycMappingService;
@Autowired
L1slabsMappingService l1slabsMappingService;
@Autowired
L2slabsMappingService l2slabsMappingService;
@Autowired
MDBMappingService mdbMappingService;
@Autowired
MsaMappingService msaMappingService;
@PostConstruct
public void init() {
refreshConfig();
}
public void refreshConfig() {
List<MpbMapping> templatesmpb = mpbMappingService.findAll();
List<FycMapping> templatesfyc = fycMappingService.findAll();
List<L1slabsMapping> templatesl1slabs = l1slabsMappingService.findAll();
List<L2slabsMapping> templatesl2slabs = l2slabsMappingService.findAll();
List<MDBMapping> templatesmdb = mdbMappingService.findAll();
List<MsaMapping> templatesmsa = msaMappingService.findAll();
LeaderMpbMappingJSon = new JSONObject();
LeaderFycMapping = new JSONObject();
LeaderL1SlabsMapping = new JSONObject();
LeaderL2SlabsMapping = new JSONObject();
LeaderMdbMapping = new JSONObject();
LeaderMsaMapping = new JSONObject();
for (MpbMapping mpbMapping : templatesmpb) {
jarray = new JSONArray(templatesmpb);
}
for (FycMapping fycMapping : templatesfyc) {
jarrayfyc = new JSONArray(templatesfyc);
}
for (L1slabsMapping l1slabsMapping : templatesl1slabs) {
jarrayl1slabs = new JSONArray(templatesl1slabs);
}
for (L2slabsMapping l2slabsMapping : templatesl2slabs) {
jarrayl2slabs = new JSONArray(templatesl2slabs);
}
for (MDBMapping mdbMapping : templatesmdb) {
jarrayMdbslabs = new JSONArray(templatesmdb);
}
for (MsaMapping msaMapping : templatesmsa) {
jarrayMsa = new JSONArray(templatesmsa);
}
System.out.println("jarrayMsa");
System.out.println(jarrayMsa);
LeaderMpbMappingJSon.put("LeaderMpbMapping", jarray);
LeaderFycMapping.put("LeaderFycMapping", jarrayfyc);
LeaderL1SlabsMapping.put("LeaderL1SlabsMapping", jarrayl1slabs);
LeaderL2SlabsMapping.put("LeaderL2SlabsMapping", jarrayl2slabs);
LeaderMdbMapping.put("MPBMapping", jarrayMdbslabs);
jarraympbconfig = new JSONArray();
jarrayfycconfig = new JSONArray();
jarrayl1slabsconfig = new JSONArray();
jarrayl2slabsconfig = new JSONArray();
jarrayMDBconfig = new JSONArray();
jarraympbconfig = LeaderMpbMappingJSon.getJSONArray("LeaderMpbMapping");
jarrayfycconfig = LeaderFycMapping.getJSONArray("LeaderFycMapping");
jarrayl1slabsconfig = LeaderL1SlabsMapping.getJSONArray("LeaderL1SlabsMapping");
jarrayl2slabsconfig = LeaderL2SlabsMapping.getJSONArray("LeaderL2SlabsMapping");
jarrayMDBconfig = LeaderMdbMapping.getJSONArray("MPBMapping");
System.out.println(jarraympbconfig);
System.out.println(jarrayfycconfig);
System.out.println(jarrayl1slabsconfig);
System.out.println(jarrayMDBconfig);
}
public JSONArray getValue(String key) {
if (key.equalsIgnoreCase("mpb")) {
return jarraympbconfig;
} else if (key.equalsIgnoreCase("fyc")) {
return jarrayfycconfig;
}
else if (key.equalsIgnoreCase("l1slabs")) {
return jarrayl1slabsconfig;
}
else if (key.equalsIgnoreCase("l2slabs")) {
return jarrayl2slabsconfig;
}
else if (key.equalsIgnoreCase("mdb")) {
return jarrayMDBconfig;
}
else if (key.equalsIgnoreCase("msa")) {
return jarrayMsa;
}else {
return null;
}
}
}
package com.iRecruit.constant;
public enum PaymentMode {
CREDIT,DEBIT,DISCOUNT
}
\ No newline at end of file
package com.iRecruit.constant;
public enum PaymentType {
CASH,CHECK,ONLINE,PAYTM,PHONEPAY,DD
}
\ No newline at end of file
package com.iRecruit.constant;
public enum PenaltyType {
FixedAmount,FixedRate
}
\ No newline at end of file
package com.iRecruit.constant;
public enum QuestionType {
RADIO,CHECKBOX,TEXT,DROPDOWN
}
\ No newline at end of file
package com.iRecruit.constant;
public enum RequestType {
BOOKING,MEETING,PROBLEM,GENERAL
}
\ No newline at end of file
package com.iRecruit.constant;
public enum RolesConstant {
LEADER,PANALIST,FINAL_INTERVIEWER,REMO,BRANCH_MANAGER
}
\ No newline at end of file
package com.iRecruit.constant;
public enum SchedulerType {
HOURLY,DAILY,WEEKLY,MONTHLY,YEARLY,ONETIME
}
\ No newline at end of file
package com.iRecruit.constant;
public enum Stages {
TBC,LIP,LPEDP,LCDP,LFDP,LEDP,LPRDP,LADP,LDUP,LP100P,LPTP,LPP,LDOPSP,PAIP,PAIW,FIIP,FIIW,REDP,URNP,TRAINP,EXAMP,AGP,LREJ,RREJ,PAREJ,FIREJ,BMREJ,CPP
}
\ No newline at end of file
package com.iRecruit.constant;
public enum Status {
INIT,LOCK,DISABLED,ACTIVE,INACTIVE,DELETED,SENT,SUCCESS
}
\ No newline at end of file
package com.iRecruit.constant;
public class StatusCode {
public static final int INVALID_USER = 100;
public static final int INVALID_CREDENTIAL = 101;
public static final int RESOURCE_NOT_FOUND = 102;
public static final int RESOURCE_EXIST = 103;
public static final int INVALID_ARGUMENT = 104;
public static final int UNEXPECTED_ERROR = 105;
public static final int DEPENDANCY_EXIST = 106;
public static final int VOTING_NOT_STARTED = 107;
public static final int INVALID_ARGUMENT1 = 103;
public static final int INVALID_ARGUMENT11 = 103;
}
\ No newline at end of file
package com.iRecruit.constant;
import java.util.List;
import javax.annotation.PostConstruct;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.service.TemplatesService;
@Service
public class TemplateConfig {
private static JSONObject configs;
private static final Logger LOG = LoggerFactory.getLogger(TemplateConfig.class);
@Autowired
TemplatesService templatesService;
@PostConstruct
public void init() {
refreshConfig();
}
public void refreshConfig() {
List<Templates> templates = templatesService.findAll();
configs = new JSONObject();
for(Templates configuration : templates) {
configs.put(configuration.getConfig(), configuration.getValue());
}
}
public String getValue(String key) {
return configs.getString(key);
}
public void setValue(String key,String value) {
if(configs.has(key)) {
configs.put(key,value);
}
}
}
\ No newline at end of file
package com.iRecruit.constant;
public enum TemplateType {
MAIL,PDF,SMS,NOTIFICATION
}
\ No newline at end of file
package com.iRecruit.constant;
public enum VehicalType {
CAR,BYKE,SCOOTER,BYCYCLE
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class AppException extends RuntimeException {
public AppException(String message) {
super(message);
}
public AppException(String message, Throwable cause) {
super(message, cause);
}
}
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class FileNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
public FileNotFoundException(String message) {
super(message);
}
public FileNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package com.iRecruit.exception;
public class FileStorageException extends RuntimeException {
private static final long serialVersionUID = 1L;
public FileStorageException(String message) {
super(message);
}
public FileStorageException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import lombok.Getter;
import lombok.Setter;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
@Getter
@Setter
public class InvalidArgument extends RuntimeException {
private String message;
public InvalidArgument( String message) {
super(String.format("%s",message));
this.message = message;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class InvalidOTPOrRef extends RuntimeException {
private String userID;
private String OTP;
public InvalidOTPOrRef( String userId, String OTP) {
super(String.format("%s is not valid OTP for %s", OTP, userId));
this.userID = userId;
this.OTP = OTP;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class OTPExpire extends RuntimeException {
private String userID;
private String OTP;
public OTPExpire( String userId, String OTP) {
super(String.format("%s OTP is expire for %s", OTP, userId));
this.userID = userId;
this.OTP = OTP;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class ResourceAlreadyExist extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public ResourceAlreadyExist( String resourceName, String fieldName, Object fieldValue) {
super(String.format("%s not found with %s : '%s'", resourceName, fieldName, fieldValue));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
}
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public ResourceNotFoundException( String resourceName, String fieldName, Object fieldValue) {
super(String.format("%s not found with %s : '%s'", resourceName, fieldName, fieldValue));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class TenantNotSelectedException extends RuntimeException {
private static final long serialVersionUID = 1L;
public TenantNotSelectedException(String message) {
super(message);
}
public TenantNotSelectedException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
public class WrongUsernamePassword extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public WrongUsernamePassword( String resourceName, String fieldName, Object fieldValue) {
super(String.format("%s not found with %s : '%s'", resourceName, fieldName, fieldValue));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
}
\ No newline at end of file
package com.iRecruit.firebase;
import java.io.IOException;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
@Service
public class FCMInitializer {
@Value("${app.firebase-configuration-file}")
private String firebaseConfigPath;
Logger logger = LoggerFactory.getLogger(FCMInitializer.class);
@PostConstruct
public void initialize() {
try {
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(new ClassPathResource(firebaseConfigPath).getInputStream())).build();
if (FirebaseApp.getApps().isEmpty()) {
FirebaseApp.initializeApp(options);
logger.info("Firebase application has been initialized");
}
} catch (IOException e) {
logger.error(e.getMessage());
}
}
}
package com.iRecruit.firebase;
import java.time.Duration;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.google.firebase.messaging.AndroidConfig;
import com.google.firebase.messaging.AndroidNotification;
import com.google.firebase.messaging.ApnsConfig;
import com.google.firebase.messaging.Aps;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.Message;
import com.google.firebase.messaging.Notification;
import com.iRecruit.modules.auth.model.PushNotificationRequest;
@Service
public class FCMService {
private Logger logger = LoggerFactory.getLogger(FCMService.class);
public void sendMessage(Map<String, String> data, PushNotificationRequest request)
throws InterruptedException, ExecutionException {
Message message = getPreconfiguredMessageWithData(data, request);
String response = sendAndGetResponse(message);
logger.info("Sent message with data. Topic: " + request.getTopic() + ", " + response);
}
public void sendMessageWithoutData(PushNotificationRequest request)
throws InterruptedException, ExecutionException {
Message message = getPreconfiguredMessageWithoutData(request);
String response = sendAndGetResponse(message);
logger.info("Sent message without data. Topic: " + request.getTopic() + ", " + response);
}
public void sendMessageToToken(PushNotificationRequest request)
throws InterruptedException, ExecutionException {
Message message = getPreconfiguredMessageToToken(request);
String response = sendAndGetResponse(message);
logger.info("Sent message to token. Device token: " + request.getToken() + ", " + response);
}
private String sendAndGetResponse(Message message) throws InterruptedException, ExecutionException {
return FirebaseMessaging.getInstance().sendAsync(message).get();
}
private AndroidConfig getAndroidConfig(String topic) {
return AndroidConfig.builder()
.setTtl(Duration.ofMinutes(2).toMillis()).setCollapseKey(topic)
.setPriority(AndroidConfig.Priority.HIGH)
.setNotification(AndroidNotification.builder().setSound(NotificationParameter.SOUND.getValue())
.setColor(NotificationParameter.COLOR.getValue()).setTag(topic).build()).build();
}
private ApnsConfig getApnsConfig(String topic) {
return ApnsConfig.builder()
.setAps(Aps.builder().setCategory(topic).setThreadId(topic).build()).build();
}
private Message getPreconfiguredMessageToToken(PushNotificationRequest request) {
return getPreconfiguredMessageBuilder(request).setToken(request.getToken())
.build();
}
private Message getPreconfiguredMessageWithoutData(PushNotificationRequest request) {
return getPreconfiguredMessageBuilder(request).setTopic(request.getTopic())
.build();
}
private Message getPreconfiguredMessageWithData(Map<String, String> data, PushNotificationRequest request) {
return getPreconfiguredMessageBuilder(request).putAllData(data).setTopic(request.getTopic())
.build();
}
private Message.Builder getPreconfiguredMessageBuilder(PushNotificationRequest request) {
AndroidConfig androidConfig = getAndroidConfig(request.getTopic());
ApnsConfig apnsConfig = getApnsConfig(request.getTopic());
return Message.builder()
.setApnsConfig(apnsConfig).setAndroidConfig(androidConfig).setNotification(
new Notification(request.getTitle(), request.getMessage()));
}
}
package com.iRecruit.firebase;
public enum NotificationParameter {
SOUND("default"),
COLOR("#FFFF00");
private String value;
NotificationParameter(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
}
package com.iRecruit.modules.auth.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.P100LoginResponse;
import com.iRecruit.modules.auth.payload.UserDto;
import com.iRecruit.modules.auth.payload.UserOTPDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.payload.request.JwtAuthenticationResponse;
import com.iRecruit.modules.auth.payload.request.LoginRequest;
import com.iRecruit.modules.auth.payload.request.OTPRequest;
import com.iRecruit.modules.auth.payload.request.OTPValidateRequest;
import com.iRecruit.modules.auth.payload.request.P100LoginRequest;
import com.iRecruit.modules.auth.service.UserService;
import com.iRecruit.security.AuthProvider;
import com.iRecruit.security.JwtTokenProvider;
import com.iRecruit.security.UserPrincipal;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1/auth")
@Api(description = "Set of endpoints for Creating, Retrieving, Updating and Deleting of Persons.")
public class AuthController {
@Autowired
AuthProvider authenticationManager;
@Autowired
UserService userService;
@Autowired
JwtTokenProvider tokenProvider;
private static final Logger LOG = LoggerFactory.getLogger(AuthController.class);
@PostMapping("/signin")
@ApiOperation("Sign-in user by userid and password")
@AuditLogs(service="login",isResponse=true)
public ResponseEntity<ApiResponse> authenticateUser (@RequestBody LoginRequest loginRequest,
HttpServletRequest request, HttpServletResponse response) {
//DataSourceContextHolder.setDataSourceName("iRecruitSchemaDataSource");
Map<String, Object> returnUserObject = new HashMap<>();
String jwt;
try {
UsernamePasswordAuthenticationToken authenticationObj = new UsernamePasswordAuthenticationToken(loginRequest.getUsername(), loginRequest.getPassword());
authenticationObj.setDetails(loginRequest);
Authentication authentication = authenticationManager.authenticate(authenticationObj);
SecurityContextHolder.getContext().setAuthentication(authentication);
//if (authentication.getAuthorities().stream().anyMatch(r -> r.getAuthority().equals(loginRequest.getRoleType()))) {
jwt = tokenProvider.generateToken(authentication);
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
User user = userService.findById(userPrincipal.getUsername());
if(loginRequest.getNotificationId() != null) {
user.setNotificationId(loginRequest.getNotificationId());
userService.save(user);
}
returnUserObject.put("userDetail", new UserDto(user));
returnUserObject.put("tokenDetail", new JwtAuthenticationResponse(jwt));
LOG.info("Login Success");
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "LOGIN_SUCCESS", returnUserObject), HttpStatus.OK);
} catch (ResourceNotFoundException e) {
//LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Tenant not found", null), HttpStatus.UNAUTHORIZED);
} catch (UsernameNotFoundException e) {
//LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Username not found", null), HttpStatus.UNAUTHORIZED);
}catch (BadCredentialsException e) {
LOG.error("Wrong password: ");
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_CREDENTIAL, true, "Wrong username or password", null), HttpStatus.UNAUTHORIZED);
}catch (JSONException e) {
System.out.println(e);
LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "JSON_PROCESSING_EXCEPTION", null), HttpStatus.UNAUTHORIZED);
}catch (Exception e) {
System.out.println(e);
LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "JSON_PROCESSING_EXCEPTION", null), HttpStatus.UNAUTHORIZED);
}
}
/*
* @PostMapping("/P100Login")
*
* @ApiOperation("P100 Login")
*
* @AuditLogs(isRequest = true, isResponse = true, service = "P100Login") public
* ResponseEntity<?> P100Login(@RequestBody P100LoginRequest p100LoginRequest) {
* try { P100LoginResponse p100LoginResponse =
* p100LoginService.p100Login(p100LoginRequest); return new ResponseEntity(new
* ApiResponse(HttpStatus.OK.value(), true, "P100 Login",
* p100LoginResponse),HttpStatus.OK); }catch (Exception e) { return new
* ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR,
* true,"Error in P100 Login", null), HttpStatus.UNAUTHORIZED); } }
*/
/*@PostMapping("/SendOTP")
@ApiOperation("Send OTP")
@AuditLogs(isRequest = true, isResponse = true, service = "SendOTP")
public ResponseEntity<?> sendOTP(@RequestBody OTPRequest otpRequest) {
try {
UserOTPDto userOTPDto = userOTPService.create(otpRequest.getLeadId(),otpRequest.getMobileNo(),otpRequest.getEmailId(),otpRequest.getServiceName() );
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "P100 Login", userOTPDto),HttpStatus.OK);
}catch (Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true,"Error while OTP sending", null), HttpStatus.UNAUTHORIZED);
}
}
@PostMapping("/ValidateOTP")
@ApiOperation("Validate OTP")
@AuditLogs(isRequest = true, isResponse = true, service = "ValidateOTP")
public ResponseEntity<?> validateOTP(@RequestBody OTPValidateRequest otpValidateRequest) {
try {
UserOTPDto userOTPDto = userOTPService.validateOTP(otpValidateRequest.getId(),otpValidateRequest.getLeadId(),otpValidateRequest.getOtp() );
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "P100 Login", userOTPDto),HttpStatus.OK);
}catch (Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true,"Error while OTP sending", null), HttpStatus.UNAUTHORIZED);
}
}*/
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.payload.ConfigurationsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.ConfigurationsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Configurations management API")
public class ConfigurationsController {
@Autowired
ConfigurationsService configurationsService;
@Autowired
DBConfig DBConfig;
@PostMapping("/configurations/get")
@ApiOperation("Get all configurations list")
@AuditLogs(isRequest = true, isResponse = true,service="Get Config")
public ResponseEntity<?> getAllConfigurations( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations List", configurationsService.findAll().stream().map(configurations -> new ConfigurationsDto(configurations))), HttpStatus.OK);
}
@PostMapping("/configurations/refresh")
@ApiOperation("to Refresh all configurations list")
@AuditLogs(isRequest = true, isResponse = true,service="Refresh Config")
public ResponseEntity<?> refreshConfigurations( ){
DBConfig.refreshConfig();
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations has been refreshed", null), HttpStatus.OK);
}
@PostMapping("/configurations/create")
@ApiOperation("Create configurations")
@AuditLogs(isRequest = true, isResponse = true,service="Create Config")
public ResponseEntity<?> createConfigurations(@RequestBody ConfigurationsDto configurations) {
System.out.println("in configuration");
Configurations config = null;
try {
config = configurationsService.save(configurations,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Configurations Not found", configurations.getKey()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Configurations creation failed", configurations.getKey()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations added successfully", new ConfigurationsDto(config)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/configurations/update")
@ApiOperation("Update configurations")
@AuditLogs(isRequest = true, isResponse = true,service="Update Config")
public ResponseEntity<?> updateConfigurations(@RequestBody ConfigurationsDto configurations) {
try {
Configurations newUSer = configurationsService.save(configurations,false);
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations updated successfully", new ConfigurationsDto(newUSer)), HttpStatus.OK);
}catch(DataIntegrityViolationException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "Configurations data already exist", null), HttpStatus.ALREADY_REPORTED);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_USER, true, "Configurations record not found", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Configurations updation failed", null), HttpStatus.BAD_REQUEST);
}
//return new ResponseEntity(new ApiResponse(StatusCode.DEPENDANCY_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.payload.ConfigurationsDto;
import com.iRecruit.modules.auth.payload.fycDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.ConfigurationsService;
import com.iRecruit.modules.auth.service.FycMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Configurations management API")
public class FycMappingController {
@Autowired
FycMappingService fycMappingService;
@Autowired
DBConfig DBConfig;
@PostMapping("/fycmapping/get")
@ApiOperation("Get all fyc mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get fyc")
public ResponseEntity<?> getAllFycMappings(){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Fyc List", fycMappingService.findAll().stream().map(FycMapping -> new fycDto(FycMapping))), HttpStatus.OK);
}
@PostMapping("/fycmapping/create")
@ApiOperation("Create fycmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create fycmapping")
public ResponseEntity<?> createFycmapping(@RequestBody fycDto fycMapping) {
System.out.println("in fyc contrroler");
System.out.println("in fycmapping");
FycMapping fyc = null;
try {
fyc = fycMappingService.save(fycMapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fyc.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fyc.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations added successfully", new fycDto(fyc)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/fycmapping/update")
@ApiOperation("update fycmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create fycmapping")
public ResponseEntity<?> updateFycmapping(@RequestBody fycDto fycMapping) {
System.out.println("in fyc contrroler");
System.out.println("in fycmapping");
FycMapping fycupdate = null;
try {
fycupdate = fycMappingService.save(fycMapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fycupdate.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fycupdate.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations added successfully", new fycDto(fycupdate)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "L1 Slabs maping management API")
public class L1slabsMappingController {
@Autowired
L1slabsMappingService l1slabsMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/l1salbsmapping/get")
@ApiOperation("Get all l1slabs mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get l1slabs")
public ResponseEntity<?> getAllL1slabsMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l1 slabs List", l1slabsMappingService.findAll().stream().map(L1slabsMapping -> new L1slabsDto(L1slabsMapping))), HttpStatus.OK);
}
@PostMapping("/l1salbsmapping/create")
@ApiOperation("Create l1salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l1salbsmapping")
public ResponseEntity<?> createL1slabsmapping(@RequestBody L1slabsDto l1slabsmapping) {
System.out.println("in l1salbsmapping contrroler");
System.out.println("in l1salbsmapping");
L1slabsMapping l1 = null;
try {
l1 = l1slabsMappingService.save(l1slabsmapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l1mapping Not found", l1.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l1mapping creation failed", l1.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l1mapping added successfully", new L1slabsDto(l1)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/l1salbsmapping/update")
@ApiOperation("update l1salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l1salbsmapping")
public ResponseEntity<?> updateL1slabsmapping(@RequestBody L1slabsDto l1slabsmapping) {
System.out.println("in l1salbsmapping contrroler");
System.out.println("in l1salbsmapping");
L1slabsMapping l1 = null;
try {
l1 = l1slabsMappingService.save(l1slabsmapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l1mapping Not found", l1.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l1mapping creation failed", l1.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l1mapping added successfully", new L1slabsDto(l1)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L2slabsMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "L2 Slabs maping management API")
public class L2slabsMappingController {
@Autowired
L2slabsMappingService l2slabsMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/l2salbsmapping/get")
@ApiOperation("Get all l2slabs mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get l2slabs")
public ResponseEntity<?> getAllL1slabsMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2 slabs List", l2slabsMappingService.findAll().stream().map(L2slabsMapping -> new L2slabsDto(L2slabsMapping))), HttpStatus.OK);
}
@PostMapping("/l2salbsmapping/create")
@ApiOperation("Create l2salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l2salbsmapping")
public ResponseEntity<?> createL1slabsmapping(@RequestBody L2slabsDto l2slabsmapping) {
System.out.println("in l2salbsmapping contrroler");
System.out.println("in l2salbsmapping");
L2slabsMapping l2 = null;
try {
l2 = l2slabsMappingService.save(l2slabsmapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l2mapping Not found", l2.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l2mapping creation failed", l2.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new L2slabsDto(l2)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/l2salbsmapping/update")
@ApiOperation("update l2salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l2salbsmapping")
public ResponseEntity<?> updateL1slabsmapping(@RequestBody L2slabsDto l2slabsmapping) {
System.out.println("in l2salbsmapping contrroler");
System.out.println("in l2salbsmapping");
L2slabsMapping l2 = null;
try {
l2 = l2slabsMappingService.save(l2slabsmapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l2mapping Not found", l2.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l2mapping updation failed", l2.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new L2slabsDto(l2)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import java.util.Map;
import javax.validation.Valid;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.payload.request.Apiresponse1;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Leader Calc API")
public class LeaderCalc {
@Autowired
LeaderCalcService leaderCalcService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping(value = "/leaderCalculation", headers = "Accept=application/json")
@ApiOperation("Create leadercalc")
// @AuditLogs(isRequest = true, isResponse = true,service="Create leadercalc")
public ResponseEntity<?> Calculate(@RequestBody Map<String, Object> lookupRequestObject) throws JsonProcessingException {
System.out.println("in fyc contrroler");
System.out.println("in fycmapping");
ObjectMapper mapper = new ObjectMapper();
String data = mapper.writeValueAsString(lookupRequestObject);
JSONObject calc = null;
try {
System.out.println("in try");
calc = leaderCalcService.calculate(data);
System.out.println("after operation calc");
System.out.println(calc);
}catch(ResourceNotFoundException e) {
System.out.println(e);
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "calculation failed", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
System.out.println(e);
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "calculation failed", null), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "calculation done successfully", calc.toString()), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.payload.MDBDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.MDBMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "MDB maping management API")
public class MDBMappingController {
@Autowired
MDBMappingService mdbMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/mdbmapping/get")
@ApiOperation("Get all mdb mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get mdb")
public ResponseEntity<?> getAllMDBMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "MDB List", mdbMappingService.findAll().stream().map(MDBMapping -> new MDBDto(MDBMapping))), HttpStatus.OK);
}
@PostMapping("/mdbmapping/create")
@ApiOperation("Create mdbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create mdbmapping")
public ResponseEntity<?> createmdbsmapping(@RequestBody MDBDto mdbmapping) {
System.out.println("in mdb contrroler");
System.out.println("in mdbmapping");
MDBMapping mdb = null;
try {
mdb = mdbMappingService.save(mdbmapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mdbmapping Not found", mdb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mdbmapping creation failed", mdb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new MDBDto(mdb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/mdbmapping/update")
@ApiOperation("update mdbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create mdbmapping")
public ResponseEntity<?> updatemdbsmapping(@RequestBody MDBDto mdbmapping) {
System.out.println("in mdb contrroler");
System.out.println("in mdbmapping");
MDBMapping mdb = null;
try {
mdb = mdbMappingService.save(mdbmapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mdbmapping Not found", mdb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mdbmapping updation failed", mdb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new MDBDto(mdb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.payload.fycDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.MpbMappingService;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "MPB maping management API")
public class MpbMappingController {
@Autowired
MpbMappingService mpbMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/mpbmapping/get")
@ApiOperation("Get all mpb mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get mpb")
public ResponseEntity<?> getAllMpbMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Mpb List", mpbMappingService.findAll().stream().map(MpbMapping -> new mpbDto(MpbMapping))), HttpStatus.OK);
}
@PostMapping("/mpbmapping/create")
@ApiOperation("Create mpbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create mpbmapping")
public ResponseEntity<?> createMpbmapping(@RequestBody mpbDto mpbMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MpbMapping mpb = null;
try {
mpb = mpbMappingService.save(mpbMapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mpbmapping Not found", mpb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mpbmapping creation failed", mpb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "mpb mapping added successfully", new mpbDto(mpb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/mpbmapping/update")
@ApiOperation("update mpbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="update mpbmapping")
public ResponseEntity<?> updateMpbmapping(@RequestBody mpbDto mpbMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MpbMapping mpb = null;
try {
mpb = mpbMappingService.save(mpbMapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mpbmapping Not found", mpb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mpbmapping creation failed", mpb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "mpb mapping updated successfully", new mpbDto(mpb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.model.MsaMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.payload.MDBDto;
import com.iRecruit.modules.auth.payload.MsaDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.MDBMappingService;
import com.iRecruit.modules.auth.service.MsaMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "MSA maping management API")
public class MsaMappingController {
@Autowired
MsaMappingService msaMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/msamapping/get")
@ApiOperation("Get all msa mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get msa")
public ResponseEntity<?> getAllMDBMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "MSA List", msaMappingService.findAll().stream().map(MSAMapping -> new MsaDto(MSAMapping))), HttpStatus.OK);
}
@PostMapping("/msamapping/create")
@ApiOperation("Create msamapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create msamapping")
public ResponseEntity<?> createMsamapping(@RequestBody MsaDto msaMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MsaMapping msa = null;
try {
msa = msaMappingService.save(msaMapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "msamapping Not found", msa.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "msamapping creation failed", msa.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "msa mapping added successfully", new MsaDto(msa)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/msamapping/update")
@ApiOperation("Create msamapping")
@AuditLogs(isRequest = true, isResponse = true,service="update msamapping")
public ResponseEntity<?>updateMsamapping(@RequestBody MsaDto msaMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MsaMapping msa = null;
try {
msa = msaMappingService.save(msaMapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "msamapping Not found", msa.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "msamapping updation failed", msa.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "msa mapping updated successfully", new MsaDto(msa)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.modules.auth.service.NGPACalcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "NGPA Calc API")
public class NGPACalc {
@Autowired
NGPACalcService nGPACalcService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping(value = "/ngpaCalculation", headers = "Accept=application/json")
@ApiOperation("Create ngpacalc")
// @AuditLogs(isRequest = true, isResponse = true,service="Create leadercalc")
@JsonSerialize
public ResponseEntity<?> CalculateNGPA(@RequestBody Map<String, Object> lookupRequestObject) throws JsonProcessingException {
System.out.println("in ngpa contrroler");
ObjectMapper mapper = new ObjectMapper();
String data = mapper.writeValueAsString(lookupRequestObject);
JSONObject requestJSON = new JSONObject(data);
HashMap<String,Object> result = null;
JSONObject calc = null;
try {
System.out.println("in try");
calc = nGPACalcService.prepareAllFormula(requestJSON);
System.out.println("after operation calc");
System.out.println(calc);
result =new HashMap<String, Object>();
result.put("response", calc);
System.out.println(result);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
// return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fyc.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
//return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fyc.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "calculation done successfully", calc.toString()), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.modules.auth.service.NGPAtoNGPLCalcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "NGPL Calc API")
public class NGPAtoNGPLCalc {
@Autowired
NGPAtoNGPLCalcService nGPAtoNGPLCalcService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping(value = "/ngpatongplCalculation", headers = "Accept=application/json")
@ApiOperation("Create ngplcalc")
// @AuditLogs(isRequest = true, isResponse = true,service="Create leadercalc")
@JsonSerialize
public ResponseEntity<?> CalculateNGPL(@RequestBody Map<String, Object> lookupRequestObject) throws JsonProcessingException {
System.out.println("in ngpl contrroler");
ObjectMapper mapper = new ObjectMapper();
String data = mapper.writeValueAsString(lookupRequestObject);
JSONObject requestJSON = new JSONObject(data);
HashMap<String,Object> result = null;
JSONObject calc = null;
try {
System.out.println("in try");
calc = nGPAtoNGPLCalcService.prepareAllFormula(requestJSON);
System.out.println("after operation calc");
System.out.println(calc);
result =new HashMap<String, Object>();
result.put("response", calc);
System.out.println(result);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
// return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fyc.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
//return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fyc.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "calculation done successfully", calc.toString()), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.payload.TemplatesDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.TemplatesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Templates management API")
public class TemplatesController {
@Autowired
TemplatesService templatesService;
@Autowired
DBConfig DBConfig;
@PostMapping("/templates/get")
@ApiOperation("Get all templates list")
@AuditLogs(isRequest = true, isResponse = true,service="Get Template")
public ResponseEntity<?> getAllTemplates( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates List", templatesService.findAll().stream().map(templates -> new TemplatesDto(templates))), HttpStatus.OK);
}
@PostMapping("/templates/refresh")
@ApiOperation("to Refresh all templates list")
@AuditLogs(isRequest = true, isResponse = true,service="Refresh Template")
public ResponseEntity<?> refreshTemplates( ){
DBConfig.refreshConfig();
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates has been refreshed", null), HttpStatus.OK);
}
@PostMapping("/templates/create")
@ApiOperation("Create templates")
@AuditLogs(isRequest = true, isResponse = true,service="Create Template")
public ResponseEntity<?> createTemplates(@RequestBody TemplatesDto templates) {
Templates template = null;
try {
template = templatesService.save(templates,true);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Templates Not found", templates.getKey()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Templates creation failed", templates.getKey()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates added successfully", new TemplatesDto(template)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/templates/update")
@ApiOperation("Update templates")
@AuditLogs(isRequest = true, isResponse = true,service="Update Template")
public ResponseEntity<?> updateTemplates(@RequestBody TemplatesDto templates) {
try {
Templates newUSer = templatesService.save(templates,false);
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates updated successfully", new TemplatesDto(newUSer)), HttpStatus.OK);
}catch(DataIntegrityViolationException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "Templates data already exist", null), HttpStatus.ALREADY_REPORTED);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_USER, true, "Templates record not found", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Templates updation failed", null), HttpStatus.BAD_REQUEST);
}
//return new ResponseEntity(new ApiResponse(StatusCode.DEPENDANCY_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.UserDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
//@RestController
@RequestMapping("/api/v1")
@Api(description = "User management API")
public class UserController {
@Autowired
UserService userService;
@GetMapping("/user")
@ApiOperation("Get all user list with pagination")
@AuditLogs
public ResponseEntity<?> getAllUsers( @RequestParam(defaultValue = "0") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(defaultValue = "id") String sortBy) {
Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy));
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "User List", userService.findAll(paging).map(user -> new UserDto(user)).getContent()), HttpStatus.OK);
}
@PostMapping("/user")
@ApiOperation("Create user")
public ResponseEntity<?> createUser(@RequestBody UserDto user) {
User newUSer = null;
try {
if(user.getId() == null || userService.findById(user.getId()) != null) {
newUSer = userService.save(user);
}
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "User Not found", user.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "User creation failed", user.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "User added successfully", new UserDto(newUSer)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PutMapping("/user")
@ApiOperation("Update user")
public ResponseEntity<?> updateUser(@RequestBody UserDto user) {
try {
User newUSer = userService.save(user);
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "User updated successfully", new UserDto(newUSer)), HttpStatus.OK);
}catch(DataIntegrityViolationException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "User data already exist", null), HttpStatus.ALREADY_REPORTED);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_USER, true, "User record not found", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "User updation failed", null), HttpStatus.BAD_REQUEST);
}
//return new ResponseEntity(new ApiResponse(StatusCode.DEPENDANCY_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.model;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "tbl_audit_log")
@Getter
@Setter
@AllArgsConstructor
public class AuditLogs {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
private String service;
private String sourceIp;
private String deviceInfo;
private String browserInfo;
private String username;
private String OS;
private int statusCode;
private String errorMsg;
private Long timeTaken;
private String requestObj;
private String responseObj;
private Date createdDate;
public AuditLogs(AuditLogsDto audtiLogsDTO) {
this.id = audtiLogsDTO.getId();
this.service = audtiLogsDTO.getService();
this.sourceIp = audtiLogsDTO.getSourceIp();
this.username = audtiLogsDTO.getUsername();
this.statusCode = audtiLogsDTO.getStatus();
this.errorMsg = audtiLogsDTO.getErrorMsg();
this.timeTaken = audtiLogsDTO.getTimeTaken();
this.requestObj = audtiLogsDTO.getRequestObj();
this.responseObj = audtiLogsDTO.getResponseObj();
this.deviceInfo = audtiLogsDTO.getDeviceInfo();
this.browserInfo = audtiLogsDTO.getBrowserInfo();
this.OS = audtiLogsDTO.getOS();
this.createdDate = new Date();
}
}
package com.iRecruit.modules.auth.model;
import static javax.persistence.TemporalType.TIMESTAMP;
import java.util.Date;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import lombok.Getter;
import lombok.Setter;
@SuppressWarnings("hiding")
@Setter
@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class Auditable<String> {
@CreatedBy
protected String createdUserId;
@CreatedDate
@Temporal(TIMESTAMP)
protected Date createdTs;
@LastModifiedBy
protected String updatedUserId;
@LastModifiedDate
@Temporal(TIMESTAMP)
protected Date updatedTs;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_configs")
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class Configurations{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotBlank
@Column(length=50)
private String config;
@NotBlank
@Column(length=500)
private String value;
private String description;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_fyc_mapping")
@Setter
@Getter
public class FycMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int maxval;
@NotNull
@Column(length=500)
private int minval;
private int per;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_l1_slabs_mapping")
@Setter
@Getter
public class L1slabsMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int minval;
@NotNull
@Column(length=500)
private int maxval;
private int BA;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_l2_slabs_mapping")
@Setter
@Getter
public class L2slabsMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int minval;
@NotNull
@Column(length=500)
private int maxval;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_mdb_mapping")
@Setter
@Getter
public class MDBMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int monthly_ep_18;
@NotNull
@Column(length=500)
private int monthly_ep_36;
private int monthly_ep_72;
private int monthly_ep_144;
private int MDB;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_mpb_mapping")
@Setter
@Getter
public class MpbMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int mapping_DT_minimum_fyc;
@NotNull
@Column(length=500)
private int DT;
private int L1;
private int L2;
private String Designation;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_msa_mapping")
@Setter
@Getter
public class MsaMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
private int MSA_1;
private int MSA_2;
private int MSA_3;
private int MSA_4;
}
package com.iRecruit.modules.auth.model;
public class PushNotificationRequest {
private String title;
private String message;
private String topic;
private String token;
public PushNotificationRequest() {
}
public PushNotificationRequest(String title, String messageBody, String topicName) {
this.title = title;
this.message = messageBody;
this.topic = topicName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
package com.iRecruit.modules.auth.model;
public class PushNotificationResponse {
private int status;
private String message;
public PushNotificationResponse() {
}
public PushNotificationResponse(int status, String message) {
this.status = status;
this.message = message;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.iRecruit.constant.TemplateType;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "tbl_templates")
@Setter
@Getter
public class Templates{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotBlank
@Column(length=50)
private String config;
@NotBlank
@Lob
private String value;
@Enumerated(EnumType.STRING)
private TemplateType type;
}
package com.iRecruit.modules.auth.model;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "naaf_user_detail")
@Setter
@Getter
@EntityListeners(AuditingEntityListener.class)
public class User {
@Id
@Column(length=10)
private String id;
@Column(length=11)
private String userId;
@Column(length=200)
private String firstName;
@Column(length=200)
private String lastName;
@Column(length=30)
private String userRole;
@Column(length=100)
private String emailId;
@Column(length=40)
private String mobileNo;
@Column(length=11)
private String managerUserId;
@Column(length=11)
private String adoaId;
@Column(length=11)
private String doaId;
@Column(length=1)
private String isActive;
@Column(length=8)
private Timestamp createDate;
@Column(length=8)
private Timestamp modifiedDate;
@Column(length=11)
private String level1NtId;
@Column(length=11)
private String level5NtId;
@Column(length=3)
private String level1DesignationCode;
@Column(length=5)
private String branchCode;
@Column(length=100)
private String officeName;
@Column(length=63)
private String userRole1;
@Column(length=30)
private String branchCdLevel1;
@Column(length=63)
private String userRole2;
@Column(length=30)
private String level2DesignationC0de;
@Column(length=30)
private String branchCdLevel2;
@Column(length=63)
private String userRole3;
@Column(length=30)
private String level3DesignationC0de;
@Column(length=30)
private String branchCdLevel3;
@Column(length=63)
private String userRole4;
@Column(length=30)
private String level4DesignationC0de;
@Column(length=30)
private String branchCdLevel4;
@Column(length=63)
private String userRole5;
@Column(length=30)
private String level5DesignationC0de;
@Column(length=30)
private String branchCdLevel5;
@Column(length=10)
private String baType;
private Long baRank;
@Column(length=1)
private String gender;
@Column(length=20)
private String dob;
@Column(length=50)
private String branchName;
@Column(length=20)
private String middleName;
@Column(length=5)
private String designation;
@Column(length=10)
private String pan;
@Column(length=1)
private String agentStatus;
@Enumerated(EnumType.STRING)
protected Status status = Status.ACTIVE;
@Enumerated(EnumType.STRING)
private RolesConstant role = RolesConstant.LEADER;
private String notificationId;
private int failedAttemptLogin = 0;
public User(){}
// Getters and Setters ... (Omitted for brevity)
}
\ No newline at end of file
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.iRecruit.config.IdGenerator;
import com.iRecruit.constant.Status;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "tbl_userOTP")
@EntityListeners(AuditingEntityListener.class)
@Setter
@Getter
public class UserOTP extends Auditable<Long>{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_otp_seq")
@GenericGenerator(
name = "user_otp_seq",
strategy = "com.iRecruit.config.IdGenerator",
parameters = {
@Parameter(name = IdGenerator.INCREMENT_PARAM, value = "1"),
@Parameter(name = IdGenerator.VALUE_PREFIX_PARAMETER, value = "UO"),
@Parameter(name = IdGenerator.NUMBER_FORMAT_PARAMETER, value = "%08d")})
@Column(length=10)
private String id;
@NotNull
// @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
// @JoinColumn(name = "user_id")
private String userId;
@NotBlank
private String OTP;
@Enumerated(EnumType.STRING)
protected Status status = Status.INIT;
public Status getStatus() {
return status;
}
}
package com.iRecruit.modules.auth.payload;
import com.iRecruit.modules.auth.model.AuditLogs;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class AuditLogsDto {
private Long id;
private String service;
private String sourceIp;
private String deviceInfo;
private String browserInfo;
private String username;
private int status;
private String errorMsg;
private Long timeTaken;
private String requestObj;
private String responseObj;
private String OS;
public AuditLogsDto (AuditLogs audioLogs){
this.id = audioLogs.getId();
this.service = audioLogs.getService();
this.sourceIp = audioLogs.getSourceIp();
this.deviceInfo = audioLogs.getDeviceInfo();
this.browserInfo = audioLogs.getBrowserInfo();
this.username = audioLogs.getUsername();
this.status = audioLogs.getStatusCode();
this.errorMsg = audioLogs.getErrorMsg();
this.timeTaken = audioLogs.getTimeTaken();
this.requestObj = audioLogs.getRequestObj();
this.responseObj = audioLogs.getResponseObj();
this.OS = audioLogs.getOS();
}
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.iRecruit.modules.auth.model.Configurations;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ConfigurationsDto{
@NotBlank
private String key;
@NotBlank
private String value;
private String description;
public ConfigurationsDto(Configurations configurations) {
this.key = configurations.getConfig();
this.value = configurations.getValue();
this.description = configurations.getDescription();
}
}
package com.iRecruit.modules.auth.payload;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class IdDto {
private String id;
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.MpbMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class L1slabsDto {
private Long Id;
private int maxval;
private int minval;
private int BA;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
public L1slabsDto(L1slabsMapping l1slabsmapping) {
this.Id = l1slabsmapping.getId();
this.maxval = l1slabsmapping.getMaxval();
this.minval = l1slabsmapping.getMinval();
this.BA = l1slabsmapping.getBA();
this.SBA = l1slabsmapping.getSBA();
this.CBA = l1slabsmapping.getCBA();
this.Partner = l1slabsmapping.getPartner();
this.Senior_Partner = l1slabsmapping.getSenior_Partner();
}
}
package com.iRecruit.modules.auth.payload;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class L2slabsDto {
private Long Id;
private int maxval;
private int minval;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
public L2slabsDto(L2slabsMapping l2slabsmapping) {
this.Id = l2slabsmapping.getId();
this.maxval = l2slabsmapping.getMaxval();
this.minval = l2slabsmapping.getMinval();
this.SBA = l2slabsmapping.getSBA();
this.CBA = l2slabsmapping.getCBA();
this.Partner = l2slabsmapping.getPartner();
this.Senior_Partner = l2slabsmapping.getSenior_Partner();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment