Commit 7d4e55be authored by Srinivas Kota's avatar Srinivas Kota

[Srinivas-001-Employee] : Initial commit with Get method

[Srinivas-001-Employee] : Updated Get employee Method.

Created Resource Package

[Srinivas-001-Employee] : Added Save employee Method.

[Srinivas-001-Employee] : Updated Save employee Method.

[Srinivas-001-Employee] : Added Get and Save Employee methods and
squashed the commit.
parent 32bc37b2
#Fri May 22 10:17:52 IST 2020
gradle.version=6.2.1
#Fri May 22 11:54:46 IST 2020
gradle.version=6.3
# Default ignored files
/workspace.xml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -38,7 +38,7 @@
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.134s</div>
<div class="counter">0.370s</div>
<p>duration</p>
</div>
</td>
......@@ -85,7 +85,7 @@
<td>1</td>
<td>0</td>
<td>0</td>
<td>0.134s</td>
<td>0.370s</td>
<td class="success">100%</td>
</tr>
</tbody>
......@@ -112,7 +112,7 @@
<td>1</td>
<td>0</td>
<td>0</td>
<td>0.134s</td>
<td>0.370s</td>
<td class="success">100%</td>
</tr>
</tbody>
......@@ -126,7 +126,7 @@
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="http://www.gradle.org">Gradle 6.2.1</a> at 22 May, 2020 10:18:53 AM</p>
<a href="http://www.gradle.org">Gradle 6.3</a> at 22-May-2020, 12:22:38 PM</p>
</div>
</div>
</body>
......
......@@ -40,7 +40,7 @@
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.134s</div>
<div class="counter">0.370s</div>
<p>duration</p>
</div>
</td>
......@@ -83,7 +83,7 @@
<td>1</td>
<td>0</td>
<td>0</td>
<td>0.134s</td>
<td>0.370s</td>
<td class="success">100%</td>
</tr>
</table>
......@@ -96,7 +96,7 @@
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="http://www.gradle.org">Gradle 6.2.1</a> at 22 May, 2020 10:18:53 AM</p>
<a href="http://www.gradle.org">Gradle 6.3</a> at 22-May-2020, 12:22:38 PM</p>
</div>
</div>
</body>
......
Manifest-Version: 1.0
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.nisum.epe.demo.DemoApplication
Spring-Boot-Version: 2.2.7.RELEASE
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Spring-Boot-Version: 2.2.7.RELEASE
Main-Class: org.springframework.boot.loader.JarLauncher
package com.nisum.epe.demo.resource;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class EmployeeResource {
}
package com.nisum.epe.demo.srinivas;
public class Employee {
private String empName;
private int empSal;
public Employee(String empName, int empSal) {
this.empName = empName;
this.empSal = empSal;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public int getEmpSal() {
return empSal;
}
public void setEmpSal(int empSal) {
this.empSal = empSal;
}
}
package com.nisum.epe.demo.srinivas;
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 java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@RestController
public class Resource {
List<Employee> employees = new ArrayList<>();
@RequestMapping("/saveEmployeeDetails")
public void saveEmployeeDetails(@RequestBody Employee employee) {
System.out.println("Save Employee details");
buildEmployeeDetails().add(employee);
employees.forEach(System.out::println);
System.out.println(employee.toString());
}
@RequestMapping("/getEmployeeDetails")
public void getmployeeDetails(@RequestParam String employeeName) {
System.out.println("Get Employee details");
List<Employee> employeeList = buildEmployeeDetails().stream()
.filter(employee -> employee.getEmpName().equalsIgnoreCase(employeeName))
.collect(Collectors.toList());
employeeList.forEach(System.out::println);
System.out.println(employeeName);
}
private List<Employee> buildEmployeeDetails() {
IntStream.range(1, 100).forEach(
value -> {
employees.add(new Employee("employee" + value, 1000 * value));
}
);
return employees;
}
}
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