pax_global_header 0000666 0000000 0000000 00000000064 13461530756 0014524 g ustar 00root root 0000000 0000000 52 comment=e6fcded208ffedfbd37c3840cdf99e06cd38bfbf
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/ 0000775 0000000 0000000 00000000000 13461530756 0025237 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/.gitignore 0000664 0000000 0000000 00000000057 13461530756 0027231 0 ustar 00root root 0000000 0000000 # Created by .ignore support plugin (hsz.mobi)
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/Dockerfile 0000664 0000000 0000000 00000000450 13461530756 0027230 0 ustar 00root root 0000000 0000000 #version 1.0
FROM openjdk:8-jre-alpine3.7
ADD /target/#ARTIFACT# //
ADD /src/main/resources/application.properties //
ADD /src/main/resources/logback.xml //
ADD /src/main/resources/db-config.properties //
ADD /src/main/resources/service.properties //
ENTRYPOINT ["java", "-jar", "/#ARTIFACT#"]
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/Jenkinsfile 0000664 0000000 0000000 00000015317 13461530756 0027432 0 ustar 00root root 0000000 0000000 pipeline {
agent any
environment {
BRANCHES="${env.GIT_BRANCH}"
COMMIT="${env.GIT_COMMIT}"
}
stages {
stage('Set variables') {
steps {
script {
BRANCH = "${BRANCHES}".tokenize('/')[-1]
def data = readJSON file:'metadata.json'
DOCKERHOST="""${data.hosting."${BRANCH}".dockerHost}"""
DOCKERPORT="""${data.hosting."${BRANCH}".dockerPort}"""
HOSTPORT="""${data.hosting."${BRANCH}".hostPort}"""
DOCKERREPO="docker.artifactory"
VALIDATIONURL="""${data.'application.properties'."${BRANCH}".validationURL}"""
VALIDATIONSLEEP="""${data.'application.properties'."${BRANCH}".validationSleep}"""
DBNODEPRIMARY="""${data.'db-config.properties'."${BRANCH}".DBNODEPRIMARY}"""
DBNODESECONDARY1="""${data.'db-config.properties'."${BRANCH}".DBNODESECONDARY1}"""
DBNODESECONDARY2="""${data.'db-config.properties'."${BRANCH}".DBNODESECONDARY2}"""
DBREPLICASET="""${data.'db-config.properties'."${BRANCH}".DBREPLICASET}"""
DBSCHEMA="""${data."db-config.properties"."${BRANCH}".DBSCHEMA}"""
DBUSR="""${data."db-config.properties"."${BRANCH}".DBUSR}"""
DBPW="""${data."db-config.properties"."${BRANCH}".DBPW}"""
PLAYGROUNDSERVICEURL="""${data."application.properties"."${BRANCH}".PLAYGROUNDSERVICEURL}"""
USESWAGGER="""${data."application.properties"."${BRANCH}".USESWAGGER}"""
def (NS, ENV2, JOB)="${JOB_NAME}".tokenize('/')
def (NET1, B1, B2)="${NS}".tokenize('.')
JOBENV="${ENV2}"
NET="${NET1}"
ORG="${NET}-${JOBENV}"
OLDBUILD=(BUILD_ID as int) - 1
def pom=readMavenPom file: 'pom.xml'
ARTIFACTID="${pom.artifactId}"
ARTIFACTVERSION="${pom.version}"
ARTIFACTPACKAGING="${pom.packaging}"
ARTIFACT="${ARTIFACTID}-${ARTIFACTVERSION}.${ARTIFACTPACKAGING}"
sh "sed -i s/#DBNODEPRIMARY#/${DBNODEPRIMARY}/g ./src/main/resources/db-config.properties"
sh "sed -i s/#DBNODESECONDARY1#/${DBNODESECONDARY1}/g ./src/main/resources/db-config.properties"
sh "sed -i s/#DBNODESECONDARY2#/${DBNODESECONDARY2}/g ./src/main/resources/db-config.properties"
sh "sed -i s/#DBREPLICASET#/${DBREPLICASET}/g ./src/main/resources/db-config.properties"
sh "sed -i s/#DBSCHEMA#/${DBSCHEMA}/g ./src/main/resources/db-config.properties"
sh "sed -i s/#DBUSR#/${DBUSR}/g ./src/main/resources/db-config.properties"
sh "set +x && sed -i s/#DBPW#/${DBPW}/g ./src/main/resources/db-config.properties"
sh "sed -i s/#PLAYGROUNDSERVICEURL#/${PLAYGROUNDSERVICEURL}/g ./src/main/resources/application.properties"
sh "sed -i s/#PLAYGROUNDSERVICEURL#/${PLAYGROUNDSERVICEURL}/g ./src/test/resources/application-test.properties"
sh "sed -i s/#USESWAGGER#/${USESWAGGER}/g ./src/main/resources/application.properties"
}
}
}
stage('Maven build') {
steps {
sh 'mvn clean package'
}
}
stage('Jacoco Coverage') {
steps {
jacoco changeBuildStatus: false, maximumClassCoverage: '50', maximumComplexityCoverage: '50', maximumLineCoverage: '50'
}
}
stage('Sonarqube') {
steps {
script {
def scannerHome=tool 'sonarqube'
withSonarQubeEnv('sonarqube_local') {
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${JOB_BASE_NAME} -Dsonar.sources='.' -Dsonar.java.binaries='.' -Dsonar.exclusions='target/**/*' -Dsonar.projectVersion=${JOBENV}.${BUILD_ID} -Dsonar.branch=${BRANCH} "
}
}
}
}
stage('Build docker image') {
steps {
script {
sh "sed -i s/#ARTIFACT#/${ARTIFACT}/g Dockerfile"
withDockerRegistry([credentialsId: 'dockeraws_pw', url: "http://docker.artifactory/"]) {
TAG="docker.artifactory/${ORG}/${JOB_BASE_NAME}:${BUILD_ID}"
def image=docker.build("${TAG}", "--no-cache -f Dockerfile .")
stage('Push docker image') {
image.push "${BUILD_ID}"
}
}
}
}
}
stage('Deploy docker image') {
steps {
script {
println "ENV: ${JOBENV}"
if (("${JOBENV}"=="3dash") || ("${JOBENV}"=="prod")) {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'dockeraws_pw', usernameVariable: '_DOCKERUSER', passwordVariable: '_DOCKERPWD']]) {
sh """
ssh centos@${DOCKERHOST} "docker login -u $_DOCKERUSER -p $_DOCKERPWD ${DOCKERREPO} && docker pull ${DOCKERREPO}/${ORG}/${JOB_BASE_NAME}:${BUILD_ID}"
ssh centos@${DOCKERHOST} "docker stop ${JOB_BASE_NAME} || true && docker rm ${JOB_BASE_NAME} || true"
ssh centos@${DOCKERHOST} "docker run -d --name ${JOB_BASE_NAME} --restart always --network=${NET} -p ${HOSTPORT}:${DOCKERPORT} ${DOCKERREPO}/${ORG}/${JOB_BASE_NAME}:${BUILD_ID}"
ssh centos@${DOCKERHOST} "docker rmi ${DOCKERREPO}/${ORG}/${JOB_BASE_NAME}:${OLDBUILD} || true"
"""
}
}
else {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'dockeraws_pw', usernameVariable: '_DOCKERUSER', passwordVariable: '_DOCKERPWD']]) {
sh """
ssh centos@${DOCKERHOST} "docker login -u $_DOCKERUSER -p $_DOCKERPWD ${DOCKERREPO} && docker pull ${DOCKERREPO}/${ORG}/${JOB_BASE_NAME}:${BUILD_ID}"
ssh centos@${DOCKERHOST} "docker stop ${JOB_BASE_NAME} || true && docker rm ${JOB_BASE_NAME} || true"
ssh centos@${DOCKERHOST} "docker run -d --name ${JOB_BASE_NAME} --restart always -p ${HOSTPORT}:${DOCKERPORT} ${DOCKERREPO}/${ORG}/${JOB_BASE_NAME}:${BUILD_ID}"
ssh centos@${DOCKERHOST} "docker rmi ${DOCKERREPO}/${ORG}/${JOB_BASE_NAME}:${OLDBUILD} || true"
"""
}
}
}
}
}
stage ('Validate End-Point') {
steps {
script {
sh """sleep "${VALIDATIONSLEEP}" && curl -H "Content-Type: application/json" "${VALIDATIONURL}" """
def connection=new URL("${VALIDATIONURL}").openConnection() as HttpURLConnection
connection.setRequestProperty('User-Agent', 'groovy-2.4.4')
connection.setRequestProperty('Content-Type', 'application/json')
RESULT=connection.inputStream.text
//if $RESULT
}
}
}
stage('Send results to Slack') {
steps {
slackSend(color: '#439FE0', message: "'${env.JOB_NAME}' #'${env.BUILD_ID}' '${COMMIT}' ", channel: '#pg-svcs')
}
}
}
post {
always {
script {
currentBuild.result = currentBuild.result ?: 'SUCCESS'
notifyBitbucket()
}
}
}
}
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/README.md 0000664 0000000 0000000 00000000764 13461530756 0026525 0 ustar 00root root 0000000 0000000 ## Description ##
The template used in creating this service has the configuration inclusive of
1. `Consul` - Service Registry and Discovery
2. `Hystrix` - Circuit Breaker
3. `RabbitMQ` - Message Broker
4. `SpringBootAdmin` - Service Monitoring
5. `ElasticSearch` - Log Indexer
6. `Logstash` - Log Collector
7. `Kibana` - Log Visualizer
8. `Zipkin` - Log Trace Collector
9. `SpringCloudSleuth` - Log Tracing
10. `Togglz` - Feature Toggles
11. `Swagger` - API documentation
# Playground Template #
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/metadata.json 0000664 0000000 0000000 00000004743 13461530756 0027722 0 ustar 00root root 0000000 0000000 {
"hosting": {
"feature": {
"dockerPort": "8080",
"hostPort": "50116",
"dockerHost": "10.101.102.56"
},
"develop": {
"dockerPort": "8080",
"hostPort": "50116",
"dockerHost": "10.101.101.128"
},
"release": {
"dockerPort": "8080",
"hostPort": "50116",
"dockerHost": "10.101.103.65"
},
"master": {
"dockerPort": "8080",
"hostPort": "50116",
"dockerHost": "10.101.102.123"
}
},
"db-config.properties": {
"feature": {
"DBNODEPRIMARY": "cluster0-shard-00-00-q6qiu.azure.mongodb.net:27017",
"DBNODESECONDARY1": "cluster0-shard-00-01-q6qiu.azure.mongodb.net:27017",
"DBNODESECONDARY2": "cluster0-shard-00-02-q6qiu.azure.mongodb.net:27017",
"DBREPLICASET": "Cluster0-shard-0",
"DBSCHEMA": "pg_innovation_dev",
"DBUSR": "pg-dev",
"DBPW": "bek7sgkny5yJIjIS"
},
"develop": {
"DBNODEPRIMARY": "cluster0-shard-00-00-q6qiu.azure.mongodb.net:27017",
"DBNODESECONDARY1": "cluster0-shard-00-01-q6qiu.azure.mongodb.net:27017",
"DBNODESECONDARY2": "cluster0-shard-00-02-q6qiu.azure.mongodb.net:27017",
"DBREPLICASET": "Cluster0-shard-0",
"DBSCHEMA": "pg_innovation_qa",
"DBUSR": "pg-dev",
"DBPW": "bek7sgkny5yJIjIS"
},
"release": {
"DBNODEPRIMARY": "cluster0-shard-00-00-q6qiu.azure.mongodb.net:27017",
"DBNODESECONDARY1": "cluster0-shard-00-01-q6qiu.azure.mongodb.net:27017",
"DBNODESECONDARY2": "cluster0-shard-00-02-q6qiu.azure.mongodb.net:27017",
"DBREPLICASET": "Cluster0-shard-0",
"DBSCHEMA": "pg_innovation_uat",
"DBUSR": "pg-dev",
"DBPW": "bek7sgkny5yJIjIS"
},
"master": {
"DB": "playground-db:3306",
"DBSCHEMA": "pg_innovation",
"DBUSR": "appsupport",
"DBPW": "Oracle@123"
}
},
"application.properties": {
"feature": {
"USESWAGGER": true,
"PLAYGROUNDSERVICEURL": "3-playground.altimetrik.com",
"validationURL": "https://3-playground.altimetrik.com/template/",
"validationSleep": "30"
},
"develop": {
"USESWAGGER": true,
"PLAYGROUNDSERVICEURL": "2-playground.altimetrik.com",
"validationURL": "https://2-playground.altimetrik.com/template/",
"validationSleep": "30"
},
"release": {
"USESWAGGER": true,
"PLAYGROUNDSERVICEURL": "1-playground.altimetrik.com",
"validationURL": "https://1-playground.altimetrik.com/template/",
"validationSleep": "30"
},
"master": {
"USESWAGGER": false,
"PLAYGROUNDSERVICEURL": "playground.altimetrik.com",
"validationURL": "https://playground.altimetrik.com/template/",
"validationSleep": "30"
}
}
}
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/pom.xml 0000664 0000000 0000000 00000017667 13461530756 0026575 0 ustar 00root root 0000000 0000000
4.0.0
com.altimetrik
playground-template
1.0.0
jar
playground-template
Playground Template
org.springframework.boot
spring-boot-starter-parent
2.1.3.RELEASE
UTF-8
UTF-8
1.8
Greenwich.RELEASE
2.1.0
1.3.0.RELEASE
4.9
2.9.2
1.5.20
2.6.1.Final
2.6
2.8.5
Tushar Das
tdas@altimetrik.com
Altimetrik India Pvt Ltd
http://www.altimetrik.com
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-actuator
de.codecentric
spring-boot-admin-starter-client
${spring-boot-admin.version}
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-test
test
org.springframework.cloud
spring-cloud-starter-sleuth
org.springframework.cloud
spring-cloud-starter-zipkin
org.springframework.cloud
spring-cloud-starter-consul-discovery
org.springframework.cloud
spring-cloud-starter-hystrix
${hystrix.version}
org.springframework.cloud
spring-cloud-starter-hystrix-dashboard
${hystrix.version}
org.springframework.boot
spring-boot-starter-amqp
org.springframework.boot
spring-boot-starter-data-mongodb
net.logstash.logback
logstash-logback-encoder
${logback-encoder.version}
ch.qos.logback
logback-classic
ch.qos.logback
logback-core
io.swagger
swagger-annotations
${swagger-annotations.version}
io.springfox
springfox-swagger2
${swagger.version}
compile
io.springfox
springfox-swagger-ui
${swagger.version}
compile
org.togglz
togglz-spring-boot-starter
${togglz.version}
org.togglz
togglz-console
${togglz.version}
org.projectlombok
lombok
true
org.apache.commons
commons-lang3
commons-io
commons-io
${commons-io.version}
com.google.code.gson
gson
${gson.version}
com.h2database
h2
test
com.sun.jersey
jersey-core
org.springframework.cloud
spring-cloud-dependencies
${spring-cloud.version}
pom
import
org.springframework.boot
spring-boot-maven-plugin
org.apache.maven.plugins
maven-surefire-plugin
org.apache.maven.plugins
maven-javadoc-plugin
attach-javadocs
jar
org.jacoco
jacoco-maven-plugin
0.8.3
prepare-agent
report
prepare-package
report
${project.build.directory}/jacoco
spring-snapshots
Spring Snapshots
https://repo.spring.io/snapshot
true
spring-milestones
Spring Milestones
https://repo.spring.io/milestone
false
gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/ 0000775 0000000 0000000 00000000000 13461530756 0026026 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/ 0000775 0000000 0000000 00000000000 13461530756 0026752 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/ 0000775 0000000 0000000 00000000000 13461530756 0027673 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/ 0000775 0000000 0000000 00000000000 13461530756 0030451 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/ 0000775 0000000 0000000 00000000000 13461530756 0032616 5 ustar 00root root 0000000 0000000 playground/ 0000775 0000000 0000000 00000000000 13461530756 0034723 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik innovation/ 0000775 0000000 0000000 00000000000 13461530756 0037107 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground PlaygroundApplication.java 0000664 0000000 0000000 00000005044 13461530756 0044265 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation;
import java.io.File;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.togglz.core.manager.EnumBasedFeatureProvider;
import org.togglz.core.repository.StateRepository;
import org.togglz.core.repository.file.FileBasedStateRepository;
import org.togglz.core.spi.FeatureProvider;
import org.togglz.core.user.NoOpUserProvider;
import org.togglz.core.user.UserProvider;
import com.altimetrik.playground.innovation.feature.Features;
import com.altimetrik.playground.innovation.properties.ErrorProperties;
import com.altimetrik.playground.innovation.properties.ServiceProperties;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ServletComponentScan
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableHystrixDashboard
@PropertySource(value = { "classpath:db-config.properties", "classpath:service.properties" })
@EnableConfigurationProperties({ ServiceProperties.class, ErrorProperties.class })
public class PlaygroundApplication {
public static void main(String[] args) {
SpringApplication.run(PlaygroundApplication.class, args);
}
@Bean
public FeatureProvider featureProvider() {
return new EnumBasedFeatureProvider(Features.class);
}
@Bean
public UserProvider userProvider() {
return new NoOpUserProvider();
}
@Bean
public StateRepository getStateRepository() {
return new FileBasedStateRepository(new File("src/main/resources/features.properties"), 10_000);
}
@Bean
public Gson gson() {
return new GsonBuilder().serializeNulls().create();
}
}
bean/ 0000775 0000000 0000000 00000000000 13461530756 0040014 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation BaseRequestBean.java 0000664 0000000 0000000 00000001150 13461530756 0043665 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/bean /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.bean;
import lombok.Data;
@Data
public class BaseRequestBean {
public BaseRequestBean() {
super();
}
}
BaseResponse.java 0000664 0000000 0000000 00000001321 13461530756 0043245 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/bean /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.bean;
public class BaseResponse extends ResponseModel {
private static final long serialVersionUID = 1L;
public BaseResponse(StatusDetails status) {
super.setStatus(status);
}
public BaseResponse() {
}
}
PgUser.java 0000664 0000000 0000000 00000001275 13461530756 0042071 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/bean /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.bean;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class PgUser {
private Long userId;
private String name;
private String emailId;
public PgUser() {
super();
}
}
Principal.java 0000664 0000000 0000000 00000006066 13461530756 0042610 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/bean package com.altimetrik.playground.innovation.bean;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
* The Class Principal.
*
* @author Senthilkumar Duraisamy
*/
@JsonInclude(Include.NON_NULL)
public class Principal implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -1364484672867322008L;
/** The user id. */
private String userId;
/** The user name. */
private String userName;
/** The default realm. */
private String realm;
/** The default roles. */
private String roles;
/** The authenticated. */
private Boolean authenticated;
/** The first name. */
private String firstName;
/** The last name. */
private String lastName;
/** The user info mstr id. */
private String userInfoMstrId;
public String getUserInfoMstrId() {
return userInfoMstrId;
}
public void setUserInfoMstrId(String userInfoMstrId) {
this.userInfoMstrId = userInfoMstrId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* Gets the user id.
*
* @return the user id
*/
public String getUserId() {
return userId;
}
/**
* Sets the user id.
*
* @param userId the new user id
*/
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
/**
* Gets the realm.
*
* @return the realm
*/
public String getRealm() {
return realm;
}
/**
* Sets the realm.
*
* @param realm the new realm
*/
public void setRealm(String realm) {
this.realm = realm;
}
/**
* Gets the roles.
*
* @return the roles
*/
public String getRoles() {
return roles;
}
/**
* Sets the roles.
*
* @param roles the new roles
*/
public void setRoles(String roles) {
this.roles = roles;
}
/**
* Gets the authenticated.
*
* @return the authenticated
*/
public Boolean getAuthenticated() {
return authenticated;
}
/**
* Sets the authenticated.
*
* @param authenticated the new authenticated
*/
public void setAuthenticated(Boolean authenticated) {
this.authenticated = authenticated;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Principal [userId=");
builder.append(userId);
builder.append(", userName=");
builder.append(userName);
builder.append(", realm=");
builder.append(realm);
builder.append(", roles=");
builder.append(roles);
builder.append(", authenticated=");
builder.append(authenticated);
builder.append(", firstName=");
builder.append(firstName);
builder.append(", lastName=");
builder.append(lastName);
builder.append(", userInfoMstrId=");
builder.append(userInfoMstrId);
builder.append("]");
return builder.toString();
}
}
ResponseModel.java 0000664 0000000 0000000 00000001525 13461530756 0043441 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/bean /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.bean;
import java.io.Serializable;
import lombok.Data;
@Data
public class ResponseModel implements Serializable {
private static final long serialVersionUID = -8769927865634815829L;
private StatusDetails status;
public ResponseModel() {
super();
}
public ResponseModel(StatusDetails status) {
super();
this.status = status;
}
}
StatusDetails.java 0000664 0000000 0000000 00000002122 13461530756 0043445 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/bean /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.bean;
import lombok.Data;
@Data
public class StatusDetails {
/**
* Success Status code.
*/
public static final int SUCCESS = 1;
/**
* Failure Status code.
*/
public static final int FAILED = 0;
private Integer statusCode;
private String errorCode;
private String messageDescription;
public StatusDetails() {
super();
}
public StatusDetails(String errorCode, String messageDescription) {
super();
this.errorCode = errorCode;
this.messageDescription = messageDescription;
}
public StatusDetails(Integer statusCode) {
super();
this.statusCode = statusCode;
}
}
config/ 0000775 0000000 0000000 00000000000 13461530756 0040354 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation RabbitConfig.java 0000664 0000000 0000000 00000005562 13461530756 0043560 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/config /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
@Configuration
public class RabbitConfig implements RabbitListenerConfigurer {
public final static String QUEUE_NAME = "playground-innovation";
public final static String EXCHANGE_NAME = "playground.services-exchange";
public final static String ROUTING_KEY_NAME = "playground-innovation";
@Bean
Queue queue() {
return new Queue(QUEUE_NAME, true);
}
@Bean
TopicExchange exchange() {
return new TopicExchange(EXCHANGE_NAME);
}
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY_NAME);
}
@Bean
public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) {
final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(producerJackson2MessageConverter());
return rabbitTemplate;
}
@Bean
public Jackson2JsonMessageConverter producerJackson2MessageConverter() {
return new Jackson2JsonMessageConverter();
}
@Bean
public MappingJackson2MessageConverter consumerJackson2MessageConverter() {
return new MappingJackson2MessageConverter();
}
@Bean
public DefaultMessageHandlerMethodFactory messageHandlerMethodFactory() {
DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory();
factory.setMessageConverter(consumerJackson2MessageConverter());
return factory;
}
@Override
public void configureRabbitListeners(final RabbitListenerEndpointRegistrar registrar) {
registrar.setMessageHandlerMethodFactory(messageHandlerMethodFactory());
}
}
SecurityConfig.java 0000664 0000000 0000000 00000002677 13461530756 0044170 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/config /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.config;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
/**
* This configuration helps in disabling the authentication provided by spring
* boot admin client. Removing this configuration would result in a login page
* for authorization.
*
* @author skondapalli
*/
//@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl("/");
http.csrf().disable().authorizeRequests().antMatchers("/**").permitAll();
}
}
SwaggerConfig.java 0000664 0000000 0000000 00000004225 13461530756 0043747 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/config /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.config;
import static springfox.documentation.builders.PathSelectors.regex;
import java.util.Collections;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.altimetrik.playground.innovation.properties.ServiceProperties;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* URL's for api docs and swagger UI are as follows:
* http://localhost:8080/reportsvc//swagger-ui.html
* http://localhost:8080/reportsvc//v2/api-docs
*
* @author skondapalli
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Autowired
ServiceProperties serviceProperties;
@Bean
public Docket serviceEndpoint() {
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.altimetrik.playground.innovation.controller")).paths(regex("/.*"))
.build().enable(serviceProperties.isSwaggerEnabled()).apiInfo(metaData());
}
private ApiInfo metaData() {
return new ApiInfo("Playground Innovation Service", "Playground API Services for Innovation Service", "1.0", "https://www.altimetrik.com/privacy-policy/",
new Contact("Playground", "https://playground.altimetrik.com", "pg-mgr1@altimetrik.com"), "Apache License Version 2.0",
"https://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());
}
}
WebMvcConfig.java 0000664 0000000 0000000 00000001560 13461530756 0043532 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/config /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
}
}
constants/ 0000775 0000000 0000000 00000000000 13461530756 0041123 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation ActionTypeEnum.java 0000664 0000000 0000000 00000001555 13461530756 0044700 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/constants /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.constants;
/**
* Indicates different possible actions across the service.
*
* @author skondapalli.
*/
public enum ActionTypeEnum {
UPDATE_IDEA("UPDATE_IDEA"), UPDATE_IDEA_STATUS("UPDATE_IDEA_STATUS");
private final String message;
ActionTypeEnum(final String argMessage) {
message = argMessage;
}
public final String getMessage() {
return message;
}
}
ArtifactModeEnum.java 0000664 0000000 0000000 00000001345 13461530756 0045160 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/constants /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.constants;
public enum ArtifactModeEnum {
IDEA("IDEA"), POC("POC");
private final String message;
ArtifactModeEnum(final String argMessage) {
message = argMessage;
}
public final String getMessage() {
return message;
}
}
ArtifactTypeEnum.java 0000664 0000000 0000000 00000001331 13461530756 0045210 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/constants /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.constants;
public enum ArtifactTypeEnum {
LINK("LINK");
private final String message;
ArtifactTypeEnum(final String argMessage) {
message = argMessage;
}
public final String getMessage() {
return message;
}
}
Status.java 0000664 0000000 0000000 00000001373 13461530756 0043255 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/constants /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.constants;
public enum Status {
SUCCESS("SUCCESS"), FAILURE("FAILURE");
private String requestStatus;
Status(final String requestStatus) {
this.requestStatus = requestStatus;
}
public String getRequestStatus() {
return this.requestStatus;
}
}
controller/ 0000775 0000000 0000000 00000000000 13461530756 0041272 5 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation BaseController.java 0000664 0000000 0000000 00000014473 13461530756 0045064 0 ustar 00root root 0000000 0000000 gitlab-playground-innovation-e6fcded208ffedfbd37c3840cdf99e06cd38bfbf/src/main/java/com/altimetrik/playground/innovation/controller /*******************************************************************************
* Copyright (C) Altimetrik 2018. All rights reserved.
*
* This software is the confidential and proprietary information
* of Altimetrik. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms and conditions
* entered into with Altimetrik.
******************************************************************************/
package com.altimetrik.playground.innovation.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.altimetrik.playground.innovation.bean.BaseResponse;
import com.altimetrik.playground.innovation.bean.ResponseModel;
import com.altimetrik.playground.innovation.bean.StatusDetails;
import com.altimetrik.playground.innovation.exception.PgApplicationException;
public abstract class BaseController extends ResponseEntityExceptionHandler {
private static final String MESSAGE_DESCRIPTION = "messageDescription";
private static final String ERROR_CODE = "errorCode";
protected static final String PLATFORM_UNHANDLED_EXCEPTION_THROWN = "PG unhandled exception thrown.";
protected static final String PLATFORM_FATAL_EXCEPTION_THROWN = "PG fatal exception thrown.";
protected static final String PLATFORM_SYSTEM_EXCEPTION_THROWN = "PG system exception thrown.";
protected static final String PLATFORM_VALIDATION_ERROR = "Validation errors encountered";
protected static final String PLATFORM_APPLICATION_EXCEPTION_THROWN = "PG application exception thrown.";
@ExceptionHandler(PgApplicationException.class)
public ResponseEntity resolveApplicationException(HttpServletRequest request, HttpServletResponse response, Exception exception) {
PgApplicationException appException = (PgApplicationException) exception;
StatusDetails errorStatus = getErrorStatus(appException.getMessage(),
appException.getLocalizedMessage(appException.getMessage(), new Locale(""), appException.getArguments()));
BaseResponse errorResponse = new BaseResponse(errorStatus);
return new ResponseEntity<>(errorResponse, HttpStatus.OK);
}
@Override
@ResponseStatus(HttpStatus.BAD_REQUEST)
protected ResponseEntity