Skip to content

Commit

Permalink
Initial Commit.
Browse files Browse the repository at this point in the history
Migrated previous timesheet_upload application to SpringBoot2, updated all required properties, dependencies and integrated into this application to extend the functionality.
  • Loading branch information
Mahidhar C Mullapudi committed May 9, 2018
0 parents commit 1f2ecd1
Show file tree
Hide file tree
Showing 135 changed files with 34,810 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/target/
!.mvn/wrapper/maven-wrapper.jar

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
mvnw
mvnw.cmd

### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
/.mvn/
171 changes: 171 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http:https://maven.apache.org/POM/4.0.0" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:https://maven.apache.org/POM/4.0.0 http:https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.tutorialq</groupId>
<artifactId>employee_management</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>employee_management</name>
<description>Employee Management Application</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Utility jars -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>

<!-- Tomcat jasper dependency to compile JSPs -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope> -->
</dependency>
<!-- Dependencies for Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>

</project>
12 changes: 12 additions & 0 deletions src/main/java/com/tutorialq/EmployeeManagementApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.tutorialq;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class EmployeeManagementApplication {

public static void main(String[] args) {
SpringApplication.run(EmployeeManagementApplication.class, args);
}
}
13 changes: 13 additions & 0 deletions src/main/java/com/tutorialq/ServletInitializer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tutorialq;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

public class ServletInitializer extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(EmployeeManagementApplication.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.tutorialq.config;

import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.http.HttpSessionListener;

@Configuration
public class ApplicationSessionConfiguration {
@Bean
public ServletListenerRegistrationBean<HttpSessionListener> sessionListener() {
return new ServletListenerRegistrationBean<HttpSessionListener>(new SessionListener());
}
}
45 changes: 45 additions & 0 deletions src/main/java/com/tutorialq/config/MailingConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.tutorialq.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import java.io.IOException;
import java.util.Properties;

@Configuration
public class MailingConfig {
@Value("${spring.mail.protocol}") // this is to read variable from application.properties
private String mailProtocol;
@Value("${spring.mail.host}")
private String host;
@Value("${spring.mail.port}")
private Integer port;
/*@Value("${mail.support.username}")
private String userName;
@Value("${mail.support.password}")
private String password;*/

@Bean
public JavaMailSender javaMailSender() {
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
javaMailSender.setProtocol(mailProtocol);
javaMailSender.setHost(host);
javaMailSender.setPort(port);
//javaMailSender.setUsername(userName);
//javaMailSender.setPassword(password);
javaMailSender.setJavaMailProperties(getMailProperties());
return javaMailSender;
}

private Properties getMailProperties() {
Properties properties = new Properties();
properties.setProperty("mail.smtp.auth", "false");
properties.setProperty("mail.smtp.starttls.enable", "true");
properties.setProperty("mail.debug", "false");
return properties;
}

}
32 changes: 32 additions & 0 deletions src/main/java/com/tutorialq/config/SessionListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.tutorialq.config;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

@Slf4j
public class SessionListener implements HttpSessionListener {

/*
* This method is used to set the maximum inactive interval in seconds. After this interval session will get destroyed.
*/
@Override
public void sessionCreated(HttpSessionEvent event) {
try {
event.getSession().setMaxInactiveInterval(60 * 60);
} catch (Exception ex) {
log.error("Exception while getting the Max Inactive Interval " + ex);
}

}

/*
* After the given inactive interval, session will get destroyed.
*/
@Override
public void sessionDestroyed(HttpSessionEvent event) {
log.warn("==== Session is destroyed ====");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.tutorialq.constants;

public class EmailServiceConstants {
//Email Service Parameters
public static final String mailTemplateTableName = "TIMESHEET_APP_EMAIL_TEMPLATE";
public static final String mailTemplateKeyColumnName = "DSC_EMAIL_TEMPLATE_KEY";
public static final String mailTemplateColumnName = "DSC_EMAIL_TEMPLATE";
public static final String mailTemplateModifiedDateColumnName = "DATE_USER_MODIFIED";
}
18 changes: 18 additions & 0 deletions src/main/java/com/tutorialq/constants/QueryProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tutorialq.constants;

public class QueryProperties {

public final static String updateEmployeeProfileByEmpId = "UPDATE Employee emp "
+ "SET emp.employeeFirstName = :employeeFirstName, "
+ " emp.employeeLastName = :employeeLastName,"
+ " emp.employeeTitle = :employeeTitle, "
+ " emp.employeePhone = :employeePhone "
+ " WHERE emp.employeeId = :employeeId";

public final static String updateStaffProfileByEmpId = "UPDATE Employee emp "
+ "SET emp.employeeFirstName = :employeeFirstName, "
+ " emp.employeeLastName = :employeeLastName,"
+ " emp.employeeTitle = :employeeTitle, "
+ " emp.employeePhone = :employeePhone "
+ " WHERE emp.employeeId = :employeeId";
}
Loading

0 comments on commit 1f2ecd1

Please sign in to comment.