diff --git a/10SuperMarketServlet/WebContent/META-INF/MANIFEST.MF b/10SuperMarketServlet/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 254272e1..00000000 --- a/10SuperMarketServlet/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/10SuperMarketServlet/WebContent/WEB-INF/error.jsp b/10SuperMarketServlet/WebContent/WEB-INF/error.jsp deleted file mode 100644 index 23bd3052..00000000 --- a/10SuperMarketServlet/WebContent/WEB-INF/error.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1" isErrorPage="true" %> - - - - -Insert title here - - -

Sorry an exception occured!

- -Exception is: <%= exception %> - - \ No newline at end of file diff --git a/10SuperMarketServlet/WebContent/WEB-INF/web.xml b/10SuperMarketServlet/WebContent/WEB-INF/web.xml deleted file mode 100644 index 34f5873f..00000000 --- a/10SuperMarketServlet/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - GroceryServlet2 - - - - index1.html - - - java.lang.Exception - /error.jsp - - - - DemoServlet - MainServlet.DemoServlet - - - - DemoServlet - /home1 - - - - - DemoServlet2 - MainServlet.DemoServlet2 - - - - - DemoServlet2 - /viewgoods - - - - - DemoServlet3 - MainServlet.DemoServlet3 - - - - - DemoServlet3 - /viewsupplier - - - - - - - \ No newline at end of file diff --git a/10SuperMarketServlet/WebContent/home1.jsp b/10SuperMarketServlet/WebContent/home1.jsp deleted file mode 100644 index 0eba4b98..00000000 --- a/10SuperMarketServlet/WebContent/home1.jsp +++ /dev/null @@ -1,44 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@page import="java.util.ArrayList"%> -<%@page import="java.util.List"%> -<%@page import="model.Customer"%> - - - - <% - List customerList = (ArrayList) request.getAttribute("list"); - - for (Customer ref : customerList) { - out.print("Id: " + ref.getCustomerId()); - out.print("
"); - out.print("Name: " + ref.getCustomerName()); - out.print("
"); - out.print("Address: " + ref.getCustomerAddress()); - out.print("
"); - out.print("PaymentMode: " + ref.getPaymentMode()); - out.print("
"); - } - %> - - - <% - Integer hitsCount = (Integer)application.getAttribute("hitCounter"); - if( hitsCount ==null || hitsCount == 0 ) { - /* First visit */ - out.println("Welcome to my website!"); - hitsCount = 1; - } else { - /* return visit */ - out.println("Welcome back to my website!"); - hitsCount += 1; - } - application.setAttribute("hitCounter", hitsCount); - %> -
-

Total number of visits: <%= hitsCount%>

-
- - - \ No newline at end of file diff --git a/10SuperMarketServlet/WebContent/index1.html b/10SuperMarketServlet/WebContent/index1.html deleted file mode 100644 index 49dec3f4..00000000 --- a/10SuperMarketServlet/WebContent/index1.html +++ /dev/null @@ -1,21 +0,0 @@ - - -
- Id:
- -
- -
- - -
- - - -
- Id:
- -
- - - \ No newline at end of file diff --git a/10SuperMarketServlet/WebContent/viewgoods.jsp b/10SuperMarketServlet/WebContent/viewgoods.jsp deleted file mode 100644 index aecbbd38..00000000 --- a/10SuperMarketServlet/WebContent/viewgoods.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@page import="java.util.ArrayList"%> -<%@page import="java.util.List"%> -<%@page import="model.Goods"%> - - - -goods - - - - <% - List goodsList = (ArrayList) request.getAttribute("glist"); - - for (Goods ref : goodsList) { - out.print("Id: " + ref.getGoodsId()); - out.print("
"); - out.print("Name: " + ref.getGoodsName()); - out.print("
"); - out.print("Price: " + ref.getGoodsPrice()); - out.print("
"); - out.print("GoodsQuantity: " + ref.getGoodsQuantity()); - out.print("
"); - - } - %> - - \ No newline at end of file diff --git a/10SuperMarketServlet/WebContent/viewsupplier.jsp b/10SuperMarketServlet/WebContent/viewsupplier.jsp deleted file mode 100644 index 267bc090..00000000 --- a/10SuperMarketServlet/WebContent/viewsupplier.jsp +++ /dev/null @@ -1,34 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@page import="java.util.ArrayList"%> -<%@page import="java.util.List"%> -<%@page import="model.Supplier"%> - - - -goods - - - - <% - List supplierList = (ArrayList) request.getAttribute("slist"); - - for (Supplier ref : supplierList) { - out.print("Id: " + ref.getSupplierId()); - out.print("
"); - out.print("Name: " + ref.getSupplierName()); - out.print("
"); - out.print("Price: " + ref.getSupplierAddress()); - out.print("
"); - out.print("OrderQuantity: " + ref.getQuantityOrder()); - out.print("
"); - out.print("OrderId: " + ref.getOrderId()); - out.print("
"); - out.print("Amount: " + ref.getAmount()); - out.print("
"); - - } - %> - - \ No newline at end of file diff --git a/10SuperMarketServlet/build/classes/controller/DemoServlet.class b/10SuperMarketServlet/build/classes/controller/DemoServlet.class deleted file mode 100644 index 87c5d25b..00000000 Binary files a/10SuperMarketServlet/build/classes/controller/DemoServlet.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/controller/GroceryAnnotation.class b/10SuperMarketServlet/build/classes/controller/GroceryAnnotation.class deleted file mode 100644 index d90de477..00000000 Binary files a/10SuperMarketServlet/build/classes/controller/GroceryAnnotation.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/model/Customer.class b/10SuperMarketServlet/build/classes/model/Customer.class deleted file mode 100644 index d0f396cb..00000000 Binary files a/10SuperMarketServlet/build/classes/model/Customer.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/model/Goods.class b/10SuperMarketServlet/build/classes/model/Goods.class deleted file mode 100644 index 4699f171..00000000 Binary files a/10SuperMarketServlet/build/classes/model/Goods.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/model/Retailer.class b/10SuperMarketServlet/build/classes/model/Retailer.class deleted file mode 100644 index bce0f3d6..00000000 Binary files a/10SuperMarketServlet/build/classes/model/Retailer.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/model/Supplier.class b/10SuperMarketServlet/build/classes/model/Supplier.class deleted file mode 100644 index 7a7e46cf..00000000 Binary files a/10SuperMarketServlet/build/classes/model/Supplier.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/CustomerDAO.class b/10SuperMarketServlet/build/classes/repository/CustomerDAO.class deleted file mode 100644 index a7a24f26..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/CustomerDAO.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/CustomerDAOImpl.class b/10SuperMarketServlet/build/classes/repository/CustomerDAOImpl.class deleted file mode 100644 index 32b96e0f..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/CustomerDAOImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/GoodsDAO.class b/10SuperMarketServlet/build/classes/repository/GoodsDAO.class deleted file mode 100644 index b633d3e2..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/GoodsDAO.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/GoodsDAOImpl.class b/10SuperMarketServlet/build/classes/repository/GoodsDAOImpl.class deleted file mode 100644 index 11fabf49..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/GoodsDAOImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/RetailerDAO.class b/10SuperMarketServlet/build/classes/repository/RetailerDAO.class deleted file mode 100644 index 106f92ab..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/RetailerDAO.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/RetailerDAOImpl.class b/10SuperMarketServlet/build/classes/repository/RetailerDAOImpl.class deleted file mode 100644 index 99c539bd..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/RetailerDAOImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/SupplierDAO.class b/10SuperMarketServlet/build/classes/repository/SupplierDAO.class deleted file mode 100644 index a577df65..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/SupplierDAO.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/repository/SupplierDAOImpl.class b/10SuperMarketServlet/build/classes/repository/SupplierDAOImpl.class deleted file mode 100644 index edb0705c..00000000 Binary files a/10SuperMarketServlet/build/classes/repository/SupplierDAOImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/CustomerService.class b/10SuperMarketServlet/build/classes/service/CustomerService.class deleted file mode 100644 index 62f02692..00000000 Binary files a/10SuperMarketServlet/build/classes/service/CustomerService.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/CustomerServiceImpl.class b/10SuperMarketServlet/build/classes/service/CustomerServiceImpl.class deleted file mode 100644 index 98b77d76..00000000 Binary files a/10SuperMarketServlet/build/classes/service/CustomerServiceImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/GoodsService.class b/10SuperMarketServlet/build/classes/service/GoodsService.class deleted file mode 100644 index 1c3f019e..00000000 Binary files a/10SuperMarketServlet/build/classes/service/GoodsService.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/GoodsServiceImpl.class b/10SuperMarketServlet/build/classes/service/GoodsServiceImpl.class deleted file mode 100644 index cabaed6c..00000000 Binary files a/10SuperMarketServlet/build/classes/service/GoodsServiceImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/RetailerService.class b/10SuperMarketServlet/build/classes/service/RetailerService.class deleted file mode 100644 index c160c7ad..00000000 Binary files a/10SuperMarketServlet/build/classes/service/RetailerService.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/RetailerServiceImpl.class b/10SuperMarketServlet/build/classes/service/RetailerServiceImpl.class deleted file mode 100644 index 413408bc..00000000 Binary files a/10SuperMarketServlet/build/classes/service/RetailerServiceImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/SupplierService.class b/10SuperMarketServlet/build/classes/service/SupplierService.class deleted file mode 100644 index 68dd431c..00000000 Binary files a/10SuperMarketServlet/build/classes/service/SupplierService.class and /dev/null differ diff --git a/10SuperMarketServlet/build/classes/service/SupplierServiceImpl.class b/10SuperMarketServlet/build/classes/service/SupplierServiceImpl.class deleted file mode 100644 index dd408fcf..00000000 Binary files a/10SuperMarketServlet/build/classes/service/SupplierServiceImpl.class and /dev/null differ diff --git a/10SuperMarketServlet/pom.xml b/10SuperMarketServlet/pom.xml deleted file mode 100644 index 0233ba81..00000000 --- a/10SuperMarketServlet/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - 4.0.0 - GroceryServlet2 - GroceryServlet2 - 0.0.1-SNAPSHOT - war - Grocery - - src - - - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - maven-war-plugin - 3.0.0 - - WebContent - - - - - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - jstl - jstl - 1.2 - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - \ No newline at end of file diff --git a/10SuperMarketServlet/src/MainServlet/DemoServlet.java b/10SuperMarketServlet/src/MainServlet/DemoServlet.java deleted file mode 100644 index 1055e76d..00000000 --- a/10SuperMarketServlet/src/MainServlet/DemoServlet.java +++ /dev/null @@ -1,65 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import model.Goods; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - //CustomerService customerService = (CustomerService) context.getBean("customerService",CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - - - String ID = request.getParameter("id"); - int id = Integer.parseInt(ID); - - - - - List customerList = retailerService.viewCustomer(id); - //List goodsList = retailerService.viewGoods(); - - - - // request.setAttribute("glist", goodsList); - request.setAttribute("list", customerList); - - RequestDispatcher requestDispatcher = request.getRequestDispatcher("home1.jsp"); - // RequestDispatcher requestDispatchergoods = request.getRequestDispatcher("viewgoods.jsp"); - requestDispatcher.forward(request, response); - //requestDispatchergoods.forward(request, response); - } - -} diff --git a/10SuperMarketServlet/src/MainServlet/DemoServlet2.java b/10SuperMarketServlet/src/MainServlet/DemoServlet2.java deleted file mode 100644 index 8d1b4e97..00000000 --- a/10SuperMarketServlet/src/MainServlet/DemoServlet2.java +++ /dev/null @@ -1,57 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import model.Goods; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet2 extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - //CustomerService customerService = (CustomerService) context.getBean("customerService",CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - // List customerList = retailerService.viewCustomer(106); - List goodsList = retailerService.viewGoods(); - - - - request.setAttribute("glist", goodsList); - // request.setAttribute("list", customerList); - - // RequestDispatcher requestDispatcher = request.getRequestDispatcher("home1.jsp"); - RequestDispatcher requestDispatchergoods = request.getRequestDispatcher("viewgoods.jsp"); - //requestDispatcher.forward(request, response); - requestDispatchergoods.forward(request, response); - } - -} diff --git a/10SuperMarketServlet/src/MainServlet/DemoServlet3.java b/10SuperMarketServlet/src/MainServlet/DemoServlet3.java deleted file mode 100644 index ec8ecce7..00000000 --- a/10SuperMarketServlet/src/MainServlet/DemoServlet3.java +++ /dev/null @@ -1,72 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import model.Goods; -import model.Supplier; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet3 extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - //CustomerService customerService = (CustomerService) context.getBean("customerService",CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - - - String ID = request.getParameter("id1"); - try { - int id1 = Integer.parseInt(ID); - - - - - // List customerList = retailerService.viewCustomer(106); - - List supplierList = retailerService.viewSupplier(id1); - - - - - request.setAttribute("slist", supplierList); - // request.setAttribute("list", customerList); - - // RequestDispatcher requestDispatcher = request.getRequestDispatcher("home1.jsp"); - RequestDispatcher requestDispatcherSupplier = request.getRequestDispatcher("viewsupplier.jsp"); - //requestDispatcher.forward(request, response); - requestDispatcherSupplier.forward(request, response); - }catch (NumberFormatException e){ - System.out.println("not a number"); - } - } - -} diff --git a/10SuperMarketServlet/src/controller/AppJavaConfig.java b/10SuperMarketServlet/src/controller/AppJavaConfig.java deleted file mode 100644 index 6aca2c56..00000000 --- a/10SuperMarketServlet/src/controller/AppJavaConfig.java +++ /dev/null @@ -1,76 +0,0 @@ -package controller; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -/** - * @class this is java configuration file - */ -@Configuration -@ComponentScan({ "service", "repository", "controller" }) -@PropertySource(value = { "classpath:database.properties" }) -public class AppJavaConfig { - - @Autowired - Environment environment; - - @Bean - DataSource dataSource() { - final DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource(); - driverManagerDataSource.setUrl(environment.getProperty("url")); - driverManagerDataSource.setUsername(environment.getProperty("dbuser")); - driverManagerDataSource.setPassword(environment.getProperty("dbpassword")); - driverManagerDataSource.setDriverClassName(environment.getProperty("driver")); - return driverManagerDataSource; - } - - @Bean - JdbcTemplate jdbcTempalte(DataSource dataSource) { - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - return jdbcTemplate; - } - - - /* - * @Bean public CustomerDAO customerDaoBean() { return new CustomerDAOImpl(); } - * - * @Bean public GoodsDAO goodsDAOBean() { return new GoodsDAOImpl(); } - * - * @Bean public SupplierDAO supplierDAOBean() { return new SupplierDAOImpl(); } - */ - - /** - * this is CustomerService bean used to invoke the services - */ - /* - * @Bean public RetailerDAO retailerDAOBean() { return new RetailerDAOImpl(); } - * - *//** - * this is CustomerService bean used to invoke the services - *//* - * @Bean public CustomerService customerService() { return new - * CustomerServiceImpl(); } - */ - - /** - * this is GoodsService bean used to invoke the services - */ - /* - * @Bean public GoodsService goodsService() { return new GoodsServiceImpl(); } - * - * @Bean public SupplierService supplierService() { return new - * SupplierServiceImpl(); } - * - * @Bean public RetailerService retailerService() { return new - * RetailerServiceImpl(); } - */ - -} diff --git a/10SuperMarketServlet/src/main/resources/database.properties b/10SuperMarketServlet/src/main/resources/database.properties deleted file mode 100644 index 9c1f900e..00000000 --- a/10SuperMarketServlet/src/main/resources/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=com.mysql.jdbc.Driver -url=jdbc:mysql://localhost:3306/mydb1 -dbuser=root -dbpassword=root \ No newline at end of file diff --git a/10SuperMarketServlet/src/model/Customer.java b/10SuperMarketServlet/src/model/Customer.java deleted file mode 100644 index 86ec6b13..00000000 --- a/10SuperMarketServlet/src/model/Customer.java +++ /dev/null @@ -1,133 +0,0 @@ -package model; - -/** - * @author Ram - * - */ - - - - -/** - * @class this class represent a customer entity - * - */ -public class Customer { - - /** - * @field this is use to provide particular id which will represent a whole - * record in table - */ - private int customerId; - - /** - * @field this is use to provide particular id which will represent a whole - * record in table - */ - private String customerName; - /** - * @field this is use to represent a name of the customer - * - */ - private String customerAddress; - /** - * @field this is use to represent a payment of the customer - * - */ - private String paymentMode; - - /** - * @param customerId - * @param customerName - * @param customerAddress - * @param paymentMode - */ - public Customer(final int customerId, final String customerName, final String customerAddress, - final String paymentMode) { - this.customerId = customerId; - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - } - - /** - * - * @param customerName - * - */ - public Customer(final String customerName) { - - this.customerName = customerName; - - } - - /** - * - * @constructor this is default constructor - * - */ - public Customer() { - - } - - /** - * @return the customerId - */ - public int getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(final int customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - - /** - * @param customerAddress - * the customerAddress to set - */ - public void setCustomerAddress(final String customerAddress) { - this.customerAddress = customerAddress; - } - - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - - /** - * @param paymentMode - * the paymentMode to set - */ - public void setPaymentMode(final String paymentMode) { - this.paymentMode = paymentMode; - } - -} diff --git a/10SuperMarketServlet/src/model/Goods.java b/10SuperMarketServlet/src/model/Goods.java deleted file mode 100644 index 8a0ffeb1..00000000 --- a/10SuperMarketServlet/src/model/Goods.java +++ /dev/null @@ -1,89 +0,0 @@ -package model; - -public class Goods { - - - private int goodsId; - private String goodsName; - private int goodsQuantity; - private double goodsPrice; - - /** - * @param goodsId - * @param goodsName - * @param goodsQuantity - * @param goodsPrice - */ - public Goods(final int goodsId, final String goodsName, final int goodsQuantity, - final double goodsPrice) { - this.goodsId = goodsId; - this.goodsName = goodsName; - this.goodsQuantity = goodsQuantity; - this.goodsPrice = goodsPrice; - } - - public Goods() { - // TODO Auto-generated constructor stub - } - - /** - * @return the goodsId - */ - public int getGoodsId() { - return goodsId; - } - - /** - * @param goodsId - * the goodsId to set - */ - public void setGoodsId(int goodsId) { - this.goodsId = goodsId; - } - - /** - * @return the goodsName - */ - public String getGoodsName() { - return goodsName; - } - - /** - * @param goodsName - * the goodsName to set - */ - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - - /** - * @return the goodsQuantity - */ - public int getGoodsQuantity() { - return goodsQuantity; - } - - /** - * @param goodsQuantity - * the goodsQuantity to set - */ - public void setGoodsQuantity(int goodsQuantity) { - this.goodsQuantity = goodsQuantity; - } - - /** - * @return the goodsPrice - */ - public double getGoodsPrice() { - return goodsPrice; - } - - /** - * @param goodsPrice - * the goodsPrice to set - */ - public void setGoodsPrice(double goodsPrice) { - this.goodsPrice = goodsPrice; - } - -} diff --git a/10SuperMarketServlet/src/model/Retailer.java b/10SuperMarketServlet/src/model/Retailer.java deleted file mode 100644 index db73d143..00000000 --- a/10SuperMarketServlet/src/model/Retailer.java +++ /dev/null @@ -1,68 +0,0 @@ - -package model; - -/** - * @author Ram - * - */ -public class Retailer { - - private String retailerName; - private String retailerAddres; - /** - * @param retailerName - * @param retailerAddres - */ - - public Retailer () - { - - } - - - public Retailer(String retailerName, String retailerAddres) { - this.retailerName = retailerName; - this.retailerAddres = retailerAddres; - } - - /** - * @return the retailerName - */ - public String getRetailerName() { - return retailerName; - } - - /** - * @param retailerName - * the retailerName to set - */ - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - /** - * @return the retailerAddres - */ - public String getRetailerAddres() { - return retailerAddres; - } - - /** - * @param retailerAddres - * the retailerAddres to set - */ - public void setRetailerAddres(String retailerAddres) { - this.retailerAddres = retailerAddres; - } - - - - - - - - - - - -} diff --git a/10SuperMarketServlet/src/model/Supplier.java b/10SuperMarketServlet/src/model/Supplier.java deleted file mode 100644 index 00ffc730..00000000 --- a/10SuperMarketServlet/src/model/Supplier.java +++ /dev/null @@ -1,173 +0,0 @@ -package model; - -import java.util.List; - -/** - * @author Sumit - * - */ -public class Supplier { - - private int supplierId; - private String supplierName; - private String supplierAddress; - private int quantityOrder; - private int orderId; - private double amount; - List goodsList; - - /** - * @param supplierId - * @param supplierName - * @param supplierAddress - * @param quantityOrder - * @param orderId - * @param amount - * @param goodsList - */ - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount, List goodsList) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - this.goodsList = goodsList; - } - - public Supplier() { - // TODO Auto-generated constructor stub - } - - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - } - - /** - * @return the supplierId - */ - public int getSupplierId() { - return supplierId; - } - - /** - * @param supplierId - * the supplierId to set - */ - public void setSupplierId(int supplierId) { - this.supplierId = supplierId; - } - - /** - * @return the supplierName - */ - public String getSupplierName() { - return supplierName; - } - - /** - * @param supplierName - * the supplierName to set - */ - public void setSupplierName(String supplierName) { - this.supplierName = supplierName; - } - - /** - * @return the supplierAddress - */ - public String getSupplierAddress() { - return supplierAddress; - } - - /** - * @param supplierAddress - * the supplierAddress to set - */ - public void setSupplierAddress(String supplierAddress) { - this.supplierAddress = supplierAddress; - } - - /** - * @return the quantityOrder - */ - public int getQuantityOrder() { - return quantityOrder; - } - - /** - * @param quantityOrder - * the quantityOrder to set - */ - public void setQuantityOrder(int quantityOrder) { - this.quantityOrder = quantityOrder; - } - - /** - * @return the orderId - */ - public int getOrderId() { - return orderId; - } - - /** - * @param orderId - * the orderId to set - */ - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - /** - * @return the amount - */ - public double getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(double amount) { - this.amount = amount; - } - - /** - * @return the goodsList - */ - public List getGoodsList() { - return goodsList; - } - - /** - * @param goodsList - * the goodsList to set - */ - public void setGoodsList(List goodsList) { - this.goodsList = goodsList; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Supplier [supplierId=" + supplierId + ", supplierName=" + supplierName + ", supplierAddress=" - + supplierAddress + ", quantityOrder=" + quantityOrder + ", orderId=" + orderId + ", amount=" + amount - + ", goodsList=" + goodsList + "]"; - } - - - - -} diff --git a/10SuperMarketServlet/src/repository/CustomerDAO.java b/10SuperMarketServlet/src/repository/CustomerDAO.java deleted file mode 100644 index cfb9f3b7..00000000 --- a/10SuperMarketServlet/src/repository/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package repository; - -import model.Customer; - -public interface CustomerDAO { - - - public int addCustomer(Customer c); - - - public int updateCustomer(int customerID, String name); - - - public int removeCustomer(int id); -} diff --git a/10SuperMarketServlet/src/repository/CustomerDAOImpl.java b/10SuperMarketServlet/src/repository/CustomerDAOImpl.java deleted file mode 100644 index 4567a72b..00000000 --- a/10SuperMarketServlet/src/repository/CustomerDAOImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Customer; -@Repository -@Qualifier("customerDAO") -public class CustomerDAOImpl implements CustomerDAO { - - /* - * - */ - @Autowired - private JdbcTemplate jdbcTemplate; - - /*public void setJdbcTemplate(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - - - - @Override - public int updateCustomer(final int customerID, final String name) { - - String query = "update customer set customerName=" + "'" + name + "'" + " where customerId=" + customerID; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - - } - - @Override - public int removeCustomer(final int identy) { - final String query = "delete from customer where customerId="+identy; - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int addCustomer(Customer c) { - String query = "insert into customer values('" + c.getCustomerId() + "','" + c.getCustomerName() + "','" - + c.getCustomerAddress() + "','" + c.getPaymentMode() + "')"; - System.out.println(query); - return jdbcTemplate.update(query); - } -} diff --git a/10SuperMarketServlet/src/repository/GoodsDAO.java b/10SuperMarketServlet/src/repository/GoodsDAO.java deleted file mode 100644 index bffefd8c..00000000 --- a/10SuperMarketServlet/src/repository/GoodsDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package repository; - -import model.Goods; - -public interface GoodsDAO { - - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - public int removeGoods(int goodsId); - - public int updateGoods(int goodsId,String goodsName); -} diff --git a/10SuperMarketServlet/src/repository/GoodsDAOImpl.java b/10SuperMarketServlet/src/repository/GoodsDAOImpl.java deleted file mode 100644 index 7a15f84b..00000000 --- a/10SuperMarketServlet/src/repository/GoodsDAOImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Goods; - -/** - * @author Ram - * - */ -@Repository -@Qualifier("GoodsDAO") -public class GoodsDAOImpl implements GoodsDAO { - - // private DataSource dataSource; - - // private JdbcTemplate jdbcTemplate = new JdbcTemplate(); - - /** - * configuring a jdbc template - */ - @Autowired - private JdbcTemplate jdbcTemplate; - - /*public void setJdbcTemplate1(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - String query = "insert into goods values(" + goodsId + "," + "'" + goodsName + "'" + "," + goodsQuantity+ "," - + goodsPrice + ")"; - System.out.println(query); - - return jdbcTemplate.update(query); - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - String query = "update goods set goodsName=" + "'" + goodsName + "'" + " where goodsId=" + goodsId; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int removeGoods(int goodsId) { - - String query = "delete from goods where goodsId=" + goodsId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - /*public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - -} diff --git a/10SuperMarketServlet/src/repository/RetailerDAO.java b/10SuperMarketServlet/src/repository/RetailerDAO.java deleted file mode 100644 index 5e3aeed7..00000000 --- a/10SuperMarketServlet/src/repository/RetailerDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerDAO { - - - int addRetailer(Supplier s); - -public List viewGoods(); - -public List viewCustomer(int customerId ); - -public List viewSupplier(int supplierId); - - -} diff --git a/10SuperMarketServlet/src/repository/RetailerDAOImpl.java b/10SuperMarketServlet/src/repository/RetailerDAOImpl.java deleted file mode 100644 index 91e91ea8..00000000 --- a/10SuperMarketServlet/src/repository/RetailerDAOImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - */ -package repository; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Repository; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ - -@Repository("serviceDAO") -public class RetailerDAOImpl implements RetailerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - /* - * @Override public int viewGoods() { // TODO Auto-generated method stub String - * query = "select * from goods"; System.out.println(query); return - * jdbcTemplate.update(query); - * - * } - */ - - - @Override - public List viewCustomer(final int customerId) { - // TODO Auto-generated method stub - List list = (List) jdbcTemplate.query( - "SELECT * FROM customer where customerId = '" + customerId + "' ", - new BeanPropertyRowMapper(Customer.class)); - System.out.println("In cust view"); - return list; - } - - - @Override - public List viewSupplier(final int supplierId) { - // TODO Auto-generated method stub - List list = (List) jdbcTemplate.query( - "SELECT * FROM supplier where supplierID = '" + supplierId + "' ", - new BeanPropertyRowMapper(Supplier.class)); - System.out.println("In supplier view"); - return list; - } - - - public List viewGoods() { - // TODO Auto-generated method stub - List list = (List) jdbcTemplate.query( - "SELECT * FROM goods", - new BeanPropertyRowMapper(Goods.class)); - System.out.println("In goods view"); - return list; - } - - @Override - public int addRetailer(Supplier s) { - - String query = "insert into retailer values (" + "'" + s.getSupplierName() + "'" + "," + "'" - + s.getSupplierAddress() + "'" + ")"; - System.out.println(query); - return jdbcTemplate.update(query); - } - -} diff --git a/10SuperMarketServlet/src/repository/SupplierDAO.java b/10SuperMarketServlet/src/repository/SupplierDAO.java deleted file mode 100644 index 3adab528..00000000 --- a/10SuperMarketServlet/src/repository/SupplierDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package repository; - -public interface SupplierDAO { - - public int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - - public int removeSupplier(int supplierId); - - public int updateSupplier(int supplierId, String supplierName); - -} diff --git a/10SuperMarketServlet/src/repository/SupplierDAOImpl.java b/10SuperMarketServlet/src/repository/SupplierDAOImpl.java deleted file mode 100644 index f9236a7a..00000000 --- a/10SuperMarketServlet/src/repository/SupplierDAOImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package repository; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - - -@Repository -@Qualifier("supplierDAO") -public class SupplierDAOImpl implements SupplierDAO { - - private DataSource dataSource; -@Autowired -JdbcTemplate jdbcTemplate; - - - - - - - @Override - public int addSupplier(final int supplierId, final String supplierName, final String supplierAddress, final int quantityOrder, final int orderId, - final double amount) { - String Query = "insert into supplier values(" + supplierId + "," + "'" + supplierName + "'" + "," + "'" - + supplierAddress + "'" + "," + quantityOrder + "," + orderId + "," + amount + ")"; - System.out.println(Query); - return jdbcTemplate.update(Query); - } - - @Override - public int removeSupplier(int supplierId) { - - String query = "delete from supplier where supplierId=" + supplierId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - - @Override - public int updateSupplier(int supplierId, String supplierName) { - - String query = "update supplier set supplierName="+"'" +supplierName+"'"+ "where supplierId="+supplierId; - - System.out.println(query); - return jdbcTemplate.update(query); - } -/* - *//** - * @return the jdbcTemplate - *//* - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - *//** - * @param jdbcTemplate - * the jdbcTemplate to set - *//* - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - -} diff --git a/10SuperMarketServlet/src/service/CustomerService.java b/10SuperMarketServlet/src/service/CustomerService.java deleted file mode 100644 index fffc1be3..00000000 --- a/10SuperMarketServlet/src/service/CustomerService.java +++ /dev/null @@ -1,14 +0,0 @@ -package service; - -import model.Customer; - -public interface CustomerService { - - - //public String addCustomer(Customer e); -// public String updateCustomer(int customerID, String name); - //public int removeCustomer(int id); - int addCustomer(Customer c); - int updateCustomer(int customerId, String customerName); - int removeCusotmer(int customerId); -} diff --git a/10SuperMarketServlet/src/service/CustomerServiceImpl.java b/10SuperMarketServlet/src/service/CustomerServiceImpl.java deleted file mode 100644 index 985bf538..00000000 --- a/10SuperMarketServlet/src/service/CustomerServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Customer; -import repository.CustomerDAO; - -/** - * @author Ram - */ -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO customerDAO; - - /** - * @param customerDAO - */ - public CustomerServiceImpl(final CustomerDAO customerDAO) { - super(); - this.customerDAO = customerDAO; - } - - public CustomerServiceImpl() { - // TODO Auto-generated constructor stub - } - - - public int addCustomer(final Customer c) { - final int addData = customerDAO.addCustomer(c); - return addData; - } - - public int updateCustomer(int customerId, String customerName) { - int updateData = customerDAO.updateCustomer(customerId, customerName); - return updateData; - } - - @Override - public int removeCusotmer(int customerId) { - int removeData = customerDAO.removeCustomer(customerId); - return removeData; - } - -} diff --git a/10SuperMarketServlet/src/service/GoodsService.java b/10SuperMarketServlet/src/service/GoodsService.java deleted file mode 100644 index 345474c1..00000000 --- a/10SuperMarketServlet/src/service/GoodsService.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -import model.Goods; - -public interface GoodsService { - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and adding goodsID, name,quantity,price - * - */ - int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and removing a perticular Goods from table - * - */ - int removeGoods(int goodsId); - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and updating a perticular Goods - * - */ - int updateGoods(int goodsId, String goodsName); - // public String orderGoods(int goodsId); - -} diff --git a/10SuperMarketServlet/src/service/GoodsServiceImpl.java b/10SuperMarketServlet/src/service/GoodsServiceImpl.java deleted file mode 100644 index 92d25e31..00000000 --- a/10SuperMarketServlet/src/service/GoodsServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Goods; -import repository.GoodsDAO; - -@Service("goodsService") -public class GoodsServiceImpl implements GoodsService { - - public GoodsServiceImpl() { - - } - - @Autowired - private GoodsDAO goodsdao; - - public GoodsServiceImpl(final GoodsDAO goodsdao) { - super(); - this.goodsdao = goodsdao; - } - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - - int addData = goodsdao.addGoods(goodsId,goodsName,goodsQuantity,goodsPrice); - return addData; - } - - @Override - public int removeGoods(int goodsId) { - // GoodsDAO goodsDAO = null; - int remmoveData = goodsdao.removeGoods(goodsId); - return remmoveData; - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - // GoodsDAO goodsDAO = null; - int updateData = goodsdao.updateGoods(goodsId, goodsName); - return updateData; - } - -} diff --git a/10SuperMarketServlet/src/service/RetailerService.java b/10SuperMarketServlet/src/service/RetailerService.java deleted file mode 100644 index 536690d0..00000000 --- a/10SuperMarketServlet/src/service/RetailerService.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerService { - - //int addSupplier(String supplierName, String supplierAddress); - - int addRetailer(Supplier s); - - -public List viewGoods(); - -public List viewCustomer(int customerId ); - -public List viewSupplier(int supplierId); - - -} diff --git a/10SuperMarketServlet/src/service/RetailerServiceImpl.java b/10SuperMarketServlet/src/service/RetailerServiceImpl.java deleted file mode 100644 index 3f2b8921..00000000 --- a/10SuperMarketServlet/src/service/RetailerServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - */ -package service; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Customer; -import model.Goods; -import model.Supplier; -import repository.CustomerDAO; -import repository.RetailerDAO; -import repository.RetailerDAOImpl; - -/** - * @author trainee - * - */ -@Service("retailerService") -public class RetailerServiceImpl implements RetailerService { - - @Autowired - private RetailerDAO retailerDao; - - @Override - public int addRetailer(final Supplier s) { - - return retailerDao.addRetailer(s); - - } - - public List viewCustomer(int customerId ) { - List customerList = new ArrayList(); - customerList = retailerDao.viewCustomer(customerId); - return customerList; - } - - @Override - public List viewSupplier(final int supplierId) { - // TODO Auto-generated method stub - return retailerDao.viewSupplier(supplierId); - } - - @Override - public List viewGoods() { - // TODO Auto-generated method stub - return retailerDao.viewGoods(); - } - -} diff --git a/10SuperMarketServlet/src/service/SupplierService.java b/10SuperMarketServlet/src/service/SupplierService.java deleted file mode 100644 index b230abd2..00000000 --- a/10SuperMarketServlet/src/service/SupplierService.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -/** - * this interface contains various operations. - */ -public interface SupplierService { - - /** - * this method is used to invoke the Repository method addSupplier - * which will hit the databases. - * - */ - int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - /** - * this method is used to invoke the Repository method removeSupplier - * which will hit the databases. - * - */ - int removeSupplier(int supplierId); - - /** - * this method is used to invoke the Repository method addSupplier - * which will hit the databases. - * - */ - int updateSupplier(int supplierId,String supplierName); - -} diff --git a/10SuperMarketServlet/src/service/SupplierServiceImpl.java b/10SuperMarketServlet/src/service/SupplierServiceImpl.java deleted file mode 100644 index 1ea11f11..00000000 --- a/10SuperMarketServlet/src/service/SupplierServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import repository.SupplierDAO; - -/** - * this class implementing methods of its parent interface - */ - -@Service("supplierService") -public class SupplierServiceImpl implements SupplierService { - - /** - * @param supplierDAO - * this will be used to access DAO methods - */ - @Autowired - private SupplierDAO supplierDAO; - - /** - * @param supplierDAO - */ - - @Override - public int addSupplier(final int supplierId, final String supplierName, final String supplierAddress, - final int quantityOrder, final int orderId, final double amount) { - - // SupplierDAO supplierDAO = null; - final int addData = supplierDAO.addSupplier(supplierId, supplierName, supplierAddress, quantityOrder, orderId, - amount); - return addData; - - } - - @Override - public int removeSupplier(final int supplierId) { - // final SupplierDAO supplierDAO = null; - final int removeData = supplierDAO.removeSupplier(supplierId); - return removeData; - } - - @Override - public int updateSupplier(final int supplierId, final String supplierName) { - final SupplierDAO supplierDAO = null; - int removeData = supplierDAO.updateSupplier(supplierId, supplierName); - return removeData; - } - -} diff --git a/11SpringBootUsingJDBC/.gitignore b/11SpringBootUsingJDBC/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/11SpringBootUsingJDBC/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/11SpringBootUsingJDBC/.mvn/wrapper/maven-wrapper.jar b/11SpringBootUsingJDBC/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/11SpringBootUsingJDBC/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/11SpringBootUsingJDBC/.mvn/wrapper/maven-wrapper.properties b/11SpringBootUsingJDBC/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/11SpringBootUsingJDBC/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/11SpringBootUsingJDBC/bin/.gitignore b/11SpringBootUsingJDBC/bin/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/11SpringBootUsingJDBC/bin/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/11SpringBootUsingJDBC/bin/.mvn/wrapper/maven-wrapper.jar b/11SpringBootUsingJDBC/bin/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/11SpringBootUsingJDBC/bin/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/11SpringBootUsingJDBC/bin/.mvn/wrapper/maven-wrapper.properties b/11SpringBootUsingJDBC/bin/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/11SpringBootUsingJDBC/bin/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/11SpringBootUsingJDBC/bin/mvnw b/11SpringBootUsingJDBC/bin/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/11SpringBootUsingJDBC/bin/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/11SpringBootUsingJDBC/bin/mvnw.cmd b/11SpringBootUsingJDBC/bin/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/11SpringBootUsingJDBC/bin/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/11SpringBootUsingJDBC/bin/pom.xml b/11SpringBootUsingJDBC/bin/pom.xml deleted file mode 100644 index 2d1e8c87..00000000 --- a/11SpringBootUsingJDBC/bin/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - 4.0.0 - - com.example - demo - 0.0.1-SNAPSHOT - jar - - demo - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/11SpringBootUsingJDBC/bin/src/main/java/com/example/demo/DemoApplication.class b/11SpringBootUsingJDBC/bin/src/main/java/com/example/demo/DemoApplication.class deleted file mode 100644 index 54d0e034..00000000 Binary files a/11SpringBootUsingJDBC/bin/src/main/java/com/example/demo/DemoApplication.class and /dev/null differ diff --git a/11SpringBootUsingJDBC/bin/src/main/resources/application.properties b/11SpringBootUsingJDBC/bin/src/main/resources/application.properties deleted file mode 100644 index e69de29b..00000000 diff --git a/11SpringBootUsingJDBC/bin/src/test/java/com/example/demo/DemoApplicationTests.class b/11SpringBootUsingJDBC/bin/src/test/java/com/example/demo/DemoApplicationTests.class deleted file mode 100644 index 37114bbd..00000000 Binary files a/11SpringBootUsingJDBC/bin/src/test/java/com/example/demo/DemoApplicationTests.class and /dev/null differ diff --git a/11SpringBootUsingJDBC/mvnw b/11SpringBootUsingJDBC/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/11SpringBootUsingJDBC/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/11SpringBootUsingJDBC/mvnw.cmd b/11SpringBootUsingJDBC/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/11SpringBootUsingJDBC/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/11SpringBootUsingJDBC/pom.xml b/11SpringBootUsingJDBC/pom.xml deleted file mode 100644 index 5652055f..00000000 --- a/11SpringBootUsingJDBC/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - 4.0.0 - - com.example - demo - 0.0.1-SNAPSHOT - jar - - demo - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - jstl - jstl - 1.2 - - - mysql - mysql-connector-java - 5.1.38 - - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet.java b/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet.java deleted file mode 100644 index 68892074..00000000 --- a/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet.java +++ /dev/null @@ -1,62 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import model.Goods; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - // CustomerService customerService = (CustomerService) - // context.getBean("customerService",CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - - final String ID = request.getParameter("id"); - final int id = Integer.parseInt(ID); - - List customerList = retailerService.viewCustomer(id); - // List goodsList = retailerService.viewGoods(); - - // request.setAttribute("glist", goodsList); - request.setAttribute("list", customerList); - - RequestDispatcher requestDispatcher = request.getRequestDispatcher("home1.jsp"); - // RequestDispatcher requestDispatchergoods = - // request.getRequestDispatcher("viewgoods.jsp"); - requestDispatcher.forward(request, response); - // requestDispatchergoods.forward(request, response); - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet2.java b/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet2.java deleted file mode 100644 index 8d1b4e97..00000000 --- a/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet2.java +++ /dev/null @@ -1,57 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import model.Goods; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet2 extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - //CustomerService customerService = (CustomerService) context.getBean("customerService",CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - // List customerList = retailerService.viewCustomer(106); - List goodsList = retailerService.viewGoods(); - - - - request.setAttribute("glist", goodsList); - // request.setAttribute("list", customerList); - - // RequestDispatcher requestDispatcher = request.getRequestDispatcher("home1.jsp"); - RequestDispatcher requestDispatchergoods = request.getRequestDispatcher("viewgoods.jsp"); - //requestDispatcher.forward(request, response); - requestDispatchergoods.forward(request, response); - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet3.java b/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet3.java deleted file mode 100644 index ec8ecce7..00000000 --- a/11SpringBootUsingJDBC/src/main/java/MainServlet/DemoServlet3.java +++ /dev/null @@ -1,72 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import model.Goods; -import model.Supplier; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet3 extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - //CustomerService customerService = (CustomerService) context.getBean("customerService",CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - - - String ID = request.getParameter("id1"); - try { - int id1 = Integer.parseInt(ID); - - - - - // List customerList = retailerService.viewCustomer(106); - - List supplierList = retailerService.viewSupplier(id1); - - - - - request.setAttribute("slist", supplierList); - // request.setAttribute("list", customerList); - - // RequestDispatcher requestDispatcher = request.getRequestDispatcher("home1.jsp"); - RequestDispatcher requestDispatcherSupplier = request.getRequestDispatcher("viewsupplier.jsp"); - //requestDispatcher.forward(request, response); - requestDispatcherSupplier.forward(request, response); - }catch (NumberFormatException e){ - System.out.println("not a number"); - } - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/com/example/demo/CustomErrorType.java b/11SpringBootUsingJDBC/src/main/java/com/example/demo/CustomErrorType.java deleted file mode 100644 index 0de185b3..00000000 --- a/11SpringBootUsingJDBC/src/main/java/com/example/demo/CustomErrorType.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.demo; - - -public class CustomErrorType { - - private String errorMessage; - - public CustomErrorType(String errorMessage){ - this.errorMessage = errorMessage; - } - - public String getErrorMessage() { - return errorMessage; - } - -} \ No newline at end of file diff --git a/11SpringBootUsingJDBC/src/main/java/com/example/demo/CustomersOp.java b/11SpringBootUsingJDBC/src/main/java/com/example/demo/CustomersOp.java deleted file mode 100644 index 8f1c7782..00000000 --- a/11SpringBootUsingJDBC/src/main/java/com/example/demo/CustomersOp.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.example.demo; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import model.Customer; -import service.CustomerService; -import service.RetailerService; - -@RestController -public class CustomersOp { - - @Autowired - private RetailerService rs; - - @Autowired - private CustomerService customerService; - - // - @RequestMapping(value = "/user/{customerId}", method = RequestMethod.GET) - public ResponseEntity getUser(@PathVariable("customerId") int customerId) { - System.out.printf("User with id {} is :", customerId); - List user = rs.viewCustomer(customerId); - if (user == null) { - System.out.printf("User with id {} not found.", customerId); - return new ResponseEntity(new CustomErrorType("User with id " + customerId + " not found"), - HttpStatus.NOT_FOUND); - } - return new ResponseEntity(user, HttpStatus.OK); - } - - // Add customer - - @RequestMapping(value = "/addNewCustomer", method = RequestMethod.GET) - public Customer NewUser() { - - Customer c = new Customer(24, "hulk", "newyork", "Debit"); - customerService.addCustomer(c); - - return null; - - } - - @RequestMapping(value = "/deleteuser/{id}", method = RequestMethod.GET) - public Customer deleteUser(@PathVariable("id") int id) { - System.out.printf("Fetching & Deleting User with id {}", id); - - customerService.removeCusotmer(id); - return null; - } - - @RequestMapping(value = "/updateuser/{id}/{name}", method = RequestMethod.GET) - @ResponseBody - public int updateUser(@PathVariable("id") int id, @PathVariable("name") String name) { - System.out.printf("Updating User with id {}", id); - - final int dummy = customerService.updateCustomer(id, name); - - return dummy; - } - - /* - * @RequestMapping("/showcustomer") public @ResponseBody List - * addCustomer() { System.out.println("hi"); //return "hi to browser"; - * - * //ApplicationContext context = new - * AnnotationConfigApplicationContext(AppJavaConfig.class); //CustomerService - * customerService = (CustomerService) - * context.getBean("customerService",CustomerServiceImpl.class); RetailerService - * retailerService = (RetailerService) context.getBean("retailerService", - * RetailerServiceImpl.class); - * - * - * - * List customerList = rs.viewCustomer(1); - * - * return customerList; - * - * - * - * - * - * - * } - */ -} diff --git a/11SpringBootUsingJDBC/src/main/java/com/example/demo/DemoApplication.java b/11SpringBootUsingJDBC/src/main/java/com/example/demo/DemoApplication.java deleted file mode 100644 index 44c49287..00000000 --- a/11SpringBootUsingJDBC/src/main/java/com/example/demo/DemoApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; - -@SpringBootApplication -@ComponentScan({ "service", "repository", "controller", "com.example.demo" }) -public class DemoApplication { - - public static void main(String[] args) { - - SpringApplication.run(DemoApplication.class, args); - - System.out.println("HEllo World"); - - } -} diff --git a/11SpringBootUsingJDBC/src/main/java/controller/AppJavaConfig.java b/11SpringBootUsingJDBC/src/main/java/controller/AppJavaConfig.java deleted file mode 100644 index 6aca2c56..00000000 --- a/11SpringBootUsingJDBC/src/main/java/controller/AppJavaConfig.java +++ /dev/null @@ -1,76 +0,0 @@ -package controller; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -/** - * @class this is java configuration file - */ -@Configuration -@ComponentScan({ "service", "repository", "controller" }) -@PropertySource(value = { "classpath:database.properties" }) -public class AppJavaConfig { - - @Autowired - Environment environment; - - @Bean - DataSource dataSource() { - final DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource(); - driverManagerDataSource.setUrl(environment.getProperty("url")); - driverManagerDataSource.setUsername(environment.getProperty("dbuser")); - driverManagerDataSource.setPassword(environment.getProperty("dbpassword")); - driverManagerDataSource.setDriverClassName(environment.getProperty("driver")); - return driverManagerDataSource; - } - - @Bean - JdbcTemplate jdbcTempalte(DataSource dataSource) { - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - return jdbcTemplate; - } - - - /* - * @Bean public CustomerDAO customerDaoBean() { return new CustomerDAOImpl(); } - * - * @Bean public GoodsDAO goodsDAOBean() { return new GoodsDAOImpl(); } - * - * @Bean public SupplierDAO supplierDAOBean() { return new SupplierDAOImpl(); } - */ - - /** - * this is CustomerService bean used to invoke the services - */ - /* - * @Bean public RetailerDAO retailerDAOBean() { return new RetailerDAOImpl(); } - * - *//** - * this is CustomerService bean used to invoke the services - *//* - * @Bean public CustomerService customerService() { return new - * CustomerServiceImpl(); } - */ - - /** - * this is GoodsService bean used to invoke the services - */ - /* - * @Bean public GoodsService goodsService() { return new GoodsServiceImpl(); } - * - * @Bean public SupplierService supplierService() { return new - * SupplierServiceImpl(); } - * - * @Bean public RetailerService retailerService() { return new - * RetailerServiceImpl(); } - */ - -} diff --git a/11SpringBootUsingJDBC/src/main/java/model/Customer.java b/11SpringBootUsingJDBC/src/main/java/model/Customer.java deleted file mode 100644 index 86ec6b13..00000000 --- a/11SpringBootUsingJDBC/src/main/java/model/Customer.java +++ /dev/null @@ -1,133 +0,0 @@ -package model; - -/** - * @author Ram - * - */ - - - - -/** - * @class this class represent a customer entity - * - */ -public class Customer { - - /** - * @field this is use to provide particular id which will represent a whole - * record in table - */ - private int customerId; - - /** - * @field this is use to provide particular id which will represent a whole - * record in table - */ - private String customerName; - /** - * @field this is use to represent a name of the customer - * - */ - private String customerAddress; - /** - * @field this is use to represent a payment of the customer - * - */ - private String paymentMode; - - /** - * @param customerId - * @param customerName - * @param customerAddress - * @param paymentMode - */ - public Customer(final int customerId, final String customerName, final String customerAddress, - final String paymentMode) { - this.customerId = customerId; - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - } - - /** - * - * @param customerName - * - */ - public Customer(final String customerName) { - - this.customerName = customerName; - - } - - /** - * - * @constructor this is default constructor - * - */ - public Customer() { - - } - - /** - * @return the customerId - */ - public int getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(final int customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - - /** - * @param customerAddress - * the customerAddress to set - */ - public void setCustomerAddress(final String customerAddress) { - this.customerAddress = customerAddress; - } - - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - - /** - * @param paymentMode - * the paymentMode to set - */ - public void setPaymentMode(final String paymentMode) { - this.paymentMode = paymentMode; - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/model/Goods.java b/11SpringBootUsingJDBC/src/main/java/model/Goods.java deleted file mode 100644 index 8a0ffeb1..00000000 --- a/11SpringBootUsingJDBC/src/main/java/model/Goods.java +++ /dev/null @@ -1,89 +0,0 @@ -package model; - -public class Goods { - - - private int goodsId; - private String goodsName; - private int goodsQuantity; - private double goodsPrice; - - /** - * @param goodsId - * @param goodsName - * @param goodsQuantity - * @param goodsPrice - */ - public Goods(final int goodsId, final String goodsName, final int goodsQuantity, - final double goodsPrice) { - this.goodsId = goodsId; - this.goodsName = goodsName; - this.goodsQuantity = goodsQuantity; - this.goodsPrice = goodsPrice; - } - - public Goods() { - // TODO Auto-generated constructor stub - } - - /** - * @return the goodsId - */ - public int getGoodsId() { - return goodsId; - } - - /** - * @param goodsId - * the goodsId to set - */ - public void setGoodsId(int goodsId) { - this.goodsId = goodsId; - } - - /** - * @return the goodsName - */ - public String getGoodsName() { - return goodsName; - } - - /** - * @param goodsName - * the goodsName to set - */ - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - - /** - * @return the goodsQuantity - */ - public int getGoodsQuantity() { - return goodsQuantity; - } - - /** - * @param goodsQuantity - * the goodsQuantity to set - */ - public void setGoodsQuantity(int goodsQuantity) { - this.goodsQuantity = goodsQuantity; - } - - /** - * @return the goodsPrice - */ - public double getGoodsPrice() { - return goodsPrice; - } - - /** - * @param goodsPrice - * the goodsPrice to set - */ - public void setGoodsPrice(double goodsPrice) { - this.goodsPrice = goodsPrice; - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/model/Retailer.java b/11SpringBootUsingJDBC/src/main/java/model/Retailer.java deleted file mode 100644 index db73d143..00000000 --- a/11SpringBootUsingJDBC/src/main/java/model/Retailer.java +++ /dev/null @@ -1,68 +0,0 @@ - -package model; - -/** - * @author Ram - * - */ -public class Retailer { - - private String retailerName; - private String retailerAddres; - /** - * @param retailerName - * @param retailerAddres - */ - - public Retailer () - { - - } - - - public Retailer(String retailerName, String retailerAddres) { - this.retailerName = retailerName; - this.retailerAddres = retailerAddres; - } - - /** - * @return the retailerName - */ - public String getRetailerName() { - return retailerName; - } - - /** - * @param retailerName - * the retailerName to set - */ - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - /** - * @return the retailerAddres - */ - public String getRetailerAddres() { - return retailerAddres; - } - - /** - * @param retailerAddres - * the retailerAddres to set - */ - public void setRetailerAddres(String retailerAddres) { - this.retailerAddres = retailerAddres; - } - - - - - - - - - - - -} diff --git a/11SpringBootUsingJDBC/src/main/java/model/Supplier.java b/11SpringBootUsingJDBC/src/main/java/model/Supplier.java deleted file mode 100644 index 00ffc730..00000000 --- a/11SpringBootUsingJDBC/src/main/java/model/Supplier.java +++ /dev/null @@ -1,173 +0,0 @@ -package model; - -import java.util.List; - -/** - * @author Sumit - * - */ -public class Supplier { - - private int supplierId; - private String supplierName; - private String supplierAddress; - private int quantityOrder; - private int orderId; - private double amount; - List goodsList; - - /** - * @param supplierId - * @param supplierName - * @param supplierAddress - * @param quantityOrder - * @param orderId - * @param amount - * @param goodsList - */ - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount, List goodsList) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - this.goodsList = goodsList; - } - - public Supplier() { - // TODO Auto-generated constructor stub - } - - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - } - - /** - * @return the supplierId - */ - public int getSupplierId() { - return supplierId; - } - - /** - * @param supplierId - * the supplierId to set - */ - public void setSupplierId(int supplierId) { - this.supplierId = supplierId; - } - - /** - * @return the supplierName - */ - public String getSupplierName() { - return supplierName; - } - - /** - * @param supplierName - * the supplierName to set - */ - public void setSupplierName(String supplierName) { - this.supplierName = supplierName; - } - - /** - * @return the supplierAddress - */ - public String getSupplierAddress() { - return supplierAddress; - } - - /** - * @param supplierAddress - * the supplierAddress to set - */ - public void setSupplierAddress(String supplierAddress) { - this.supplierAddress = supplierAddress; - } - - /** - * @return the quantityOrder - */ - public int getQuantityOrder() { - return quantityOrder; - } - - /** - * @param quantityOrder - * the quantityOrder to set - */ - public void setQuantityOrder(int quantityOrder) { - this.quantityOrder = quantityOrder; - } - - /** - * @return the orderId - */ - public int getOrderId() { - return orderId; - } - - /** - * @param orderId - * the orderId to set - */ - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - /** - * @return the amount - */ - public double getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(double amount) { - this.amount = amount; - } - - /** - * @return the goodsList - */ - public List getGoodsList() { - return goodsList; - } - - /** - * @param goodsList - * the goodsList to set - */ - public void setGoodsList(List goodsList) { - this.goodsList = goodsList; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Supplier [supplierId=" + supplierId + ", supplierName=" + supplierName + ", supplierAddress=" - + supplierAddress + ", quantityOrder=" + quantityOrder + ", orderId=" + orderId + ", amount=" + amount - + ", goodsList=" + goodsList + "]"; - } - - - - -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/CustomerDAO.java b/11SpringBootUsingJDBC/src/main/java/repository/CustomerDAO.java deleted file mode 100644 index cfb9f3b7..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package repository; - -import model.Customer; - -public interface CustomerDAO { - - - public int addCustomer(Customer c); - - - public int updateCustomer(int customerID, String name); - - - public int removeCustomer(int id); -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/CustomerDAOImpl.java b/11SpringBootUsingJDBC/src/main/java/repository/CustomerDAOImpl.java deleted file mode 100644 index 4567a72b..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/CustomerDAOImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Customer; -@Repository -@Qualifier("customerDAO") -public class CustomerDAOImpl implements CustomerDAO { - - /* - * - */ - @Autowired - private JdbcTemplate jdbcTemplate; - - /*public void setJdbcTemplate(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - - - - @Override - public int updateCustomer(final int customerID, final String name) { - - String query = "update customer set customerName=" + "'" + name + "'" + " where customerId=" + customerID; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - - } - - @Override - public int removeCustomer(final int identy) { - final String query = "delete from customer where customerId="+identy; - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int addCustomer(Customer c) { - String query = "insert into customer values('" + c.getCustomerId() + "','" + c.getCustomerName() + "','" - + c.getCustomerAddress() + "','" + c.getPaymentMode() + "')"; - System.out.println(query); - return jdbcTemplate.update(query); - } -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/GoodsDAO.java b/11SpringBootUsingJDBC/src/main/java/repository/GoodsDAO.java deleted file mode 100644 index bffefd8c..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/GoodsDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package repository; - -import model.Goods; - -public interface GoodsDAO { - - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - public int removeGoods(int goodsId); - - public int updateGoods(int goodsId,String goodsName); -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/GoodsDAOImpl.java b/11SpringBootUsingJDBC/src/main/java/repository/GoodsDAOImpl.java deleted file mode 100644 index 7a15f84b..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/GoodsDAOImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Goods; - -/** - * @author Ram - * - */ -@Repository -@Qualifier("GoodsDAO") -public class GoodsDAOImpl implements GoodsDAO { - - // private DataSource dataSource; - - // private JdbcTemplate jdbcTemplate = new JdbcTemplate(); - - /** - * configuring a jdbc template - */ - @Autowired - private JdbcTemplate jdbcTemplate; - - /*public void setJdbcTemplate1(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - String query = "insert into goods values(" + goodsId + "," + "'" + goodsName + "'" + "," + goodsQuantity+ "," - + goodsPrice + ")"; - System.out.println(query); - - return jdbcTemplate.update(query); - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - String query = "update goods set goodsName=" + "'" + goodsName + "'" + " where goodsId=" + goodsId; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int removeGoods(int goodsId) { - - String query = "delete from goods where goodsId=" + goodsId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - /*public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/RetailerDAO.java b/11SpringBootUsingJDBC/src/main/java/repository/RetailerDAO.java deleted file mode 100644 index 5e3aeed7..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/RetailerDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerDAO { - - - int addRetailer(Supplier s); - -public List viewGoods(); - -public List viewCustomer(int customerId ); - -public List viewSupplier(int supplierId); - - -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/RetailerDAOImpl.java b/11SpringBootUsingJDBC/src/main/java/repository/RetailerDAOImpl.java deleted file mode 100644 index f8dfb848..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/RetailerDAOImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ - -@Repository -public class RetailerDAOImpl implements RetailerDAO { - - @Autowired - private JdbcTemplate jdbcTemplate; - - /* - * @Override public int viewGoods() { // TODO Auto-generated method stub String - * query = "select * from goods"; System.out.println(query); return - * jdbcTemplate.update(query); - * - * } - */ - - - @Override - public List viewCustomer(final int customerId) { - // TODO Auto-generated method stub - List list = (List) jdbcTemplate.query( - "SELECT * FROM customer where customerId = '" + customerId + "' ", - new BeanPropertyRowMapper(Customer.class)); - System.out.println("In cust view"); - return list; - } - - - @Override - public List viewSupplier(final int supplierId) { - // TODO Auto-generated method stub - List list = (List) jdbcTemplate.query( - "SELECT * FROM supplier where supplierID = '" + supplierId + "' ", - new BeanPropertyRowMapper(Supplier.class)); - System.out.println("In supplier view"); - return list; - } - - - public List viewGoods() { - // TODO Auto-generated method stub - List list = (List) jdbcTemplate.query( - "SELECT * FROM goods", - new BeanPropertyRowMapper(Goods.class)); - System.out.println("In goods view"); - return list; - } - - @Override - public int addRetailer(Supplier s) { - - String query = "insert into retailer values (" + "'" + s.getSupplierName() + "'" + "," + "'" - + s.getSupplierAddress() + "'" + ")"; - System.out.println(query); - return jdbcTemplate.update(query); - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/SupplierDAO.java b/11SpringBootUsingJDBC/src/main/java/repository/SupplierDAO.java deleted file mode 100644 index 3adab528..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/SupplierDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package repository; - -public interface SupplierDAO { - - public int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - - public int removeSupplier(int supplierId); - - public int updateSupplier(int supplierId, String supplierName); - -} diff --git a/11SpringBootUsingJDBC/src/main/java/repository/SupplierDAOImpl.java b/11SpringBootUsingJDBC/src/main/java/repository/SupplierDAOImpl.java deleted file mode 100644 index f9236a7a..00000000 --- a/11SpringBootUsingJDBC/src/main/java/repository/SupplierDAOImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package repository; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - - -@Repository -@Qualifier("supplierDAO") -public class SupplierDAOImpl implements SupplierDAO { - - private DataSource dataSource; -@Autowired -JdbcTemplate jdbcTemplate; - - - - - - - @Override - public int addSupplier(final int supplierId, final String supplierName, final String supplierAddress, final int quantityOrder, final int orderId, - final double amount) { - String Query = "insert into supplier values(" + supplierId + "," + "'" + supplierName + "'" + "," + "'" - + supplierAddress + "'" + "," + quantityOrder + "," + orderId + "," + amount + ")"; - System.out.println(Query); - return jdbcTemplate.update(Query); - } - - @Override - public int removeSupplier(int supplierId) { - - String query = "delete from supplier where supplierId=" + supplierId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - - @Override - public int updateSupplier(int supplierId, String supplierName) { - - String query = "update supplier set supplierName="+"'" +supplierName+"'"+ "where supplierId="+supplierId; - - System.out.println(query); - return jdbcTemplate.update(query); - } -/* - *//** - * @return the jdbcTemplate - *//* - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - *//** - * @param jdbcTemplate - * the jdbcTemplate to set - *//* - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - }*/ - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/CustomerService.java b/11SpringBootUsingJDBC/src/main/java/service/CustomerService.java deleted file mode 100644 index fffc1be3..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/CustomerService.java +++ /dev/null @@ -1,14 +0,0 @@ -package service; - -import model.Customer; - -public interface CustomerService { - - - //public String addCustomer(Customer e); -// public String updateCustomer(int customerID, String name); - //public int removeCustomer(int id); - int addCustomer(Customer c); - int updateCustomer(int customerId, String customerName); - int removeCusotmer(int customerId); -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/CustomerServiceImpl.java b/11SpringBootUsingJDBC/src/main/java/service/CustomerServiceImpl.java deleted file mode 100644 index 08932ccc..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/CustomerServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Customer; -import repository.CustomerDAO; - -/** - * @author Ram - */ -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO customerDAO; - - /** - * @param customerDAO - */ - public CustomerServiceImpl(final CustomerDAO customerDAO) { - super(); - this.customerDAO = customerDAO; - } - - - - public int addCustomer(final Customer c) { - final int addData = customerDAO.addCustomer(c); - return addData; - } - - public int updateCustomer(int customerId, String customerName) { - int updateData = customerDAO.updateCustomer(customerId, customerName); - return updateData; - } - - @Override - public int removeCusotmer(int customerId) { - int removeData = customerDAO.removeCustomer(customerId); - return removeData; - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/GoodsService.java b/11SpringBootUsingJDBC/src/main/java/service/GoodsService.java deleted file mode 100644 index 345474c1..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/GoodsService.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -import model.Goods; - -public interface GoodsService { - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and adding goodsID, name,quantity,price - * - */ - int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and removing a perticular Goods from table - * - */ - int removeGoods(int goodsId); - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and updating a perticular Goods - * - */ - int updateGoods(int goodsId, String goodsName); - // public String orderGoods(int goodsId); - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/GoodsServiceImpl.java b/11SpringBootUsingJDBC/src/main/java/service/GoodsServiceImpl.java deleted file mode 100644 index bd8049c7..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/GoodsServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Goods; -import repository.GoodsDAO; - -@Service("goodsService") -public class GoodsServiceImpl implements GoodsService { - - - @Autowired - private GoodsDAO goodsdao; - - public GoodsServiceImpl(final GoodsDAO goodsdao) { - super(); - this.goodsdao = goodsdao; - } - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - - int addData = goodsdao.addGoods(goodsId,goodsName,goodsQuantity,goodsPrice); - return addData; - } - - @Override - public int removeGoods(int goodsId) { - // GoodsDAO goodsDAO = null; - int remmoveData = goodsdao.removeGoods(goodsId); - return remmoveData; - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - // GoodsDAO goodsDAO = null; - int updateData = goodsdao.updateGoods(goodsId, goodsName); - return updateData; - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/RetailerService.java b/11SpringBootUsingJDBC/src/main/java/service/RetailerService.java deleted file mode 100644 index 536690d0..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/RetailerService.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerService { - - //int addSupplier(String supplierName, String supplierAddress); - - int addRetailer(Supplier s); - - -public List viewGoods(); - -public List viewCustomer(int customerId ); - -public List viewSupplier(int supplierId); - - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/RetailerServiceImpl.java b/11SpringBootUsingJDBC/src/main/java/service/RetailerServiceImpl.java deleted file mode 100644 index 0dd0c4a1..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/RetailerServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - */ -package service; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Customer; -import model.Goods; -import model.Supplier; -import repository.CustomerDAO; -import repository.RetailerDAO; -import repository.RetailerDAOImpl; - -/** - * @author trainee - * - */ -@Service -public class RetailerServiceImpl implements RetailerService { - - @Autowired - private RetailerDAO retailerDao; - - @Override - public int addRetailer(final Supplier s) { - - return retailerDao.addRetailer(s); - - } - - public List viewCustomer(int customerId ) { - List customerList = new ArrayList(); - customerList = retailerDao.viewCustomer(customerId); - return customerList; - } - - @Override - public List viewSupplier(final int supplierId) { - // TODO Auto-generated method stub - return retailerDao.viewSupplier(supplierId); - } - - @Override - public List viewGoods() { - // TODO Auto-generated method stub - return retailerDao.viewGoods(); - } - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/SupplierService.java b/11SpringBootUsingJDBC/src/main/java/service/SupplierService.java deleted file mode 100644 index b230abd2..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/SupplierService.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -/** - * this interface contains various operations. - */ -public interface SupplierService { - - /** - * this method is used to invoke the Repository method addSupplier - * which will hit the databases. - * - */ - int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - /** - * this method is used to invoke the Repository method removeSupplier - * which will hit the databases. - * - */ - int removeSupplier(int supplierId); - - /** - * this method is used to invoke the Repository method addSupplier - * which will hit the databases. - * - */ - int updateSupplier(int supplierId,String supplierName); - -} diff --git a/11SpringBootUsingJDBC/src/main/java/service/SupplierServiceImpl.java b/11SpringBootUsingJDBC/src/main/java/service/SupplierServiceImpl.java deleted file mode 100644 index 1ea11f11..00000000 --- a/11SpringBootUsingJDBC/src/main/java/service/SupplierServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import repository.SupplierDAO; - -/** - * this class implementing methods of its parent interface - */ - -@Service("supplierService") -public class SupplierServiceImpl implements SupplierService { - - /** - * @param supplierDAO - * this will be used to access DAO methods - */ - @Autowired - private SupplierDAO supplierDAO; - - /** - * @param supplierDAO - */ - - @Override - public int addSupplier(final int supplierId, final String supplierName, final String supplierAddress, - final int quantityOrder, final int orderId, final double amount) { - - // SupplierDAO supplierDAO = null; - final int addData = supplierDAO.addSupplier(supplierId, supplierName, supplierAddress, quantityOrder, orderId, - amount); - return addData; - - } - - @Override - public int removeSupplier(final int supplierId) { - // final SupplierDAO supplierDAO = null; - final int removeData = supplierDAO.removeSupplier(supplierId); - return removeData; - } - - @Override - public int updateSupplier(final int supplierId, final String supplierName) { - final SupplierDAO supplierDAO = null; - int removeData = supplierDAO.updateSupplier(supplierId, supplierName); - return removeData; - } - -} diff --git a/11SpringBootUsingJDBC/src/main/resources/application.properties b/11SpringBootUsingJDBC/src/main/resources/application.properties deleted file mode 100644 index e69de29b..00000000 diff --git a/11SpringBootUsingJDBC/src/main/resources/database.properties b/11SpringBootUsingJDBC/src/main/resources/database.properties deleted file mode 100644 index 9c1f900e..00000000 --- a/11SpringBootUsingJDBC/src/main/resources/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=com.mysql.jdbc.Driver -url=jdbc:mysql://localhost:3306/mydb1 -dbuser=root -dbpassword=root \ No newline at end of file diff --git a/11SpringBootUsingJDBC/src/test/java/com/example/demo/DemoApplicationTests.java b/11SpringBootUsingJDBC/src/test/java/com/example/demo/DemoApplicationTests.java deleted file mode 100644 index b76e7f2e..00000000 --- a/11SpringBootUsingJDBC/src/test/java/com/example/demo/DemoApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.demo; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class DemoApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/12SpringBoot&JPA/.gitignore b/12SpringBoot&JPA/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/12SpringBoot&JPA/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/12SpringBoot&JPA/.mvn/wrapper/maven-wrapper.jar b/12SpringBoot&JPA/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/12SpringBoot&JPA/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/12SpringBoot&JPA/.mvn/wrapper/maven-wrapper.properties b/12SpringBoot&JPA/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/12SpringBoot&JPA/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/12SpringBoot&JPA/mvnw b/12SpringBoot&JPA/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/12SpringBoot&JPA/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/12SpringBoot&JPA/mvnw.cmd b/12SpringBoot&JPA/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/12SpringBoot&JPA/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/12SpringBoot&JPA/pom.xml b/12SpringBoot&JPA/pom.xml deleted file mode 100644 index 71b792d4..00000000 --- a/12SpringBoot&JPA/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - com.consumer - consumerSpringBoot - 0.0.1-SNAPSHOT - jar - - demo - Consumer project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/12SpringBoot&JPA/src/main/java/com/cg/ConsumerMain.java b/12SpringBoot&JPA/src/main/java/com/cg/ConsumerMain.java deleted file mode 100644 index 19cc2e5c..00000000 --- a/12SpringBoot&JPA/src/main/java/com/cg/ConsumerMain.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.cg; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; - - @ComponentScan(basePackages="com.cg") - @SpringBootApplication - public class ConsumerMain { - - - public static void main(String[] args) { - // TODO Auto-generated method stub - - SpringApplication.run(ConsumerMain.class, args); - } - - -} diff --git a/12SpringBoot&JPA/src/main/java/com/cg/controller/CustomerController.java b/12SpringBoot&JPA/src/main/java/com/cg/controller/CustomerController.java deleted file mode 100644 index 0822c940..00000000 --- a/12SpringBoot&JPA/src/main/java/com/cg/controller/CustomerController.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.cg.controller; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.cg.model.Customer; -import com.cg.service.ICustomerService; - -@RestController -public class CustomerController { - - @Autowired - ICustomerService customerService; - - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final Customer customer) - { - - Customer cust=customerService.addCustomer(customer); - return new ResponseEntity(customer,HttpStatus.CREATED); - - } - - - - -} diff --git a/12SpringBoot&JPA/src/main/java/com/cg/dao/CustomerRepository.java b/12SpringBoot&JPA/src/main/java/com/cg/dao/CustomerRepository.java deleted file mode 100644 index 43c4d518..00000000 --- a/12SpringBoot&JPA/src/main/java/com/cg/dao/CustomerRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.cg.dao; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import com.cg.model.Customer; - -@Repository -public interface CustomerRepository extends JpaRepository{ - - // List findByCustomerName(String customerName); - -} diff --git a/12SpringBoot&JPA/src/main/java/com/cg/model/Customer.java b/12SpringBoot&JPA/src/main/java/com/cg/model/Customer.java deleted file mode 100644 index c5f798b4..00000000 --- a/12SpringBoot&JPA/src/main/java/com/cg/model/Customer.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.cg.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 org.hibernate.annotations.GeneratorType; - -@Entity -@Table(name="customer") -public class Customer { - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="customer_id") - public long customerId; - @Column(name="customer_name") - public String customerName; - @Column(name="customer_address") - public String customerAddress; - @Column(name="payment_mode") - public String paymentMode; - - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - /** - * @param customerName the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - /** - * @param customerAddress the customerAddress to set - */ - public void setCustomerAddress(String customerAddress) { - this.customerAddress = customerAddress; - } - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - /** - * @param paymentMode the paymentMode to set - */ - public void setPaymentMode(String paymentMode) { - this.paymentMode = paymentMode; - } - /** - * @return the retailerName - */ - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerAddress=" - + customerAddress + ", paymentMode=" + paymentMode + "]"; - } - - public Customer() { - // TODO Auto-generated constructor stub - } - -} diff --git a/12SpringBoot&JPA/src/main/java/com/cg/service/CustomerServiceImpl.java b/12SpringBoot&JPA/src/main/java/com/cg/service/CustomerServiceImpl.java deleted file mode 100644 index fd909adc..00000000 --- a/12SpringBoot&JPA/src/main/java/com/cg/service/CustomerServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.cg.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.cg.dao.CustomerRepository; -import com.cg.model.Customer; - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService{ - @Autowired - public CustomerRepository customerRepository; - - @Override - public Customer AddCustomer(Customer customer) { - // TODO Auto-generated method stub - customerRepository.save(customer); - return customer; - } - - @Override - public Customer DeleteCustomer(Customer customer) { - - customerRepository.delete(entity); - return customer; - } - - - -} diff --git a/12SpringBoot&JPA/src/main/java/com/cg/service/ICustomerService.java b/12SpringBoot&JPA/src/main/java/com/cg/service/ICustomerService.java deleted file mode 100644 index d4131cf4..00000000 --- a/12SpringBoot&JPA/src/main/java/com/cg/service/ICustomerService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.cg.service; - -import com.cg.model.Customer; - -public interface ICustomerService { - - public Customer AddCustomer(Customer customer); - - public Customer DeleteCustomer(Customer customer); - -} diff --git a/12SpringBoot&JPA/src/main/java/com/consumer/DemoApplication.java b/12SpringBoot&JPA/src/main/java/com/consumer/DemoApplication.java deleted file mode 100644 index 591a05d5..00000000 --- a/12SpringBoot&JPA/src/main/java/com/consumer/DemoApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.consumer; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DemoApplication { - - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); - } -} diff --git a/12SpringBoot&JPA/src/main/resources/application.properties b/12SpringBoot&JPA/src/main/resources/application.properties deleted file mode 100644 index de2a7aa5..00000000 --- a/12SpringBoot&JPA/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -# Enabling H2 Console -spring.h2.console.enabled=true -#this will persist data in next run -spring.datasource.url=jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE \ No newline at end of file diff --git a/12SpringBoot&JPA/src/test/java/com/consumer/DemoApplicationTests.java b/12SpringBoot&JPA/src/test/java/com/consumer/DemoApplicationTests.java deleted file mode 100644 index fb255fed..00000000 --- a/12SpringBoot&JPA/src/test/java/com/consumer/DemoApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.consumer; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class DemoApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/13SpringBootJPA(REMOVEADD)/.gitignore b/13SpringBootJPA(REMOVEADD)/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/13SpringBootJPA(REMOVEADD)/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/13SpringBootJPA(REMOVEADD)/.mvn/wrapper/maven-wrapper.jar b/13SpringBootJPA(REMOVEADD)/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/13SpringBootJPA(REMOVEADD)/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/13SpringBootJPA(REMOVEADD)/.mvn/wrapper/maven-wrapper.properties b/13SpringBootJPA(REMOVEADD)/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/13SpringBootJPA(REMOVEADD)/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/13SpringBootJPA(REMOVEADD)/mvnw b/13SpringBootJPA(REMOVEADD)/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/13SpringBootJPA(REMOVEADD)/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/13SpringBootJPA(REMOVEADD)/mvnw.cmd b/13SpringBootJPA(REMOVEADD)/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/13SpringBootJPA(REMOVEADD)/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/13SpringBootJPA(REMOVEADD)/pom.xml b/13SpringBootJPA(REMOVEADD)/pom.xml deleted file mode 100644 index 71b792d4..00000000 --- a/13SpringBootJPA(REMOVEADD)/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - com.consumer - consumerSpringBoot - 0.0.1-SNAPSHOT - jar - - demo - Consumer project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/ConsumerMain.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/ConsumerMain.java deleted file mode 100644 index 639966d0..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/ConsumerMain.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.cg; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; - - - @SpringBootApplication - public class ConsumerMain { - - - public static void main(String[] args) { - // TODO Auto-generated method stub - - SpringApplication.run(ConsumerMain.class, args); - } - - - - - - - - - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/controller/CustomerController.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/controller/CustomerController.java deleted file mode 100644 index 3f1373cc..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/controller/CustomerController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.cg.controller; - -import java.util.Iterator; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.cg.dao.CustomerRepository; -import com.cg.model.Customer; -import com.cg.service.ICustomerService; - -@RestController -@RequestMapping("/api") -public class CustomerController { - - @Autowired - ICustomerService customerService; - - // -------------------Create a User------------------------------------------- - - @RequestMapping(value = "/addNewCustomer", method = RequestMethod.GET) - public Customer NewUser() { - - Customer c = new Customer("hulk", "newyork", "Debit"); - customerService.saveUser(c); - - return null; - - } - - /*@RequestMapping(value = "/user/{id}", method = RequestMethod.GET) - public ResponseEntity deleteUser(@PathVariable("id") long id) { - // System.out.printf("Fetching & Deleting User with id {}", id); - - Customer user = customerService.findById(id); - // if (user == null) { - // System.out.printf("Unable to delete. User with id {} not found.", id); - // return new ResponseEntity(new CustomErrorType("Unable to delete. User with id - // " + id + " not found."), - // HttpStatus.NOT_FOUND); - - customerService.deleteUserById(id); - // return new ResponseEntity(HttpStatus.NO_CONTENT); - return null; - }*/ - - @RequestMapping(value = "/user/{id}", method = RequestMethod.GET) - public void findAll(@PathVariable("id") long id) - { - - customerService.findAll(id); - - - } - - /* - * @PostMapping("/customerCreate") public ResponseEntity - * createCustomer(@RequestBody final Customer customer) { - * - * Customer cust=customerService.addCustomer(customer); return new - * ResponseEntity(customer,HttpStatus.CREATED); - * - * } - * - */ - - // -------------------Retrieve All - // Users--------------------------------------------- - - /* - * @RequestMapping(value = "/user/", method = RequestMethod.GET) public - * ResponseEntity> listAllUsers() { List users = - * customerService.findAllUsers(); if (users.isEmpty()) { return new - * ResponseEntity(HttpStatus.NO_CONTENT); // You many decide to return - * HttpStatus.NOT_FOUND } return new ResponseEntity>(users, - * HttpStatus.OK); } - * - * // -------------------Retrieve Single // - * User------------------------------------------ - * - * @RequestMapping(value = "/user/{id}", method = RequestMethod.GET) public - * ResponseEntity getUser(@PathVariable("id") long id) { - * System.out.printf("Fetching User with id {}", id); Customer user = - * customerService.findById(id); if (user == null) { - * System.out.printf("User with id {} not found.", id); return new - * ResponseEntity(new CustomErrorType("User with id " + id + " not found"), - * HttpStatus.NOT_FOUND); } return new ResponseEntity(user, - * HttpStatus.OK); } - */ - - /* - * // ------------------- Update a User // - * ------------------------------------------------ - * - * @RequestMapping(value = "/user/{id}", method = RequestMethod.PUT) public - * ResponseEntity updateUser(@PathVariable("id") long id, @RequestBody - * Customer user) { System.out.printf("Updating User with id {}", id); - * - * Customer currentUser = customerService.findById(id); - * - * if (currentUser == null) { - * System.out.printf("Unable to update. User with id {} not found.", id); return - * new ResponseEntity(new CustomErrorType("Unable to upate. User with id " + id - * + " not found."), HttpStatus.NOT_FOUND); } - * - * currentUser.setCustomerName(user.getCustomerName()); - * currentUser.setCustomerAddress(user.getCustomerAddress()); - * currentUser.setPaymentMode(user.getPaymentMode()); - * - * customerService.updateUser(currentUser); return new - * ResponseEntity(currentUser, HttpStatus.OK); } - * - * // ------------------- Delete a User----------------------------------------- - * - * @RequestMapping(value = "/user/{id}", method = RequestMethod.DELETE) public - * ResponseEntity deleteUser(@PathVariable("id") long id) { - * System.out.printf("Fetching & Deleting User with id {}", id); - * - * Customer user = customerService.findById(id); if (user == null) { - * System.out.printf("Unable to delete. User with id {} not found.", id); return - * new ResponseEntity(new CustomErrorType("Unable to delete. User with id " + id - * + " not found."), HttpStatus.NOT_FOUND); } - * customerService.deleteUserById(id); return new - * ResponseEntity(HttpStatus.NO_CONTENT); } - * - * // ------------------- Delete All Users----------------------------- - * - * @RequestMapping(value = "/user/", method = RequestMethod.DELETE) public - * ResponseEntity deleteAllUsers() { - * System.out.printf("Deleting All Users"); - * - * customerService.deleteAllUsers(); return new - * ResponseEntity(HttpStatus.NO_CONTENT); } - */ - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/dao/CustomerRepository.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/dao/CustomerRepository.java deleted file mode 100644 index 43c4d518..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/dao/CustomerRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.cg.dao; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import com.cg.model.Customer; - -@Repository -public interface CustomerRepository extends JpaRepository{ - - // List findByCustomerName(String customerName); - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/model/Customer.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/model/Customer.java deleted file mode 100644 index 8edca130..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/model/Customer.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.cg.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 org.hibernate.annotations.GeneratorType; - -@Entity -@Table(name="customer") -public class Customer { - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="customer_id") - public long customerId; - @Column(name="customer_name") - public String customerName; - @Column(name="customer_address") - public String customerAddress; - @Column(name="payment_mode") - public String paymentMode; - - - - - - - /** - * @param customerName - * @param customerAddress - * @param paymentMode - */ - public Customer(String customerName, String customerAddress, String paymentMode) { - super(); - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - /** - * @param customerName the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - /** - * @param customerAddress the customerAddress to set - */ - public void setCustomerAddress(String customerAddress) { - this.customerAddress = customerAddress; - } - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - /** - * @param paymentMode the paymentMode to set - */ - public void setPaymentMode(String paymentMode) { - this.paymentMode = paymentMode; - } - /** - * @return the retailerName - */ - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerAddress=" - + customerAddress + ", paymentMode=" + paymentMode + "]"; - } - - public Customer() { - // TODO Auto-generated constructor stub - } - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/service/CustomerServiceImpl.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/service/CustomerServiceImpl.java deleted file mode 100644 index 2b649baa..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/service/CustomerServiceImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.cg.service; - -import java.util.Iterator; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.cg.dao.CustomerRepository; -import com.cg.model.Customer; - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService{ - - - @Autowired - public CustomerRepository customerRepository; - - public List findAll(long id) { - // CustomerRepository customerRepo = null; - List customerList = customerRepository.findAll(); - Iterator iterator = customerList.iterator(); - while(iterator.hasNext()) - { - Customer customer = (Customer) iterator.next(); - if(customer.getCustomerId() == id) - { - customerRepository.deleteById(id); - } - } - return customerList; - } - - /* - public Customer findById(long id) { - for(Customer user : users){ - if(user.getCustomerId() == id){ - return user; - } - } - return null; - }*/ - - @Override - public void saveUser(Customer user) { - - - } - -//public void deleteUserById(long id) { -// -// for (Iterator iterator = users.iterator(); iterator.hasNext(); ) { -// Customer user = iterator.next(); -// if (user.getCustomerId() == id) { -// iterator.remove(); -// } -// } -// } -// -// - - - - /* - - @Override - public Customer AddCustomer(Customer customer) { - // TODO Auto-generated method stub - customerRepository.save(customer); - return customer; - }*/ - - - - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/service/ICustomerService.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/service/ICustomerService.java deleted file mode 100644 index 7541e08f..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/cg/service/ICustomerService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.cg.service; - -import java.util.List; - -import com.cg.model.Customer; - -public interface ICustomerService { - - //public Customer AddCustomer(Customer customer); - -//Customer findById(long id); - public List findAll(long id); -/*Customer findByName(String name);*/ - - void saveUser(Customer user); - //void deleteUserById(long id); - /*void updateUser(Customer user); - - - - List findAllUsers(); - - void deleteAllUsers(); - - boolean isUserExist(Customer user);*/ - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/com/consumer/DemoApplication.java b/13SpringBootJPA(REMOVEADD)/src/main/java/com/consumer/DemoApplication.java deleted file mode 100644 index 591a05d5..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/com/consumer/DemoApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.consumer; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DemoApplication { - - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); - } -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/java/springboot/util/CustomErrorType.java b/13SpringBootJPA(REMOVEADD)/src/main/java/springboot/util/CustomErrorType.java deleted file mode 100644 index a506e30e..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/java/springboot/util/CustomErrorType.java +++ /dev/null @@ -1,16 +0,0 @@ -package springboot.util; - - -public class CustomErrorType { - - private String errorMessage; - - public CustomErrorType(String errorMessage){ - this.errorMessage = errorMessage; - } - - public String getErrorMessage() { - return errorMessage; - } - -} diff --git a/13SpringBootJPA(REMOVEADD)/src/main/resources/application.properties b/13SpringBootJPA(REMOVEADD)/src/main/resources/application.properties deleted file mode 100644 index de2a7aa5..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -# Enabling H2 Console -spring.h2.console.enabled=true -#this will persist data in next run -spring.datasource.url=jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE \ No newline at end of file diff --git a/13SpringBootJPA(REMOVEADD)/src/test/java/com/consumer/DemoApplicationTests.java b/13SpringBootJPA(REMOVEADD)/src/test/java/com/consumer/DemoApplicationTests.java deleted file mode 100644 index fb255fed..00000000 --- a/13SpringBootJPA(REMOVEADD)/src/test/java/com/consumer/DemoApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.consumer; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class DemoApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/14SpringBootJPAmysql/.gitignore b/14SpringBootJPAmysql/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/14SpringBootJPAmysql/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/14SpringBootJPAmysql/.mvn/wrapper/maven-wrapper.jar b/14SpringBootJPAmysql/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/14SpringBootJPAmysql/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/14SpringBootJPAmysql/.mvn/wrapper/maven-wrapper.properties b/14SpringBootJPAmysql/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/14SpringBootJPAmysql/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/14SpringBootJPAmysql/mvnw b/14SpringBootJPAmysql/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/14SpringBootJPAmysql/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/14SpringBootJPAmysql/mvnw.cmd b/14SpringBootJPAmysql/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/14SpringBootJPAmysql/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/14SpringBootJPAmysql/pom.xml b/14SpringBootJPAmysql/pom.xml deleted file mode 100644 index 1f26f873..00000000 --- a/14SpringBootJPAmysql/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - 4.0.0 - - com.training - springbootjpa - 0.0.1-SNAPSHOT - jar - - springbootjpa - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - runtime - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.mockito - mockito-core - 2.18.3 - - - org.mockito - mockito-junit-jupiter - 2.18.3 - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/SpringbootjpaApplication.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/SpringbootjpaApplication.java deleted file mode 100644 index 2608ef69..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/SpringbootjpaApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.training.springbootjpa; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SpringbootjpaApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringbootjpaApplication.class, args); - } -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/controller/MainController.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/controller/MainController.java deleted file mode 100644 index c181353f..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/controller/MainController.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.training.springbootjpa.controller; - -import java.util.List; -import java.util.logging.Logger; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; -import com.training.springbootjpa.model.Goods; -import com.training.springbootjpa.model.Retailer; -import com.training.springbootjpa.model.Supplier; -import com.training.springbootjpa.repository.CustomerDAO; -import com.training.springbootjpa.service.CustomerService; -import com.training.springbootjpa.service.GoodsService; -import com.training.springbootjpa.service.RetailerService; -import com.training.springbootjpa.service.SupplierService; - -@RestController -public class MainController { - - - - private static final Logger LOGGER = Logger.getLogger( MainController.class.getName() ); - /* - * with help of this annonation we can access all the proporties of bean we can - * access all method of CustomerService. - */ - @Autowired - private CustomerService customerService; - - @Autowired - private GoodsService goodsService; - - @Autowired - private SupplierService supplierService; - - @Autowired - private RetailerService retailerService; - - @Autowired - CustomerDAO cdao; - - /* - * Get Customer Details using Id Handling the exception using Custom Exception - */ - @RequestMapping(value = "/customer/{id}", method = RequestMethod.GET) - public ResponseEntity getCustomerById(@PathVariable Long id) throws ManagedException { - LOGGER.info("Inside Get Customer By Id"); - String customer = null; - - try { - customer = customerService.getCustomerDetail(id); - } catch (ManagedException e) { - - e.getMessage(); - } - System.out.println(customer); - - return new ResponseEntity(customer, HttpStatus.OK); - } - - // Get Customer Details using Name - // Handling the exception - /* - * Also we can send your whole Customer Details to UI using - * ResponseEntity For now this method is just telling user that your - * data is being get added succesfully. - * - */ - - @RequestMapping(method = RequestMethod.GET, value = "/searchCustomer/{customerName}") - - public ResponseEntity searchCustomer(@PathVariable String customerName) throws ManagedException { - LOGGER.info("Inside Get Customer By Name"); - - Customer customerData = null; - - customerData = cdao.findByCustomerName(customerName); - if (customerData == null) - return new ResponseEntity("Data not found", HttpStatus.OK); - else - return new ResponseEntity("Data found", (MultiValueMap) customerData, HttpStatus.OK); - - } - - /*this method shows all customers to admin if requested - */ - - @RequestMapping(method = RequestMethod.GET, value = "/getAllCustomer") - // @PostMapping(path = "/addCustomer") - public ResponseEntity> getAllCustomer() { - LOGGER.info("Inside Get All Customers "); - final List customerData; - - customerData = customerService.getCustomer(); - - return new ResponseEntity(customerData, HttpStatus.OK); - } - - - /* - * This method add new customer to database - * Exception Handling- if users provides Null to Textbox then it will throw Proper Message to user . - */ - @RequestMapping(method = RequestMethod.POST, value = "/addCustomer", produces = MediaType.APPLICATION_JSON_VALUE) - // @PostMapping(path = "/addCustomer") - public ResponseEntity createCustomer(@RequestBody Customer customer) { - - LOGGER.info("Inside Add New Customer "); - Customer customerData = null; - - try { - customerData = customerService.addCustomer(customer); - return new ResponseEntity(customerData, HttpStatus.OK); - - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return new ResponseEntity("Provide valid input", HttpStatus.OK); - } - - - } - - - - - - /** - * GET /delete Delete a customer details from the database. - * - * - */ - @RequestMapping("/delete/{customerId}") - public ResponseEntity deleteCustomerRecord(@PathVariable Long customerId) { - - Customer cust =null; - LOGGER.info("Inside Delete Customer "); - try { - cust = customerService.deleteCustomerById(customerId); - } catch (ManagedException e) { - - - e.printStackTrace(); - return new ResponseEntity("Given Id not found", HttpStatus.OK); - } - - return new ResponseEntity("Given Id deleted successfully ", HttpStatus.OK); - } - - - /** - * - * Another Implementation - * GET /delete Delete a customer details from the database. - * - * - */ - - -/** - * GET /delete Delete a booking from the database. - */ - @RequestMapping("/delete/{customerId}") - public String deletecustomer(@PathVariable Long customerId) { - - LOGGER.info("Inside Delete Customer "); - try { - customerService.deleteCustomerById(customerId); - } catch (ManagedException e) { - - - e.printStackTrace(); - return "CustomerID #"+customerId+" Not Found"; - } - - return "CustomerID #"+customerId+" deleted successfully"; - } - - - - - - - - @RequestMapping(value = "/updateCustomer/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateCustomer(@PathVariable("updateById") long updateById) { - final Customer customer = customerService.updateCustomerById(updateById); - return new ResponseEntity(customer, HttpStatus.OK); - } - - @RequestMapping(method = RequestMethod.POST, value = "/addGoods", produces = MediaType.APPLICATION_JSON_VALUE) - ResponseEntity createGoods(@RequestBody Goods goods) { - System.out.println(goods); - final Goods goodsData; - goodsData = goodsService.addGoods(goods); - return new ResponseEntity(goodsData, HttpStatus.OK); - } - - @RequestMapping(value = "/deleteGoods/{deleteById}", method = RequestMethod.GET) - public ResponseEntity deleteGoods(@PathVariable("deleteById") long deleteById) { - final List goodsList; - goodsList = goodsService.deleteGoodsById(deleteById); - return new ResponseEntity(goodsList, HttpStatus.OK); - } - - @RequestMapping(value = "/updateGoods/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateGoods(@PathVariable("updateById") long updateById) { - final Goods goods = goodsService.updateGoodsById(updateById); - return new ResponseEntity(goods, HttpStatus.OK); - } - - @RequestMapping(method = RequestMethod.POST, value = "/addSupplier", produces = - - MediaType.APPLICATION_JSON_VALUE) // @PostMapping(path = "/addSupplier") - public ResponseEntity createSupplier(@RequestBody Supplier supplier) { - System.out.println(supplier); - final Supplier supplierData; - supplierData = supplierService.addSupplier(supplier); - return new ResponseEntity(supplierData, HttpStatus.OK); - } - - @RequestMapping(value = "/deleteSupplier/{deleteById}", method = RequestMethod.GET) - public ResponseEntity deleteSupplier(@PathVariable("deleteById") long deleteById) { - final List supplierList; - supplierList = supplierService.deleteSupplierById(deleteById); - return new ResponseEntity(supplierList, HttpStatus.OK); - } - - @RequestMapping(value = "/updateSupplier/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateSupplier(@PathVariable("updateById") long updateById) { - final Supplier supplier = supplierService.updateSupplierById(updateById); - return new ResponseEntity(supplier, HttpStatus.OK); - } - - @RequestMapping(method = RequestMethod.POST, value = "/addRetailer", produces = MediaType.APPLICATION_JSON_VALUE) // @PostMapping(path - // = - // "/addRetailer") - public ResponseEntity createRetailer(@RequestBody Retailer retailer) { - System.out.println(retailer); - final Retailer retailerData; - retailerData = retailerService.addRetailer(retailer); - return new ResponseEntity(retailerData, HttpStatus.OK); - } - - @RequestMapping(value = "/deleteRetailer/{deleteById}", method = RequestMethod.GET) - public ResponseEntity deleteRetailer(@PathVariable("deleteById") long deleteById) { - final List retailerList; - retailerList = retailerService.deleteRetailerById(deleteById); - return new ResponseEntity(retailerList, HttpStatus.OK); - } - - @RequestMapping(value = "/updateRetailer/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateRetailer(@PathVariable("updateById") long updateById) { - final Retailer retailer = retailerService.updateRetailerById(updateById); - return new ResponseEntity(retailer, HttpStatus.OK); - } - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/exception/ManagedException.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/exception/ManagedException.java deleted file mode 100644 index 3da2658f..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/exception/ManagedException.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - */ -package com.training.springbootjpa.exception; - -/** - * @author trainee - * - */ -public class ManagedException extends Exception { - - - public ManagedException(final String errorMessage) { - - super(errorMessage); - - } - - public ManagedException() { - // TODO Auto-generated constructor stub - } - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Customer.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Customer.java deleted file mode 100644 index 1b2087b6..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Customer.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author RamDAfale - * - */ -@Entity -@Table(name = "customer") -public class Customer { - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - private Long customerId; - private String customerName; - private String customerAddress; - private String paymentMode; - - - - /** - * Default constructor which will help spring Mapper to map all entitites. - */ - public Customer() { - super(); - } - - /** - * @param customerId - * @param customerName - * @param customerAddress - * @param paymentMode - */ - public Customer(Long customerId, String customerName, - String customerAddress, String paymentMode) { - this.customerId = customerId; - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - - - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - - /** - * @param customerAddress - * the customerAddress to set - */ - public void setCustomerAddress(String customerAddress) { - this.customerAddress = customerAddress; - } - - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - - /** - * @param paymentMode - * the paymentMode to set - */ - public void setPaymentMode(String paymentMode) { - this.paymentMode = paymentMode; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerAddress=" - + customerAddress + ", paymentMode=" + paymentMode + "]"; - } - - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Goods.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Goods.java deleted file mode 100644 index 4b576333..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Goods.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "goods") -public class Goods { - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - private Long goodsId; - private String goodsName; - private Integer goodsQuantity; - private Double goodsPrice; - - - - /** - * - */ - public Goods() { - super(); - } - - /** - * @param goodsId - * @param goodsName - * @param goodsQuantity - * @param goodsPrice - * @param supplierId - */ - public Goods(Long goodsId, String goodsName, Integer goodsQuantity, Double goodsPrice, Long supplierId) { - super(); - this.goodsId = goodsId; - this.goodsName = goodsName; - this.goodsQuantity = goodsQuantity; - this.goodsPrice = goodsPrice; - - } - - /** - * @return the goodsId - */ - public Long getGoodsId() { - return goodsId; - } - /** - * @param goodsId the goodsId to set - */ - public void setGoodsId(Long goodsId) { - this.goodsId = goodsId; - } - /** - * @return the goodsName - */ - public String getGoodsName() { - return goodsName; - } - /** - * @param goodsName the goodsName to set - */ - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - /** - * @return the goodsQuantity - */ - public Integer getGoodsQuantity() { - return goodsQuantity; - } - /** - * @param goodsQuantity the goodsQuantity to set - */ - public void setGoodsQuantity(Integer goodsQuantity) { - this.goodsQuantity = goodsQuantity; - } - /** - * @return the goodsPrice - */ - public Double getGoodsPrice() { - return goodsPrice; - } - /** - * @param goodsPrice the goodsPrice to set - */ - public void setGoodsPrice(Double goodsPrice) { - this.goodsPrice = goodsPrice; - } - - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Goods [goodsId=" + goodsId + ", goodsName=" + goodsName + ", goodsQuantity=" + goodsQuantity - + ", goodsPrice=" + goodsPrice + "]"; - } - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Retailer.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Retailer.java deleted file mode 100644 index 24b14dfa..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Retailer.java +++ /dev/null @@ -1,102 +0,0 @@ - -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author RamDAfale - * - */ -@Entity -@Table(name = "retailer") -public class Retailer { - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - private Long retailerId; - private String retailerName; - private String retailerAddress; - - /** - * @param retailerId - * @param retailerName - * @param retailerAddress - */ - public Retailer(Long retailerId, String retailerName, String retailerAddress) { - super(); - this.retailerId = retailerId; - this.retailerName = retailerName; - this.retailerAddress = retailerAddress; - } - - /** - * - */ - public Retailer() { - super(); - } - - /** - * @return the retailerId - */ - public Long getRetailerId() { - return retailerId; - } - - /** - * @param retailerId - * the retailerId to set - */ - public void setRetailerId(Long retailerId) { - this.retailerId = retailerId; - } - - /** - * @return the retailerName - */ - public String getRetailerName() { - return retailerName; - } - - /** - * @param retailerName - * the retailerName to set - */ - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - /** - * @return the retailerAddress - */ - public String getRetailerAddress() { - return retailerAddress; - } - - /** - * @param retailerAddress - * the retailerAddres to set - */ - public void setRetailerAddress(String retailerAddress) { - this.retailerAddress = retailerAddress; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Retailer [retailerId=" + retailerId + ", retailerName=" + retailerName + ", retailerAddress=" - + retailerAddress + ", getRetailerId()=" + getRetailerId() + ", getRetailerName()=" + getRetailerName() - + ", getRetailerAddress()=" + getRetailerAddress() + ", getClass()=" + getClass() + ", hashCode()=" - + hashCode() + ", toString()=" + super.toString() + "]"; - } - - - - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Supplier.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Supplier.java deleted file mode 100644 index c0124bc8..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/model/Supplier.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author RamDAfale - * - */ -@Entity -@Table(name = "supplier") -public class Supplier { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long supplierId; - private String supplierName; - private String supplierAddress; - private int quantityOrder; - private int orderId; - private Double amount; - - - /** - * - */ - public Supplier() { - super(); - } - - /** - * @param supplierId - * @param supplierName - * @param supplierAddress - * @param quantityOrder - * @param orderId - * @param amount - * @param retailerId - */ - public Supplier(Long supplierId, String supplierName, String supplierAddress, int quantityOrder, int orderId, - Double amount, String retailerId) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - - } - - /** - * @return the supplierId - */ - public Long getSupplierId() { - return supplierId; - } - - /** - * @param supplierId - * the supplierId to set - */ - public void setSupplierId(Long supplierId) { - this.supplierId = supplierId; - } - - /** - * @return the supplierName - */ - public String getSupplierName() { - return supplierName; - } - - /** - * @param supplierName - * the supplierName to set - */ - public void setSupplierName(String supplierName) { - this.supplierName = supplierName; - } - - /** - * @return the supplierAddress - */ - public String getSupplierAddress() { - return supplierAddress; - } - - /** - * @param supplierAddress - * the supplierAddress to set - */ - public void setSupplierAddress(String supplierAddress) { - this.supplierAddress = supplierAddress; - } - - /** - * @return the quantityOrder - */ - public int getQuantityOrder() { - return quantityOrder; - } - - /** - * @param quantityOrder - * the quantityOrder to set - */ - public void setQuantityOrder(int quantityOrder) { - this.quantityOrder = quantityOrder; - } - - /** - * @return the orderId - */ - public int getOrderId() { - return orderId; - } - - /** - * @param orderId - * the orderId to set - */ - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - /** - * @return the amount - */ - public Double getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(Double amount) { - this.amount = amount; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "Supplier [supplierId=" + supplierId + ", supplierName=" + supplierName + ", supplierAddress=" - + supplierAddress + ", quantityOrder=" + quantityOrder + ", orderId=" + orderId + ", amount=" + amount - + "]"; - } -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/CustomerDAO.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/CustomerDAO.java deleted file mode 100644 index 5dfc1a06..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/CustomerDAO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.springbootjpa.repository; - -import java.util.List; - -import org.springframework.data.repository.CrudRepository; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; - -public interface CustomerDAO extends CrudRepository { - - /* - *this method find your name in database and return the details if name found - *also this method internally fire a select query based on parameter you pass to it. - */ - Customer findByCustomerName(String customerName) throws ManagedException; - - /* - this method find your name & database in database and return the details if name & address is found - also this method internally fire a select query based on parameter you pass to it. - */ - - List findByCustomerNameAndCustomerAddress(String customerName, String customerAddress); -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/GoodsDAO.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/GoodsDAO.java deleted file mode 100644 index 0ee1b2dc..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/GoodsDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.springbootjpa.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.training.springbootjpa.model.Goods; - -public interface GoodsDAO extends JpaRepository{ - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/RetailerDAO.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/RetailerDAO.java deleted file mode 100644 index 417774f1..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/RetailerDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.springbootjpa.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.training.springbootjpa.model.Retailer; - -public interface RetailerDAO extends JpaRepository { -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/SupplierDAO.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/SupplierDAO.java deleted file mode 100644 index edae2df1..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/repository/SupplierDAO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.springbootjpa.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.training.springbootjpa.model.Supplier; - -public interface SupplierDAO extends JpaRepository { -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/CustomerService.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/CustomerService.java deleted file mode 100644 index c4cac702..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/CustomerService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; - -public interface CustomerService { - - Customer addCustomer(Customer customer) throws ManagedException; - - Customer deleteCustomerById(long deleteById)throws ManagedException ; - - Customer updateCustomerById(long updateById); - - List getCustomer(); - - String getCustomerDetail(Long id) throws ManagedException; - - - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/CustomerServiceImpl.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/CustomerServiceImpl.java deleted file mode 100644 index a429b528..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/CustomerServiceImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; -import com.training.springbootjpa.repository.CustomerDAO; - -/** - * @author RamDAfale - * - */ - -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO customerDAO; - - @Override - public Customer addCustomer(Customer customer) throws ManagedException { - Customer customerData = customerDAO.save(customer); - if ( customerData.getCustomerName()==null || customerData.getPaymentMode() == null ) - { - throw new ManagedException("provide correct details"); - } - else - - return customerData; - } - - - - - - - - @Override - public Customer deleteCustomerById(long deleteById) throws ManagedException { - - Optional customer=customerDAO.findById(deleteById); - if(customer.isPresent()) - { - customerDAO.deleteById(deleteById); - } - else - { - throw new ManagedException("Id not Found"); - - } - return null; - } - - - - @Override - public Customer updateCustomerById(long updateById) { - Optional customer = customerDAO.findById(updateById); - Customer customerDummy = customer.get(); - customerDummy.setCustomerAddress("Newyork"); - return customerDummy; - } - - @Override - public List getCustomer() { - - return (List) customerDAO.findAll(); - } - - @Override - public String getCustomerDetail(Long id) throws ManagedException { - - Optional customerData = customerDAO.findById(id); - if (customerData.isPresent()) { - return "Data Found"; - } else - return "Not Found"; - } - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/GoodsService.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/GoodsService.java deleted file mode 100644 index dd268389..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/GoodsService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; -import com.training.springbootjpa.model.Goods; - -public interface GoodsService { - - Goods addGoods(Goods goods); - - public List deleteGoodsById(long deleteById); - - public Goods updateGoodsById(long updateById); - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/GoodsServiceImpl.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/GoodsServiceImpl.java deleted file mode 100644 index 45b4ce39..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/GoodsServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.training.springbootjpa.model.Goods; -import com.training.springbootjpa.repository.GoodsDAO; - -/** - * @author RamDAfale - * - */ -@Service("goodsService") -public class GoodsServiceImpl implements GoodsService { - - @Autowired - private GoodsDAO goodsDAO; - - @Override - public Goods addGoods(Goods goods) { - Goods goodsData = goodsDAO.save(goods); - return goodsData; - } - - @Override - public List deleteGoodsById(long deleteById) { - List goodsList = goodsDAO.findAll(); - Iterator iterator = goodsList.iterator(); - while (iterator.hasNext()) { - Goods goods = (Goods) iterator.next(); - if (goods.getGoodsId() == deleteById) { - goodsDAO.deleteById(deleteById); - } - } - return goodsList; - } - - @Override - public Goods updateGoodsById(long updateById) { - Optional goods = goodsDAO.findById(updateById); - Goods goodsDummy = goods.get(); - goodsDummy.setGoodsPrice(1021.12); - return goodsDummy; - } - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/RetailerService.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/RetailerService.java deleted file mode 100644 index 8fe6025f..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/RetailerService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; - -import com.training.springbootjpa.model.Retailer; - -public interface RetailerService { - - public Retailer addRetailer(Retailer retailer); - - public List deleteRetailerById(long deleteById); - - public Retailer updateRetailerById(long updateById); - - - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/RetailerServiceImpl.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/RetailerServiceImpl.java deleted file mode 100644 index bad09c2a..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/RetailerServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.training.springbootjpa.model.Retailer; -import com.training.springbootjpa.repository.RetailerDAO; - -@Service("retailerService") -public class RetailerServiceImpl implements RetailerService { - - @Autowired - private RetailerDAO retailerDAO; - - @Override - public Retailer addRetailer(Retailer retailer) { - Retailer retailerData = retailerDAO.save(retailer); - return retailerData; - } - - @Override - public List deleteRetailerById(long deleteById) { - List retailerList = retailerDAO.findAll(); - Iterator iterator = retailerList.iterator(); - while (iterator.hasNext()) { - Retailer retailer = (Retailer) iterator.next(); - if (retailer.getRetailerId() == deleteById) { - retailerDAO.deleteById(deleteById); - } - } - return retailerList; - } - - @Override - public Retailer updateRetailerById(long updateById) { - Optional retailer = retailerDAO.findById(updateById); - Retailer retailerDummy = retailer.get(); - retailerDummy.setRetailerAddress("Changed Address at Winterfell"); - return retailerDummy; - } - -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/SupplierService.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/SupplierService.java deleted file mode 100644 index 55213cfb..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/SupplierService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; -import com.training.springbootjpa.model.Supplier; - -public interface SupplierService { - - public Supplier addSupplier(Supplier supplier); - - public List deleteSupplierById(long deleteById); - - public Supplier updateSupplierById(long updateById); -} diff --git a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/SupplierServiceImpl.java b/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/SupplierServiceImpl.java deleted file mode 100644 index ecec5b91..00000000 --- a/14SpringBootJPAmysql/src/main/java/com/training/springbootjpa/service/SupplierServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.training.springbootjpa.model.Supplier; -import com.training.springbootjpa.repository.SupplierDAO; - -@Service("supplierService") -public class SupplierServiceImpl implements SupplierService { - - @Autowired - private SupplierDAO supplierDAO; - - @Override - public Supplier addSupplier(Supplier supplier) { - Supplier supplierData = supplierDAO.save(supplier); - return supplierData; - } - - @Override - public List deleteSupplierById(long deleteById) { - List supplierList = supplierDAO.findAll(); - Iterator iterator = supplierList.iterator(); - while (iterator.hasNext()) { - Supplier supplier = (Supplier) iterator.next(); - if (supplier.getSupplierId() == deleteById) { - supplierDAO.deleteById(deleteById); - } - } - return supplierList; - } - - @Override - public Supplier updateSupplierById(long updateById) { - Optional supplier = supplierDAO.findById(updateById); - Supplier supplierDummy = supplier.get(); - supplierDummy.setQuantityOrder(123); - return supplierDummy; - } - -} diff --git a/14SpringBootJPAmysql/src/main/resources/application.properties b/14SpringBootJPAmysql/src/main/resources/application.properties deleted file mode 100644 index 208459e0..00000000 --- a/14SpringBootJPAmysql/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -spring.h2.console.enabled=true -spring.datasource.url=jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE \ No newline at end of file diff --git a/14SpringBootJPAmysql/src/main/resources/banner b/14SpringBootJPAmysql/src/main/resources/banner deleted file mode 100644 index 851712cf..00000000 --- a/14SpringBootJPAmysql/src/main/resources/banner +++ /dev/null @@ -1,13 +0,0 @@ -spring.banner.location=classpath:/src/main/resources/bannername.txt - - - - - -${Ansi.GREEN} _ __ _ -${Ansi.GREEN} /\/\ ___ _ __ ___ ___ _ __ _ _ _ __ ___ | |_ / _| ___ _ _ _ __ __| | ___ ___ _ __ ___ -${Ansi.GREEN} / \ / _ \ '_ ` _ \ / _ \| '__| | | | '_ \ / _ \| __| |_ / _ \| | | | '_ \ / _` | / __/ _ \| '_ ` _ \ -${Ansi.GREEN} / /\/\ \ __/ | | | | | (_) | | | |_| | | | | (_) | |_| _| (_) | |_| | | | | (_| || (_| (_) | | | | | | -${Ansi.GREEN} \/ \/\___|_| |_| |_|\___/|_| \__, |_| |_|\___/ \__|_| \___/ \__,_|_| |_|\__,_(_)___\___/|_| |_| |_| -${Ansi.GREEN} |___/ -${Ansi.RED} :: Spring Boot${spring-boot.formatted-version} :: ${Ansi.DEFAULT} \ No newline at end of file diff --git a/14SpringBootJPAmysql/src/test/java/com/training/springbootjpa/SpringbootjpaApplicationTests.java b/14SpringBootJPAmysql/src/test/java/com/training/springbootjpa/SpringbootjpaApplicationTests.java deleted file mode 100644 index 6ba1f55f..00000000 --- a/14SpringBootJPAmysql/src/test/java/com/training/springbootjpa/SpringbootjpaApplicationTests.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.springbootjpa; - -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.training.springbootjpa.controller.MainController; -import com.training.springbootjpa.model.Customer; -import com.training.springbootjpa.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringbootjpaApplicationTests { - - - - - -/* @Autowired - CustomerServiceImpl mc; - - - @Test - public void testFindByCategory() { - List books = mc. - assertEquals(1, books.size()); - - for (Customer book : books) { - assertEquals(this.book.getCategory().getId(), category.getId()); - assertEquals(this.book.getAuthor(), book.getAuthor()); - assertEquals(this.book.getDescription(), book.getDescription()); - assertEquals(this.book.getIsbn(), book.getIsbn()); - } - }*/ - -} diff --git a/15springBootJPACallingFromMainMethod/.gitignore b/15springBootJPACallingFromMainMethod/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/15springBootJPACallingFromMainMethod/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/15springBootJPACallingFromMainMethod/.mvn/wrapper/maven-wrapper.jar b/15springBootJPACallingFromMainMethod/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/15springBootJPACallingFromMainMethod/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/15springBootJPACallingFromMainMethod/.mvn/wrapper/maven-wrapper.properties b/15springBootJPACallingFromMainMethod/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/15springBootJPACallingFromMainMethod/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/15springBootJPACallingFromMainMethod/mvnw b/15springBootJPACallingFromMainMethod/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/15springBootJPACallingFromMainMethod/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/15springBootJPACallingFromMainMethod/mvnw.cmd b/15springBootJPACallingFromMainMethod/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/15springBootJPACallingFromMainMethod/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/15springBootJPACallingFromMainMethod/pom.xml b/15springBootJPACallingFromMainMethod/pom.xml deleted file mode 100644 index d4966895..00000000 --- a/15springBootJPACallingFromMainMethod/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - 4.0.0 - - com.training - springbootjpa - 0.0.1-SNAPSHOT - jar - - springbootjpa - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - - org.projectlombok - lombok-maven - 1.16.20.0 - pom - - - - - - org.json - json - 20090211 - - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - runtime - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.mockito - mockito-core - 2.18.3 - - - org.mockito - mockito-junit-jupiter - 2.18.3 - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/SpringbootjpaApplication.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/SpringbootjpaApplication.java deleted file mode 100644 index cfc85aa6..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/SpringbootjpaApplication.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.training.springbootjpa; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import org.json.HTTP; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.web.client.RestTemplate; - -import com.training.springbootjpa.controller.MainController; -import com.training.springbootjpa.model.Customer; - -@SpringBootApplication -public class SpringbootjpaApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringbootjpaApplication.class, args); - - final Logger LOGGER = Logger.getLogger( MainController.class.getName() ); - System.out.println("In main class dfirst"); - //getCustomerById(); - System.out.println("In main class"); - - //createCustomer(); - - //deleteEmployee(); - - customerUpdate(); - - - - - - } - - private static void getCustomerById() - { - final Logger LOGGER = Logger.getLogger( MainController.class.getName() ); - final String uri = "http://localhost:8080/customer/{customerId}"; - - Map params = new HashMap(); - params.put("customerId", 1L); - - RestTemplate restTemplate = new RestTemplate(); - Customer result = restTemplate.getForObject(uri, Customer.class, params); - - // LOGGER.info( result); - - System.out.println(result.toString()); - } - - - private static void createCustomer() - { - final Logger LOGGER = Logger.getLogger( MainController.class.getName() ); - final String uri = "http://localhost:8080/addCustomer"; - System.out.println("In Add customer MEthod"); - // List list = new ArrayList(); - - Customer cust = new Customer("Rama","SA","DEBIT"); - - RestTemplate restTemplate = new RestTemplate(); - Customer result = restTemplate.postForObject(uri, cust,Customer.class); - System.out.println("In Add customer adding"); - // LOGGER.info( result); - System.out.println(result); - //System.out.println(result.toString()); - } - - - - private static void deleteEmployee() - { - final String uri = "http://localhost:8080/delete/{customerId}"; - - Map params = new HashMap(); - params.put("customerId", 2L); - - // Customer updatedEmployee = new Customer("Marvel", "NewYork", "CASH"); - - RestTemplate restTemplate = new RestTemplate(); - restTemplate.put ( uri, Customer.class, params); - } - - - - private static void customerUpdate() - { - final String uri = "http://localhost:8080/customerUpdate/{id}"; - - Map params = new HashMap(); - params.put("id", 5L); - - Customer updatedEmployee = new Customer("Captain Marvel", "NewYork", "CASH"); - - RestTemplate restTemplate = new RestTemplate(); - restTemplate.put ( uri, updatedEmployee, params); - } - - - -} - - - - diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/controller/MainController.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/controller/MainController.java deleted file mode 100644 index 81cea4d6..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/controller/MainController.java +++ /dev/null @@ -1,282 +0,0 @@ -package com.training.springbootjpa.controller; - -import java.util.List; -import java.util.logging.Logger; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.PathVariable; -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.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; -import com.training.springbootjpa.model.Goods; -import com.training.springbootjpa.model.Retailer; -import com.training.springbootjpa.model.Supplier; -import com.training.springbootjpa.repository.CustomerDAO; -import com.training.springbootjpa.service.CustomerService; -import com.training.springbootjpa.service.GoodsService; -import com.training.springbootjpa.service.RetailerService; -import com.training.springbootjpa.service.SupplierService; - -@RestController -public class MainController { - - - - private static final Logger LOGGER = Logger.getLogger( MainController.class.getName() ); - /* - * with help of this annonation we can access all the proporties of bean we can - * access all method of CustomerService. - */ - @Autowired - private CustomerService customerService; - - @Autowired - private GoodsService goodsService; - - @Autowired - private SupplierService supplierService; - - @Autowired - private RetailerService retailerService; - - @Autowired - CustomerDAO cdao; - - /* - * Get Customer Details using Id Handling the exception using Custom Exception - */ - @RequestMapping(value = "/customer/{id}", method = RequestMethod.GET) - public ResponseEntity getCustomerById(@PathVariable Long id) throws ManagedException { - LOGGER.info("Inside Get Customer By Id"); - Customer customer = null; - - try { - customer = customerService.getCustomerDetail(id); - } catch (ManagedException e) { - - e.getMessage(); - } - System.out.println("Customer response >>>>" + customer); - - return new ResponseEntity(customer, HttpStatus.OK); - } - - // Get Customer Details using Name - // Handling the exception - /* - * Also we can send your whole Customer Details to UI using - * ResponseEntity For now this method is just telling user that your - * data is being get added succesfully. - * - */ - - @RequestMapping(method = RequestMethod.GET, value = "/searchCustomer/{customerName}") - - public ResponseEntity searchCustomer(@PathVariable String customerName) throws ManagedException { - LOGGER.info("Inside Get Customer By Name"); - - Customer customerData = null; - - customerData = cdao.findByCustomerName(customerName); - if (customerData == null) - return new ResponseEntity("Data not found", HttpStatus.OK); - else - return new ResponseEntity("Data found", (MultiValueMap) customerData, HttpStatus.OK); - - } - - /*this method shows all customers to admin if requested - */ - - @RequestMapping(method = RequestMethod.GET, value = "/getAllCustomer") - // @PostMapping(path = "/addCustomer") - public ResponseEntity> getAllCustomer() { - LOGGER.info("Inside Get All Customers "); - final List customerData; - - customerData = customerService.getCustomer(); - - return new ResponseEntity(customerData, HttpStatus.OK); - } - - - /* - * This method add new customer to database - * Exception Handling- if users provides Null to Textbox then it will throw Proper Message to user . - */ - @RequestMapping(method = RequestMethod.POST, value = "/addCustomer") - // @PostMapping(path = "/addCustomer") - public ResponseEntity createCustomer(@RequestBody Customer customer) { - System.out.println(customer.getCustomerName()+ customer.getPaymentMode() ); - LOGGER.info("Inside Add New Customer "); - Customer customerData = null; - - try { - - customerData = customerService.addCustomer(customer); - return new ResponseEntity(customerData, HttpStatus.OK); - - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return new ResponseEntity("Provide valid input", HttpStatus.OK); - } - - - } - - - - - - /** - * GET /delete Delete a customer details from the database. - * - * - */ - @RequestMapping("/delete/{customerId}") - public ResponseEntity deleteCustomerRecord(@PathVariable Long customerId) { - - Customer cust =null; - LOGGER.info("Inside Delete Customer "); - try { - cust = customerService.deleteCustomerById(customerId); - } catch (ManagedException e) { - - - e.printStackTrace(); - return new ResponseEntity("Given Id not found", HttpStatus.OK); - } - - return new ResponseEntity("Given Id deleted successfully ", HttpStatus.OK); - } - - - /** - * - * Another Implementation - * GET /delete Delete a customer details from the database. - * - * - */ - - -/** - * GET /delete Delete a booking from the database. - */ - /* @RequestMapping("/delete/{customerId}") - public String deletecustomer(@PathVariable Long customerId) { - - LOGGER.info("Inside Delete Customer "); - try { - customerService.deleteCustomerById(customerId); - } catch (ManagedException e) { - - - e.printStackTrace(); - return "CustomerID #"+customerId+" Not Found"; - } - - return "CustomerID #"+customerId+" deleted successfully"; - } - -*/ - - - - - - @PutMapping("/customerUpdate/{id}") - public ResponseEntity customerUpdate(@RequestBody final Customer customer, - @PathVariable(value = "id") final Long id) { - Long customerId; - try { - customerId = customerService.updateCustomer(customer, id); - return new ResponseEntity(customerId, HttpStatus.OK); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg = e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - - } - - } - - @RequestMapping(method = RequestMethod.POST, value = "/addGoods", produces = MediaType.APPLICATION_JSON_VALUE) - ResponseEntity createGoods(@RequestBody Goods goods) { - System.out.println(goods); - final Goods goodsData; - goodsData = goodsService.addGoods(goods); - return new ResponseEntity(goodsData, HttpStatus.OK); - } - - @RequestMapping(value = "/deleteGoods/{deleteById}", method = RequestMethod.GET) - public ResponseEntity deleteGoods(@PathVariable("deleteById") long deleteById) { - final List goodsList; - goodsList = goodsService.deleteGoodsById(deleteById); - return new ResponseEntity(goodsList, HttpStatus.OK); - } - - @RequestMapping(value = "/updateGoods/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateGoods(@PathVariable("updateById") long updateById) { - final Goods goods = goodsService.updateGoodsById(updateById); - return new ResponseEntity(goods, HttpStatus.OK); - } - - @RequestMapping(method = RequestMethod.POST, value = "/addSupplier", produces = - - MediaType.APPLICATION_JSON_VALUE) // @PostMapping(path = "/addSupplier") - public ResponseEntity createSupplier(@RequestBody Supplier supplier) { - System.out.println(supplier); - final Supplier supplierData; - supplierData = supplierService.addSupplier(supplier); - return new ResponseEntity(supplierData, HttpStatus.OK); - } - - @RequestMapping(value = "/deleteSupplier/{deleteById}", method = RequestMethod.GET) - public ResponseEntity deleteSupplier(@PathVariable("deleteById") long deleteById) { - final List supplierList; - supplierList = supplierService.deleteSupplierById(deleteById); - return new ResponseEntity(supplierList, HttpStatus.OK); - } - - @RequestMapping(value = "/updateSupplier/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateSupplier(@PathVariable("updateById") long updateById) { - final Supplier supplier = supplierService.updateSupplierById(updateById); - return new ResponseEntity(supplier, HttpStatus.OK); - } - - @RequestMapping(method = RequestMethod.POST, value = "/addRetailer", produces = MediaType.APPLICATION_JSON_VALUE) // @PostMapping(path - // = - // "/addRetailer") - public ResponseEntity createRetailer(@RequestBody Retailer retailer) { - System.out.println(retailer); - final Retailer retailerData; - retailerData = retailerService.addRetailer(retailer); - return new ResponseEntity(retailerData, HttpStatus.OK); - } - - @RequestMapping(value = "/deleteRetailer/{deleteById}", method = RequestMethod.GET) - public ResponseEntity deleteRetailer(@PathVariable("deleteById") long deleteById) { - final List retailerList; - retailerList = retailerService.deleteRetailerById(deleteById); - return new ResponseEntity(retailerList, HttpStatus.OK); - } - - @RequestMapping(value = "/updateRetailer/{updateById}", method = RequestMethod.GET) - public ResponseEntity updateRetailer(@PathVariable("updateById") long updateById) { - final Retailer retailer = retailerService.updateRetailerById(updateById); - return new ResponseEntity(retailer, HttpStatus.OK); - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/exception/ManagedException.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/exception/ManagedException.java deleted file mode 100644 index 3da2658f..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/exception/ManagedException.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - */ -package com.training.springbootjpa.exception; - -/** - * @author trainee - * - */ -public class ManagedException extends Exception { - - - public ManagedException(final String errorMessage) { - - super(errorMessage); - - } - - public ManagedException() { - // TODO Auto-generated constructor stub - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Customer.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Customer.java deleted file mode 100644 index 7c6a99ab..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Customer.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author RamDAfale - * - */ -@Entity -@Table(name = "customer") -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long customerId; - private String customerName; - private String customerAddress; - private String paymentMode; - - /** - * @param customerId - * @param customerName - * @param customerAddress - * - * @param paymentMode - */ - public Customer() { - } - - public Customer(String customerName, String customerAddress, String paymentMode) { - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - - /** - * @param customerAddress - * the customerAddress to set - */ - public void setCustomerAddress(String customerAddress) { - this.customerAddress = customerAddress; - } - - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - - /** - * @param paymentMode - * the paymentMode to set - */ - public void setPaymentMode(String paymentMode) { - this.paymentMode = paymentMode; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerAddress=" - + customerAddress + ", paymentMode=" + paymentMode + "]"; - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Goods.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Goods.java deleted file mode 100644 index 4b576333..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Goods.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "goods") -public class Goods { - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - private Long goodsId; - private String goodsName; - private Integer goodsQuantity; - private Double goodsPrice; - - - - /** - * - */ - public Goods() { - super(); - } - - /** - * @param goodsId - * @param goodsName - * @param goodsQuantity - * @param goodsPrice - * @param supplierId - */ - public Goods(Long goodsId, String goodsName, Integer goodsQuantity, Double goodsPrice, Long supplierId) { - super(); - this.goodsId = goodsId; - this.goodsName = goodsName; - this.goodsQuantity = goodsQuantity; - this.goodsPrice = goodsPrice; - - } - - /** - * @return the goodsId - */ - public Long getGoodsId() { - return goodsId; - } - /** - * @param goodsId the goodsId to set - */ - public void setGoodsId(Long goodsId) { - this.goodsId = goodsId; - } - /** - * @return the goodsName - */ - public String getGoodsName() { - return goodsName; - } - /** - * @param goodsName the goodsName to set - */ - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - /** - * @return the goodsQuantity - */ - public Integer getGoodsQuantity() { - return goodsQuantity; - } - /** - * @param goodsQuantity the goodsQuantity to set - */ - public void setGoodsQuantity(Integer goodsQuantity) { - this.goodsQuantity = goodsQuantity; - } - /** - * @return the goodsPrice - */ - public Double getGoodsPrice() { - return goodsPrice; - } - /** - * @param goodsPrice the goodsPrice to set - */ - public void setGoodsPrice(Double goodsPrice) { - this.goodsPrice = goodsPrice; - } - - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Goods [goodsId=" + goodsId + ", goodsName=" + goodsName + ", goodsQuantity=" + goodsQuantity - + ", goodsPrice=" + goodsPrice + "]"; - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Retailer.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Retailer.java deleted file mode 100644 index 24b14dfa..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Retailer.java +++ /dev/null @@ -1,102 +0,0 @@ - -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author RamDAfale - * - */ -@Entity -@Table(name = "retailer") -public class Retailer { - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - private Long retailerId; - private String retailerName; - private String retailerAddress; - - /** - * @param retailerId - * @param retailerName - * @param retailerAddress - */ - public Retailer(Long retailerId, String retailerName, String retailerAddress) { - super(); - this.retailerId = retailerId; - this.retailerName = retailerName; - this.retailerAddress = retailerAddress; - } - - /** - * - */ - public Retailer() { - super(); - } - - /** - * @return the retailerId - */ - public Long getRetailerId() { - return retailerId; - } - - /** - * @param retailerId - * the retailerId to set - */ - public void setRetailerId(Long retailerId) { - this.retailerId = retailerId; - } - - /** - * @return the retailerName - */ - public String getRetailerName() { - return retailerName; - } - - /** - * @param retailerName - * the retailerName to set - */ - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - /** - * @return the retailerAddress - */ - public String getRetailerAddress() { - return retailerAddress; - } - - /** - * @param retailerAddress - * the retailerAddres to set - */ - public void setRetailerAddress(String retailerAddress) { - this.retailerAddress = retailerAddress; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Retailer [retailerId=" + retailerId + ", retailerName=" + retailerName + ", retailerAddress=" - + retailerAddress + ", getRetailerId()=" + getRetailerId() + ", getRetailerName()=" + getRetailerName() - + ", getRetailerAddress()=" + getRetailerAddress() + ", getClass()=" + getClass() + ", hashCode()=" - + hashCode() + ", toString()=" + super.toString() + "]"; - } - - - - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Supplier.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Supplier.java deleted file mode 100644 index c0124bc8..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/model/Supplier.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.training.springbootjpa.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author RamDAfale - * - */ -@Entity -@Table(name = "supplier") -public class Supplier { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long supplierId; - private String supplierName; - private String supplierAddress; - private int quantityOrder; - private int orderId; - private Double amount; - - - /** - * - */ - public Supplier() { - super(); - } - - /** - * @param supplierId - * @param supplierName - * @param supplierAddress - * @param quantityOrder - * @param orderId - * @param amount - * @param retailerId - */ - public Supplier(Long supplierId, String supplierName, String supplierAddress, int quantityOrder, int orderId, - Double amount, String retailerId) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - - } - - /** - * @return the supplierId - */ - public Long getSupplierId() { - return supplierId; - } - - /** - * @param supplierId - * the supplierId to set - */ - public void setSupplierId(Long supplierId) { - this.supplierId = supplierId; - } - - /** - * @return the supplierName - */ - public String getSupplierName() { - return supplierName; - } - - /** - * @param supplierName - * the supplierName to set - */ - public void setSupplierName(String supplierName) { - this.supplierName = supplierName; - } - - /** - * @return the supplierAddress - */ - public String getSupplierAddress() { - return supplierAddress; - } - - /** - * @param supplierAddress - * the supplierAddress to set - */ - public void setSupplierAddress(String supplierAddress) { - this.supplierAddress = supplierAddress; - } - - /** - * @return the quantityOrder - */ - public int getQuantityOrder() { - return quantityOrder; - } - - /** - * @param quantityOrder - * the quantityOrder to set - */ - public void setQuantityOrder(int quantityOrder) { - this.quantityOrder = quantityOrder; - } - - /** - * @return the orderId - */ - public int getOrderId() { - return orderId; - } - - /** - * @param orderId - * the orderId to set - */ - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - /** - * @return the amount - */ - public Double getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(Double amount) { - this.amount = amount; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "Supplier [supplierId=" + supplierId + ", supplierName=" + supplierName + ", supplierAddress=" - + supplierAddress + ", quantityOrder=" + quantityOrder + ", orderId=" + orderId + ", amount=" + amount - + "]"; - } -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/CustomerDAO.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/CustomerDAO.java deleted file mode 100644 index 37168ec0..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/CustomerDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.training.springbootjpa.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.repository.CrudRepository; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; - -public interface CustomerDAO extends JpaRepository { - - /* - *this method find your name in database and return the details if name found - *also this method internally fire a select query based on parameter you pass to it. - */ - Customer findByCustomerName(String customerName) throws ManagedException; - - /* - this method find your name & database in database and return the details if name & address is found - also this method internally fire a select query based on parameter you pass to it. - */ - - List findByCustomerNameAndCustomerAddress(String customerName, String customerAddress); -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/GoodsDAO.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/GoodsDAO.java deleted file mode 100644 index 0ee1b2dc..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/GoodsDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.springbootjpa.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.training.springbootjpa.model.Goods; - -public interface GoodsDAO extends JpaRepository{ - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/RetailerDAO.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/RetailerDAO.java deleted file mode 100644 index 417774f1..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/RetailerDAO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.training.springbootjpa.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.training.springbootjpa.model.Retailer; - -public interface RetailerDAO extends JpaRepository { -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/SupplierDAO.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/SupplierDAO.java deleted file mode 100644 index edae2df1..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/repository/SupplierDAO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.training.springbootjpa.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.training.springbootjpa.model.Supplier; - -public interface SupplierDAO extends JpaRepository { -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/CustomerService.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/CustomerService.java deleted file mode 100644 index ab5558cc..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/CustomerService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; - -public interface CustomerService { - - Customer addCustomer(Customer customer) throws ManagedException; - - Customer deleteCustomerById(long deleteById)throws ManagedException ; - - //Customer updateCustomerById(long updateById); - - List getCustomer(); - - Customer getCustomerDetail(Long id) throws ManagedException; - - Long updateCustomer(Customer customerReq, Long id) throws ManagedException; - - - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/CustomerServiceImpl.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/CustomerServiceImpl.java deleted file mode 100644 index 747ed57f..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/CustomerServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.training.springbootjpa.exception.ManagedException; -import com.training.springbootjpa.model.Customer; -import com.training.springbootjpa.repository.CustomerDAO; - -/** - * @author RamDAfale - * - */ - -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO customerDAO; - - @Override - public Customer addCustomer(Customer customer) throws ManagedException { - Customer customerData = customerDAO.save(customer); - System.out.println(customerData.getCustomerName()+ customerData.getPaymentMode() ); - if ( customerData.getCustomerName()==null || customerData.getPaymentMode() == null ) - { - throw new ManagedException("provide correct details"); - } - else - - return customerData; - } - - - - - - - - @Override - public Customer deleteCustomerById(long deleteById) throws ManagedException { - - Optional customer=customerDAO.findById(deleteById); - if(customer.isPresent()) - { - customerDAO.deleteById(deleteById); - } - else - { - throw new ManagedException("Id not Found"); - - } - return null; - } - - - - @Override - public Long updateCustomer(Customer customerReq, Long id) throws ManagedException { - // TODO Auto-generated method stub - Optional customer = customerDAO.findById(id); - if (customer.isPresent()) { - Customer cust = customerDAO.getOne(id); - if (customerReq.getPaymentMode() != null) { - cust.setPaymentMode(customerReq.getPaymentMode()); - //LOGGER.info("hello"); - } - if (customerReq.getCustomerAddress() != null) { - cust.setCustomerAddress(customerReq.getCustomerAddress()); - } - if (customerReq.getCustomerName() != null) { - cust.setCustomerName(customerReq.getCustomerName()); - } - - - customerDAO.save(cust); - } else { - throw new ManagedException("Sorry !! such record not exist in database"); - } - - return id; - } - - @Override - public List getCustomer() { - - return (List) customerDAO.findAll(); - } - - @Override - public Customer getCustomerDetail(Long id) throws ManagedException { - - Optional customerData = customerDAO.findById(id); - - if (customerData.isPresent()) { - Customer cust1=customerDAO.getOne(id); - return cust1; - - } else - - { - throw new ManagedException("not found!!"); - } - - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/GoodsService.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/GoodsService.java deleted file mode 100644 index dd268389..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/GoodsService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; -import com.training.springbootjpa.model.Goods; - -public interface GoodsService { - - Goods addGoods(Goods goods); - - public List deleteGoodsById(long deleteById); - - public Goods updateGoodsById(long updateById); - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/GoodsServiceImpl.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/GoodsServiceImpl.java deleted file mode 100644 index 45b4ce39..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/GoodsServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.training.springbootjpa.model.Goods; -import com.training.springbootjpa.repository.GoodsDAO; - -/** - * @author RamDAfale - * - */ -@Service("goodsService") -public class GoodsServiceImpl implements GoodsService { - - @Autowired - private GoodsDAO goodsDAO; - - @Override - public Goods addGoods(Goods goods) { - Goods goodsData = goodsDAO.save(goods); - return goodsData; - } - - @Override - public List deleteGoodsById(long deleteById) { - List goodsList = goodsDAO.findAll(); - Iterator iterator = goodsList.iterator(); - while (iterator.hasNext()) { - Goods goods = (Goods) iterator.next(); - if (goods.getGoodsId() == deleteById) { - goodsDAO.deleteById(deleteById); - } - } - return goodsList; - } - - @Override - public Goods updateGoodsById(long updateById) { - Optional goods = goodsDAO.findById(updateById); - Goods goodsDummy = goods.get(); - goodsDummy.setGoodsPrice(1021.12); - return goodsDummy; - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/RetailerService.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/RetailerService.java deleted file mode 100644 index 8fe6025f..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/RetailerService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; - -import com.training.springbootjpa.model.Retailer; - -public interface RetailerService { - - public Retailer addRetailer(Retailer retailer); - - public List deleteRetailerById(long deleteById); - - public Retailer updateRetailerById(long updateById); - - - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/RetailerServiceImpl.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/RetailerServiceImpl.java deleted file mode 100644 index bad09c2a..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/RetailerServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.training.springbootjpa.model.Retailer; -import com.training.springbootjpa.repository.RetailerDAO; - -@Service("retailerService") -public class RetailerServiceImpl implements RetailerService { - - @Autowired - private RetailerDAO retailerDAO; - - @Override - public Retailer addRetailer(Retailer retailer) { - Retailer retailerData = retailerDAO.save(retailer); - return retailerData; - } - - @Override - public List deleteRetailerById(long deleteById) { - List retailerList = retailerDAO.findAll(); - Iterator iterator = retailerList.iterator(); - while (iterator.hasNext()) { - Retailer retailer = (Retailer) iterator.next(); - if (retailer.getRetailerId() == deleteById) { - retailerDAO.deleteById(deleteById); - } - } - return retailerList; - } - - @Override - public Retailer updateRetailerById(long updateById) { - Optional retailer = retailerDAO.findById(updateById); - Retailer retailerDummy = retailer.get(); - retailerDummy.setRetailerAddress("Changed Address at Winterfell"); - return retailerDummy; - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/SupplierService.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/SupplierService.java deleted file mode 100644 index 55213cfb..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/SupplierService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.List; -import com.training.springbootjpa.model.Supplier; - -public interface SupplierService { - - public Supplier addSupplier(Supplier supplier); - - public List deleteSupplierById(long deleteById); - - public Supplier updateSupplierById(long updateById); -} diff --git a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/SupplierServiceImpl.java b/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/SupplierServiceImpl.java deleted file mode 100644 index ecec5b91..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/java/com/training/springbootjpa/service/SupplierServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.training.springbootjpa.service; - -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.training.springbootjpa.model.Supplier; -import com.training.springbootjpa.repository.SupplierDAO; - -@Service("supplierService") -public class SupplierServiceImpl implements SupplierService { - - @Autowired - private SupplierDAO supplierDAO; - - @Override - public Supplier addSupplier(Supplier supplier) { - Supplier supplierData = supplierDAO.save(supplier); - return supplierData; - } - - @Override - public List deleteSupplierById(long deleteById) { - List supplierList = supplierDAO.findAll(); - Iterator iterator = supplierList.iterator(); - while (iterator.hasNext()) { - Supplier supplier = (Supplier) iterator.next(); - if (supplier.getSupplierId() == deleteById) { - supplierDAO.deleteById(deleteById); - } - } - return supplierList; - } - - @Override - public Supplier updateSupplierById(long updateById) { - Optional supplier = supplierDAO.findById(updateById); - Supplier supplierDummy = supplier.get(); - supplierDummy.setQuantityOrder(123); - return supplierDummy; - } - -} diff --git a/15springBootJPACallingFromMainMethod/src/main/resources/application.properties b/15springBootJPACallingFromMainMethod/src/main/resources/application.properties deleted file mode 100644 index e579783a..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -spring.h2.console.enabled=true -spring.datasource.url=jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE - diff --git a/15springBootJPACallingFromMainMethod/src/main/resources/banner.txt b/15springBootJPACallingFromMainMethod/src/main/resources/banner.txt deleted file mode 100644 index 4a6da677..00000000 --- a/15springBootJPACallingFromMainMethod/src/main/resources/banner.txt +++ /dev/null @@ -1,15 +0,0 @@ -spring.banner.location=classpath:/src/main/resources/bannername.txt - - - - - -${Ansi.GREEN} _ __ _ -${Ansi.GREEN} /\/\ ___ _ __ ___ ___ _ __ _ _ _ __ ___ | |_ / _| ___ _ _ _ __ __| | ___ ___ _ __ ___ -${Ansi.GREEN} / \ / _ \ '_ ` _ \ / _ \| '__| | | | '_ \ / _ \| __| |_ / _ \| | | | '_ \ / _` | / __/ _ \| '_ ` _ \ -${Ansi.GREEN} / /\/\ \ __/ | | | | | (_) | | | |_| | | | | (_) | |_| _| (_) | |_| | | | | (_| || (_| (_) | | | | | | -${Ansi.GREEN} \/ \/\___|_| |_| |_|\___/|_| \__, |_| |_|\___/ \__|_| \___/ \__,_|_| |_|\__,_(_)___\___/|_| |_| |_| -${Ansi.GREEN} - - -${Ansi.RED} :: Spring Boot${spring-boot.formatted-version} :: ${Ansi.DEFAULT} \ No newline at end of file diff --git a/15springBootJPACallingFromMainMethod/src/test/java/com/training/springbootjpa/SpringbootjpaApplicationTests.java b/15springBootJPACallingFromMainMethod/src/test/java/com/training/springbootjpa/SpringbootjpaApplicationTests.java deleted file mode 100644 index 6ba1f55f..00000000 --- a/15springBootJPACallingFromMainMethod/src/test/java/com/training/springbootjpa/SpringbootjpaApplicationTests.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.training.springbootjpa; - -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.training.springbootjpa.controller.MainController; -import com.training.springbootjpa.model.Customer; -import com.training.springbootjpa.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringbootjpaApplicationTests { - - - - - -/* @Autowired - CustomerServiceImpl mc; - - - @Test - public void testFindByCategory() { - List books = mc. - assertEquals(1, books.size()); - - for (Customer book : books) { - assertEquals(this.book.getCategory().getId(), category.getId()); - assertEquals(this.book.getAuthor(), book.getAuthor()); - assertEquals(this.book.getDescription(), book.getDescription()); - assertEquals(this.book.getIsbn(), book.getIsbn()); - } - }*/ - -} diff --git a/16BankAppSpringBootJPA/.classpath b/16BankAppSpringBootJPA/.classpath deleted file mode 100644 index 6d7587a8..00000000 --- a/16BankAppSpringBootJPA/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/16BankAppSpringBootJPA/.eclipse-pmd b/16BankAppSpringBootJPA/.eclipse-pmd deleted file mode 100644 index 8c5b4482..00000000 --- a/16BankAppSpringBootJPA/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/16BankAppSpringBootJPA/.project b/16BankAppSpringBootJPA/.project deleted file mode 100644 index fce9fe2c..00000000 --- a/16BankAppSpringBootJPA/.project +++ /dev/null @@ -1,52 +0,0 @@ - - - bank - - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - ch.acanda.eclipse.pmd.builder.PMDBuilder - - - - - net.sf.eclipsecs.core.CheckstyleBuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - ch.acanda.eclipse.pmd.builder.PMDNature - net.sf.eclipsecs.core.CheckstyleNature - - diff --git a/16BankAppSpringBootJPA/.settings/org.eclipse.core.resources.prefs b/16BankAppSpringBootJPA/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/16BankAppSpringBootJPA/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/16BankAppSpringBootJPA/.settings/org.eclipse.jdt.core.prefs b/16BankAppSpringBootJPA/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351ae..00000000 --- a/16BankAppSpringBootJPA/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/16BankAppSpringBootJPA/.settings/org.eclipse.wst.common.project.facet.core.xml b/16BankAppSpringBootJPA/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d8582952..00000000 --- a/16BankAppSpringBootJPA/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/16BankAppSpringBootJPA/.settings/org.springframework.ide.eclipse.prefs b/16BankAppSpringBootJPA/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index a12794d6..00000000 --- a/16BankAppSpringBootJPA/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 diff --git a/16BankAppSpringBootJPA/bin/.settings/org.eclipse.core.resources.prefs b/16BankAppSpringBootJPA/bin/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/16BankAppSpringBootJPA/bin/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/16BankAppSpringBootJPA/bin/.settings/org.eclipse.jdt.core.prefs b/16BankAppSpringBootJPA/bin/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351ae..00000000 --- a/16BankAppSpringBootJPA/bin/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/16BankAppSpringBootJPA/bin/.settings/org.eclipse.wst.common.project.facet.core.xml b/16BankAppSpringBootJPA/bin/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d8582952..00000000 --- a/16BankAppSpringBootJPA/bin/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/16BankAppSpringBootJPA/bin/.settings/org.springframework.ide.eclipse.prefs b/16BankAppSpringBootJPA/bin/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index a12794d6..00000000 --- a/16BankAppSpringBootJPA/bin/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 diff --git a/16BankAppSpringBootJPA/bin/mvnw b/16BankAppSpringBootJPA/bin/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/16BankAppSpringBootJPA/bin/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/16BankAppSpringBootJPA/bin/mvnw.cmd b/16BankAppSpringBootJPA/bin/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/16BankAppSpringBootJPA/bin/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/16BankAppSpringBootJPA/bin/pom.xml b/16BankAppSpringBootJPA/bin/pom.xml deleted file mode 100644 index 77e0a5df..00000000 --- a/16BankAppSpringBootJPA/bin/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - bank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/BankApplication.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/BankApplication.class deleted file mode 100644 index 83bc78b5..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/BankApplication.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/controller/BankController.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/controller/BankController.class deleted file mode 100644 index 11b28f13..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/controller/BankController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/ATM.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/ATM.class deleted file mode 100644 index 1142c83b..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/ATM.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/Bank.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/Bank.class deleted file mode 100644 index 77d3900f..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/Bank.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/Customer.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/Customer.class deleted file mode 100644 index acf0309f..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/model/Customer.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/repository/BankDAO.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/repository/BankDAO.class deleted file mode 100644 index f296085c..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/repository/BankDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/repository/CustomerDAO.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/repository/CustomerDAO.class deleted file mode 100644 index 85a53f04..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/repository/CustomerDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/BankService.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/BankService.class deleted file mode 100644 index 128ab942..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/BankService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/BankServiceImpl.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/BankServiceImpl.class deleted file mode 100644 index 9eafc70d..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/BankServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/CustomerService.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/CustomerService.class deleted file mode 100644 index 8ac7b74c..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/CustomerService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/CustomerServiceImpl.class b/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/CustomerServiceImpl.class deleted file mode 100644 index c5be0e25..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/main/java/com/springboot/bank/service/CustomerServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/src/main/resources/application.properties b/16BankAppSpringBootJPA/bin/src/main/resources/application.properties deleted file mode 100644 index 359e7982..00000000 --- a/16BankAppSpringBootJPA/bin/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -<<<<<<< HEAD -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -======= -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/16BankAppSpringBootJPA/bin/src/test/java/com/springboot/bank/BankApplicationTests.class b/16BankAppSpringBootJPA/bin/src/test/java/com/springboot/bank/BankApplicationTests.class deleted file mode 100644 index 9bf1c99f..00000000 Binary files a/16BankAppSpringBootJPA/bin/src/test/java/com/springboot/bank/BankApplicationTests.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/bin/target/classes/META-INF/MANIFEST.MF b/16BankAppSpringBootJPA/bin/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index 7af7641a..00000000 --- a/16BankAppSpringBootJPA/bin/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,23 +0,0 @@ -<<<<<<< HEAD -Manifest-Version: 1.0 -Implementation-Title: bank -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: Lohit -Implementation-Vendor-Id: com.springboot -Build-Jdk: 1.8.0_121 -Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo - ot-starter-parent/bank -Created-By: Maven Integration for Eclipse - -======= -Manifest-Version: 1.0 -Implementation-Title: bank -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: Lohit -Implementation-Vendor-Id: com.springboot -Build-Jdk: 1.8.0_121 -Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo - ot-starter-parent/bank -Created-By: Maven Integration for Eclipse - ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/16BankAppSpringBootJPA/bin/target/classes/META-INF/maven/com.springboot/bank/pom.properties b/16BankAppSpringBootJPA/bin/target/classes/META-INF/maven/com.springboot/bank/pom.properties deleted file mode 100644 index ac4821f3..00000000 --- a/16BankAppSpringBootJPA/bin/target/classes/META-INF/maven/com.springboot/bank/pom.properties +++ /dev/null @@ -1,17 +0,0 @@ -<<<<<<< HEAD -#Generated by Maven Integration for Eclipse -#Thu May 17 10:00:13 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.springboot -m2e.projectName=bank -m2e.projectLocation=C\:\\Users\\Lohit\\Desktop\\bank -artifactId=bank -======= -#Generated by Maven Integration for Eclipse -#Wed May 16 18:21:54 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.springboot -m2e.projectName=bank -m2e.projectLocation=C\:\\Users\\Lohit\\Desktop\\bank -artifactId=bank ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/16BankAppSpringBootJPA/bin/target/classes/META-INF/maven/com.springboot/bank/pom.xml b/16BankAppSpringBootJPA/bin/target/classes/META-INF/maven/com.springboot/bank/pom.xml deleted file mode 100644 index 77e0a5df..00000000 --- a/16BankAppSpringBootJPA/bin/target/classes/META-INF/maven/com.springboot/bank/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - bank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/16BankAppSpringBootJPA/bin/target/classes/application.properties b/16BankAppSpringBootJPA/bin/target/classes/application.properties deleted file mode 100644 index 359e7982..00000000 --- a/16BankAppSpringBootJPA/bin/target/classes/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -<<<<<<< HEAD -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -======= -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/16BankAppSpringBootJPA/mvnw b/16BankAppSpringBootJPA/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/16BankAppSpringBootJPA/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/16BankAppSpringBootJPA/mvnw.cmd b/16BankAppSpringBootJPA/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/16BankAppSpringBootJPA/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/16BankAppSpringBootJPA/pom.xml b/16BankAppSpringBootJPA/pom.xml deleted file mode 100644 index d09d388b..00000000 --- a/16BankAppSpringBootJPA/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - MyBankDemo - project for Bank Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - log4j - log4j - 1.2.17 - - - - org.mockito - mockito-all - 1.9.5 - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/BankApplication.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/BankApplication.java deleted file mode 100644 index 1387b62c..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/BankApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.springboot.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class BankApplication { - - public static void main(String[] args) { - SpringApplication.run(BankApplication.class, args); - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/ATMController.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/ATMController.java deleted file mode 100644 index cc655e51..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/ATMController.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import java.math.BigDecimal; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.springboot.bank.dto.ATMDetails; -import com.springboot.bank.dto.WrapperBankATM; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.ATM; -import com.springboot.bank.service.ATMService; - -/** - * @author Ram - * - */ - -@RestController -public class ATMController { - - final Logger LOGGER = Logger.getLogger(ATMController.class); - - @Autowired - ATMService atmService; - - @PostMapping(value = "/createATM") - public ResponseEntity createATM(@RequestBody WrapperBankATM wrapperBankATM) throws BankException { - ATM atmData = null; - try { - atmData = atmService.createATM(wrapperBankATM); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (atmData == null) - throw new BankException("atm details not added"); - else - return new ResponseEntity(atmData, HttpStatus.OK); - } - - @PostMapping(value = "/addMoney/{atmId}/{bankId}/{moneyToBeAddedToATM}") - public ResponseEntity addMoneyFromBank(@PathVariable Long atmId, @PathVariable Long bankId, - @PathVariable BigDecimal moneyToBeAddedToATM) throws BankException { - ATM atmData = null; - try { - atmData = atmService.addMoneyFromBank(atmId, bankId, moneyToBeAddedToATM); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (atmData == null) - throw new BankException("atm details not added"); - else - return new ResponseEntity(atmData, HttpStatus.OK); - } - - @PostMapping(value = "/withdrawMoneyFromATM") - public ResponseEntity withdrawMoney(@RequestBody ATMDetails atmDetails) throws BankException { - ATM atmData = null; - try { - atmData = atmService.withdrawMoney(atmDetails); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (atmData == null) - throw new BankException("atm details not added"); - else - return new ResponseEntity(atmData, HttpStatus.OK); - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/AccountController.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/AccountController.java deleted file mode 100644 index 80278422..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/AccountController.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.springboot.bank.dto.AccountDetails; -import com.springboot.bank.dto.WrapperBankCustomerAccount; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.service.AccountService; - -/** - * @author Ram - * - */ - -@RestController -public class AccountController { - - @Autowired - AccountService accountService; - - final Logger LOGGER = Logger.getLogger(AccountController.class); - - @PostMapping(value = "/createAccount") - public ResponseEntity createAccount(@RequestBody WrapperBankCustomerAccount wrapperBankCustomerAccount) - throws BankException { - Account accountData = null; - try { - accountData = accountService.createAccount(wrapperBankCustomerAccount); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not added"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } - - @PostMapping(value = "/depositMoney") - public ResponseEntity depositMoney(@RequestBody AccountDetails accountDetails) throws BankException { - Account accountData = null; - try { - accountData = accountService.depositMoney(accountDetails); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not found"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } - - @PostMapping(value = "/withdrawMoneyFromAccount") - public ResponseEntity withdrawMoney(@RequestBody AccountDetails accountDetails) throws BankException { - Account accountData = null; - try { - accountData = accountService.withdrawMoney(accountDetails); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not found"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } - - @PostMapping(value = "/viewAccount/{accountId}") - public ResponseEntity getAccountDetails(@PathVariable Long accountId) throws BankException { - Account accountData = null; - try { - accountData = accountService.getAccountDetails(accountId); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not found"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/BankController.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/BankController.java deleted file mode 100644 index 553325e0..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.service.BankService; - -/** - * @author Ram - * - */ - -@RestController -public class BankController { - - final Logger LOGGER = Logger.getLogger(BankController.class); - - @Autowired - private BankService bankService; - - @PostMapping(value = "/createBank") - public ResponseEntity addBank(@RequestBody Bank bank) throws BankException { - Bank bankData = null; - try { - bankData = bankService.createBank(bank); - } catch (Exception e) { - LOGGER.error(e.getMessage()); - } - if (bankData == null) - throw new BankException("Bank details not added"); - else - return new ResponseEntity(bankData, HttpStatus.OK); - } - - @GetMapping(value = "/viewBankDetails/{bankId}") - public ResponseEntity getBankDetails(@PathVariable Long bankId) throws BankException { - Bank bank = null; - try { - bank = bankService.getBankDetails(bankId); - } catch (Exception e) { - LOGGER.error(e.getMessage()); - } - if (bank == null) - throw new BankException("No such Id of Bank exixts"); - else - return new ResponseEntity(bank, HttpStatus.OK); - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/BankDenominationController.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/BankDenominationController.java deleted file mode 100644 index d92cd677..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/BankDenominationController.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import java.util.logging.Logger; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.springboot.bank.dto.WrapperATMDenomination; -import com.springboot.bank.dto.WrapperDenomination; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Denomination; -import com.springboot.bank.service.BankDenominationService; - - - -/** - * @author Ram - * - */ -@RestController -public class BankDenominationController { - - - private static final Logger LOGGER = Logger.getLogger( Account.class.getName() ); - - - @Autowired - BankDenominationService bankDenominationService; - - @PostMapping("/totalDenom") - public ResponseEntity getTotalDenominationForBank(final @RequestBody WrapperDenomination wrapperDenomination ) throws BankException { - final Denomination denomination = new Denomination(); - try { - bankDenominationService.addDenominationNew(wrapperDenomination.getAmount()); - } catch (BankException e) { - System.out.println(e.getMessage()); - LOGGER.info(e.getMessage()); - } - if (denomination == null) { - throw new BankException("not found"); - } else { - return new ResponseEntity(denomination, HttpStatus.OK); - } - } - - /** - * @param wrapperBankDenomination - * @return - * @throws BankException - */ -@PostMapping("/") public ResponseEntity getTotalDenominationForATM(final @RequestBody WrapperATMDenomination wrapperATMDenomination ) throws BankException { - final Denomination bankDenomination = new Denomination(); - try { - bankDenominationService.addDenominationNew(wrapperATMDenomination.getAmount()); - } catch (BankException e) { - System.out.println(e.getMessage()); - LOGGER.info(e.getMessage()); - } - return new ResponseEntity(bankDenomination, HttpStatus.OK); - } - - - - - - - -} \ No newline at end of file diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/CustomerController.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/CustomerController.java deleted file mode 100644 index f5673796..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/CustomerController.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Customer; -import com.springboot.bank.service.CustomerService; - -/** - * @author Ram - * - */ - -@RestController -public class CustomerController { - - final Logger LOGGER = Logger.getLogger(CustomerController.class); - - @Autowired - private CustomerService customerService; - - @PostMapping(value = "/createCustomer") - public ResponseEntity createCustomer(@RequestBody WrapperBankCustomer wrapperBankCustomer) - throws BankException { - Customer customerData = null; - try { - customerData = customerService.createCustomer(wrapperBankCustomer); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (customerData == null) - throw new BankException("Customer details not added"); - else - return new ResponseEntity(customerData, HttpStatus.OK); - } - - @GetMapping(value = "/viewCustomer/{customerId}") - public ResponseEntity getCustomerDetails(@PathVariable Long customerId) throws BankException { - Customer customerData = null; - try { - customerData = customerService.getCustomerDetails(customerId); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (customerData == null) - throw new BankException("No such Id of Bank exixts"); - else - return new ResponseEntity(customerData, HttpStatus.OK); - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/TransactionController.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/TransactionController.java deleted file mode 100644 index 28f96e7b..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/controller/TransactionController.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import java.util.Optional; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Transaction; -import com.springboot.bank.service.TransactionService; - -/** - * @author Ram - * - */ - -@RestController -public class TransactionController { - - final Logger LOGGER = Logger.getLogger(TransactionController.class); - - @Autowired - private TransactionService transactionService; - - @PostMapping(value = "/createTransaction") - public ResponseEntity createTransaction(@RequestBody Transaction transaction) throws BankException { - String transactionData = null; - try { - transactionData = transactionService.createTransaction(transaction); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (transactionData == null) - throw new BankException("Transaction details not added"); - else - return new ResponseEntity(transactionData, HttpStatus.OK); - } - - @PostMapping(value = "/viewTransaction/{customerId}") - public ResponseEntity> getTransactionDetails(@PathVariable Long customerId) - throws BankException { - Optional transactionData = null; - try { - transactionData = transactionService.getTransactionDetails(customerId); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (transactionData == null) - throw new BankException("Transaction details not found"); - else - return new ResponseEntity>(transactionData, HttpStatus.OK); - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/ATMDetails.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/ATMDetails.java deleted file mode 100644 index e922d99d..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/ATMDetails.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import java.math.BigDecimal; - -/** - * @author Ram - * - */ -public class ATMDetails { - - private Long bankId; - private Long atmId; - private Long accountId; - private BigDecimal amount; - - /** - * - */ - public ATMDetails() { - super(); - } - - /** - * @param bankId - * @param atmId - * @param accountId - * @param amount - */ - public ATMDetails(Long bankId, Long atmId, Long accountId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.atmId = atmId; - this.accountId = accountId; - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - - /** - * @param atmId - * the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ATMDetails [bankId=" + bankId + ", atmId=" + atmId + ", accountId=" + accountId + ", amount=" + amount - + "]"; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/AccountDetails.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/AccountDetails.java deleted file mode 100644 index db6299ed..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/AccountDetails.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import java.math.BigDecimal; - -/** - * @author Ram - * - */ -public class AccountDetails { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - - /** - * - */ - public AccountDetails() { - super(); - } - - /** - * @param bankId - * @param customerId - * @param accountId - * @param amountToBeAdded - */ - public AccountDetails(Long bankId, Long customerId, Long accountId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.customerId = customerId; - this.accountId = accountId; - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - /** - * @return the amountToBeAdded - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amountToBeAdded - * the amountToBeAdded to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountDetails [bankId=" + bankId + ", customerId=" + customerId + ", accountId=" + accountId - + ", amount=" + amount + "]"; - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperATMDenomination.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperATMDenomination.java deleted file mode 100644 index 175391be..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperATMDenomination.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.Denomination; - -/** - * @author Ram - * - */ -public class WrapperATMDenomination { - - -private Denomination denomination; - -private Integer amount; -private Long bankId; -private Long atmId; - - - /** - * @param denomination - * @param amount - * @param bankId - * @param atmId - */ - public WrapperATMDenomination(final Denomination denomination,final Integer amount,final Long bankId,final Long atmId) { - this.denomination = denomination; - this.amount = amount; - this.bankId = bankId; - this.atmId = atmId; - } - /** - * @return the bankDenomination - */ - public Denomination getBankDenomination() { - return denomination; - } - /** - * @param denomination the bankDenomination to set - */ - public void setBankDenomination(final Denomination denomination) { - this.denomination = denomination; - } - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(final Integer amount) { - this.amount = amount; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(final Long atmId) { - this.atmId = atmId; - } - /* - * java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperATMDenomination [bankDenomination=" + denomination + ", amount=" + amount + ", bankId=" - + bankId + ", atmId=" + atmId + "]"; - } - - - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperAccountDenomination.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperAccountDenomination.java deleted file mode 100644 index c6c1c92a..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperAccountDenomination.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.BankDenomination; - -/** - * @author Ram - * - */ -public class WrapperAccountDenomination { - - - private BankDenomination bankDenomination; - private Integer amount; - private Long bankId; - private Long accountId; - /** - * @param bankDenomination - * @param amount - * @param bankId - * @param accountId - */ - public WrapperAccountDenomination(BankDenomination bankDenomination, Integer amount, Long bankId, Long accountId) { - this.bankDenomination = bankDenomination; - this.amount = amount; - this.bankId = bankId; - this.accountId = accountId; - } - /** - * @return the bankDenomination - */ - public BankDenomination getBankDenomination() { - return bankDenomination; - } - /** - * @param bankDenomination the bankDenomination to set - */ - public void setBankDenomination(BankDenomination bankDenomination) { - this.bankDenomination = bankDenomination; - } - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(Integer amount) { - this.amount = amount; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperAccountDenomination [bankDenomination=" + bankDenomination + ", amount=" + amount + ", bankId=" - + bankId + ", accountId=" + accountId + "]"; - } - - - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankATM.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankATM.java deleted file mode 100644 index 135b0b5e..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankATM.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.ATM; - -/** - * @author Ram - * - */ -public class WrapperBankATM { - - ATM atm; - Long bankId; - - /** - * - */ - public WrapperBankATM() { - super(); - } - - /** - * @param atm - * @param bankId - */ - public WrapperBankATM(ATM atm, Long bankId) { - this.atm = atm; - this.bankId = bankId; - } - - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - - /** - * @param atm - * the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankATM [atm=" + atm + ", bankId=" + bankId + "]"; - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankCustomer.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankCustomer.java deleted file mode 100644 index 5c1fdf31..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankCustomer.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.Customer; - -/** - * @author Ram - * - */ -public class WrapperBankCustomer { - - Customer customer; - Long bankId; - - /** - * - */ - public WrapperBankCustomer() { - super(); - } - - /** - * @param customer - * @param bankId - */ - public WrapperBankCustomer(Customer customer, Long bankId) { - super(); - this.customer = customer; - this.bankId = bankId; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankCustomer [customer=" + customer + ", bankId=" + bankId + "]"; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankCustomerAccount.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankCustomerAccount.java deleted file mode 100644 index 78ab35bb..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankCustomerAccount.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.Account; - -/** - * @author Ram - * - */ -public class WrapperBankCustomerAccount { - - private Account account; - private Long customerId; - private Long bankId; - - /** - * - */ - public WrapperBankCustomerAccount() { - super(); - } - - /** - * @param account - * @param customerId - * @param bankId - */ - public WrapperBankCustomerAccount(Account account, Long customerId, Long bankId) { - super(); - this.account = account; - this.customerId = customerId; - this.bankId = bankId; - } - - /** - * @return the account - */ - public Account getAccount() { - return account; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankCustomerAccount [account=" + account + ", customerId=" + customerId + ", bankId=" + bankId - + "]"; - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankDenomination.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankDenomination.java deleted file mode 100644 index c8144f05..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperBankDenomination.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.BankDenomination; - -/** - * @author Sumit - * - */ -public class WrapperBankDenomination { - - BankDenomination bankDenomination; - Integer amount; - Long bankId; - - /** - * - */ - public WrapperBankDenomination() { - super(); - } - - /** - * @param bankDenomination - * @param amount - * @param bankId - */ - public WrapperBankDenomination(BankDenomination bankDenomination, Integer amount, Long bankId) { - super(); - this.bankDenomination = bankDenomination; - this.amount = amount; - this.bankId = bankId; - } - - /** - * @return the bankDenomination - */ - public BankDenomination getBankDenomination() { - return bankDenomination; - } - - /** - * @param bankDenomination - * the bankDenomination to set - */ - public void setBankDenomination(BankDenomination bankDenomination) { - this.bankDenomination = bankDenomination; - } - - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(Integer amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankDenomination [bankDenomination=" + bankDenomination + ", amount=" + amount + ", bankId=" - + bankId + "]"; - } - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperDenomination.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperDenomination.java deleted file mode 100644 index 6a59e423..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/dto/WrapperDenomination.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.Denomination; - -/** - * @author Ram - * - */ -public class WrapperDenomination { - - private Denomination denomination; - private Integer amount; - private Long bankId; - - - /** - * Default constructor - */ - public WrapperDenomination() { - super(); - } - - /** - * @param denomination - * @param amount - * @param bankId - */ - public WrapperDenomination(Denomination denomination, Integer amount, Long bankId) { - super(); - this.denomination = denomination; - this.amount = amount; - this.bankId = bankId; - } - - /** - * @return the denomination - */ - public Denomination getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(Denomination denomination) { - this.denomination = denomination; - } - - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - - /** - * @param amount the amount to set - */ - public void setAmount(Integer amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperDenomination [denomination=" + denomination + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - - - - - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/exception/BankException.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/exception/BankException.java deleted file mode 100644 index ec3a048c..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/exception/BankException.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.exception; - -/** - * @author Ram - * - */ -public class BankException extends Exception { - - public BankException(String message) { - super(message); - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/ATM.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/ATM.java deleted file mode 100644 index 2ad91cd7..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/ATM.java +++ /dev/null @@ -1,99 +0,0 @@ - -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @author Ram - *It will represents the ATM entity - */ -@Entity -@Table(name = "atm") -public class ATM { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long atmId; - // @Required - private BigDecimal money; - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - private static final Logger LOGGER = Logger.getLogger( ATM.class.getName() ); - - /** - * - */ - public ATM() { - super(); - } - - /** - * @param atmId - * @param money - * @param bank - */ - public ATM(BigDecimal money, Bank bank) { - this.money = money; - this.bank = bank; - LOGGER.info("Inside the ATM Entity"); - - } - - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - - /** - * @param atmId - * the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - - /** - * @return the money - */ - public BigDecimal getMoney() { - return money; - } - - /** - * @param money - * the money to set - */ - public void setMoney(BigDecimal money) { - this.money = money; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "ATM [atmId=" + atmId + ", money=" + money + ", bank=" + bank + "]"; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Account.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Account.java deleted file mode 100644 index 6ab70cfb..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Account.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @author Ram It will represents the Account Entity. - */ -@Entity -@Table(name = "account") -public class Account { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long accountId; - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - private BigDecimal amount; - - /* - * @Entity This is logger used instead of Sysout. - */ - private static final Logger LOGGER = Logger.getLogger(Account.class.getName()); - - /** - * - */ - public Account() { - super(); - } - - /** - * @param accountId - * acted as primary key of the table account - * @param bank - * @param customer - * @param amount - */ - public Account(final Bank bank, final Customer customer, final BigDecimal amount) { - this.bank = bank; - this.customer = customer; - this.amount = amount; - LOGGER.info("Inside the account Entity"); - } - - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Account [accountId=" + accountId + ", bank=" + bank + ", customer=" + customer + ", amount=" + amount - + "]"; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Bank.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Bank.java deleted file mode 100644 index 4f9760a8..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author Ram - *It will represents the BANK entity - */ -@Table(name = "bank") -@Entity -public class Bank { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "bankId") - private Long bankId; - private BigDecimal amount; - - private static final Logger LOGGER = Logger.getLogger( Bank.class.getName() ); - - - /** - * - */ - public Bank() { - super(); - } - - /** - * @param bankId - * @param amount - */ - public Bank(BigDecimal amount) { - this.amount = amount; - LOGGER.info("Inside the BAnk Entity"); - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } -} \ No newline at end of file diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/BankDenomination.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/BankDenomination.java deleted file mode 100644 index 01ec788f..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/BankDenomination.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToOne; - -/** - * @author Sumit - * - */ - -@Entity -public class BankDenomination { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long denominationId; - @OneToOne(targetEntity = Bank.class) - private Bank bank; - private Integer noOfDenomination; - private Integer denomination; - - - private static final Logger LOGGER = Logger.getLogger( ATM.class.getName() ); - /** - * - */ - public BankDenomination() { - - super(); - LOGGER.info("Inside the BankDenomination Entity"); - } - - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BankDenominationNew [denominationId=" + denominationId + ", bank=" + bank + ", noOfDenomination=" - + noOfDenomination + ", denomination=" + denomination + "]"; - } - - - - /** - * @return the denominationId - */ - public Long getDenominationId() { - return denominationId; - } - - /** - * @param denominationId - * the denominationId to set - */ - public void setDenominationId(Long denominationId) { - this.denominationId = denominationId; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - - /** - * @return the noOfDenomination - */ - public Integer getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(Integer noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - - - /** - * @return the denomination - */ - public Integer getDenomination() { - return denomination; - } - - - - /** - * @param denomination the denomination to set - */ - public void setDenomination(Integer denomination) { - this.denomination = denomination; - } - - - - /** - * @param denominationId - * @param bank - * @param noOfDenomination - * @param denomination - */ - public BankDenomination(Long denominationId, Bank bank, Integer noOfDenomination, Integer denomination) { - super(); - this.denominationId = denominationId; - this.bank = bank; - this.noOfDenomination = noOfDenomination; - this.denomination = denomination; - } - - - -} \ No newline at end of file diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Customer.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Customer.java deleted file mode 100644 index 2aefddb4..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Customer.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.util.logging.Logger; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.springframework.lang.NonNull; - -/** - * @author Ram - *It will represents the CUstomer Entity. - */ - -@Entity -@Table(name = "customer") -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long customerId; - @Column(nullable = false, length = 100) - private String customerName; - @NonNull - private Integer customerPin; - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - private static final Logger LOGGER = Logger.getLogger( Customer.class.getName() ); - - - // @JoinTable(name = "bank_customer", joinColumns = @JoinColumn(name = - // "customerId"), inverseJoinColumns = @JoinColumn(name = "bankId")) - - /** - * - */ - public Customer() { - super(); - } - - /** - * @param customerId - * @param customerName - * @param customerPin - * @param bank - */ - public Customer( String customerName, Integer customerPin, Bank bank) { - this.customerName = customerName; - this.customerPin = customerPin; - this.bank = bank; - LOGGER.info("Inside the Customer Entity"); - - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerPin - */ - public Integer getCustomerPin() { - return customerPin; - } - - /** - * @param customerPin - * the customerPin to set - */ - public void setCustomerPin(Integer customerPin) { - this.customerPin = customerPin; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerPin=" + customerPin - + ", bank=" + bank + "]"; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Denomination.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Denomination.java deleted file mode 100644 index a404f01b..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Denomination.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToOne; - -/** - * @author Ram - * - */ - -@Entity -public class Denomination { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long denominationId; - @OneToOne(targetEntity = Bank.class) - private Bank bank; - private Integer noOfDenomination; - private Integer denomination; - - - private static final Logger LOGGER = Logger.getLogger( Denomination.class.getName() ); - /** - * - */ - public Denomination() { - - super(); - LOGGER.info("Inside the BankDenomination Entity"); - } - - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BankDenominationNew [denominationId=" + denominationId + ", bank=" + bank + ", noOfDenomination=" - + noOfDenomination + ", denomination=" + denomination + "]"; - } - - - - /** - * @return the denominationId - */ - public Long getDenominationId() { - return denominationId; - } - - /** - * @param denominationId - * the denominationId to set - */ - public void setDenominationId(Long denominationId) { - this.denominationId = denominationId; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - - /** - * @return the noOfDenomination - */ - public Integer getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(Integer noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - - - /** - * @return the denomination - */ - public Integer getDenomination() { - return denomination; - } - - - - /** - * @param denomination the denomination to set - */ - public void setDenomination(Integer denomination) { - this.denomination = denomination; - } - - - - /** - * @param denominationId - * @param bank - * @param noOfDenomination - * @param denomination - */ - public Denomination(Long denominationId, Bank bank, Integer noOfDenomination, Integer denomination) { - super(); - this.denominationId = denominationId; - this.bank = bank; - this.noOfDenomination = noOfDenomination; - this.denomination = denomination; - } - - - -} \ No newline at end of file diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Transaction.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Transaction.java deleted file mode 100644 index d5e58f91..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/model/Transaction.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @author Ram - * - */ - -@Entity -@Table(name = "transaction") -public class Transaction { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long transactionId; - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - @ManyToOne(targetEntity = Account.class) - private Account account; - private BigDecimal amount; - private String transactionType; - - - private static final Logger LOGGER = Logger.getLogger( Bank.class.getName() ); - - - /** - * - */ - public Transaction() { - super(); - } - - /** - * @param transactionId - * @param customer - * @param account - * @param amount - * @param transactionType - */ - public Transaction(Customer customer, Account account, BigDecimal amount, String transactionType) { - this.customer = customer; - this.account = account; - this.amount = amount; - this.transactionType = transactionType; - LOGGER.info("Inside the Transaction Entity"); - - } - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @return the account - */ - public Account getAccount() { - return account; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(String transactionType) { - this.transactionType = transactionType; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Transaction [transactionId=" + transactionId + ", customer=" + customer + ", account=" + account - + ", amount=" + amount + ", transactionType=" + transactionType + "]"; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/ATMDAO.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/ATMDAO.java deleted file mode 100644 index 276159f6..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/ATMDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.ATM; - -/** - * @author Ram - * - */ -public interface ATMDAO extends JpaRepository { - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/AccountDAO.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/AccountDAO.java deleted file mode 100644 index 91fe7420..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/AccountDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Account; - -/** - * @author Ram - * - */ -public interface AccountDAO extends JpaRepository{ - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/BankDAO.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/BankDAO.java deleted file mode 100644 index dd78d4ad..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/BankDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Bank; - -/** - * @author Ram - * - */ -public interface BankDAO extends JpaRepository { - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/BankDenominationDAO.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/BankDenominationDAO.java deleted file mode 100644 index 7def6b06..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/BankDenominationDAO.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Denomination; - -/** - * @author Ram - * - */ - -public interface BankDenominationDAO extends JpaRepository { - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/CustomerDAO.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/CustomerDAO.java deleted file mode 100644 index 922c7e65..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Customer; - -/** - * @author Ram - * - */ -public interface CustomerDAO extends JpaRepository { - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/TransactionDAO.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/TransactionDAO.java deleted file mode 100644 index ec26c593..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/repository/TransactionDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Transaction; - -/** - * @author Ram - * - */ -public interface TransactionDAO extends JpaRepository { - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/ATMService.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/ATMService.java deleted file mode 100644 index 3599a69b..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/ATMService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; - -import com.springboot.bank.dto.ATMDetails; -import com.springboot.bank.dto.WrapperBankATM; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.ATM; - -/** - * @author Ram - * - */ -public interface ATMService { - - ATM createATM(WrapperBankATM wrapperBankATM) throws BankException; - - ATM addMoneyFromBank(Long atmId, Long bankId, BigDecimal moneyToBeAddedToATM) throws BankException; - - ATM withdrawMoney(ATMDetails atmDetails) throws BankException; - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/ATMServiceImpl.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/ATMServiceImpl.java deleted file mode 100644 index e496d258..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.ATMDetails; -import com.springboot.bank.dto.WrapperBankATM; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.ATM; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Bank; -import com.springboot.bank.repository.ATMDAO; -import com.springboot.bank.repository.AccountDAO; -import com.springboot.bank.repository.BankDAO; - -/** - * @author Ram - * - */ -@Service("ATMService") -public class ATMServiceImpl implements ATMService { - - @Autowired - ATMDAO atmDao; - - @Autowired - BankDAO bankDao; - - @Autowired - AccountDAO accountDao; - - /* - * @see - * com.springboot.bank.service.ATMService#createATM(com.springboot.bank.model. - * ATM) - */ - @Override - public ATM createATM(WrapperBankATM wrapperBankATM) throws BankException { - ATM ATMData = wrapperBankATM.getAtm(); - Long bankId = wrapperBankATM.getBankId(); - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - if (bank == null) - throw new BankException("Id not found"); - else { - ATMData.setBank(bank); - ATMData = atmDao.save(ATMData); - } - return ATMData; - } - - @Override - public ATM addMoneyFromBank(Long atmId, Long bankId, BigDecimal moneyToBeAddedToATM) throws BankException { - - Optional atmList = atmDao.findById(atmId); - ATM atmdata = null; - ATM atm = atmList.get(); - if (atm == null) - throw new BankException("Atm with such Id doesnt exist"); - else { - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - if (bank == null) - throw new BankException("Bank with such Id doesnt exist"); - else { - BigDecimal bankMoney = bank.getAmount(); - BigDecimal finalAmount = bankMoney.subtract(moneyToBeAddedToATM); - if (finalAmount.compareTo(BigDecimal.ZERO) == 1) { - BigDecimal atmMoney = atm.getMoney().add(moneyToBeAddedToATM); - atm.setMoney(atmMoney); - bank.setAmount(finalAmount); - atmdata = atmDao.save(atm); - bankDao.save(bank); - } else - throw new BankException("Bank doesnt have enough money"); - } - return atmdata; - } - } - - @Override - public ATM withdrawMoney(ATMDetails atmDetails) throws BankException { - Long atmId = atmDetails.getAccountId(); - Long bankId = atmDetails.getBankId(); - Long accountId = atmDetails.getAccountId(); - BigDecimal amountToBeWithdrawn = atmDetails.getAmount(); - Account account = null; - Bank bank = null; - ATM atm = null; - if (accountId == 0 || bankId == 0 || atmId == 0) { - throw new BankException("Id cannot be zero"); - } - else { - Optional accountList = accountDao.findById(accountId); - account = accountList.get(); - BigDecimal newAccountBalance; - if (account == null) { - throw new BankException("No such account exists"); - } else { - newAccountBalance = amountToBeWithdrawn.subtract(account.getAmount()); - if (newAccountBalance.compareTo(BigDecimal.ZERO) == 1) { - account.setAmount(newAccountBalance); - accountDao.save(account); - } else { - throw new BankException("Account Balance cannot be negative"); - } - } - Optional bankList = bankDao.findById(bankId); - bank = bankList.get(); - if (bank == null) { - throw new BankException("No such id of Bank exists"); - } else { - BigDecimal newBankBalance = amountToBeWithdrawn.subtract(bank.getAmount()); - if (newBankBalance.compareTo(BigDecimal.ZERO) == 1) { - bank.setAmount(newBankBalance); - bankDao.save(bank); - } else { - throw new BankException("Bank Balance cannot be negative"); - } - } - Optional atmList = atmDao.findById(atmId); - atm = atmList.get(); - if (atm == null) { - throw new BankException("No such id of ATM exists"); - } else { - BigDecimal newBankBalance = amountToBeWithdrawn.subtract(bank.getAmount()); - if (newBankBalance.compareTo(BigDecimal.ZERO) == 1) { - atm.setMoney(newAccountBalance); - atmDao.save(atm); - } else { - throw new BankException("ATM Balance cannot be negative"); - } - } - } - return atm; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/AccountService.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/AccountService.java deleted file mode 100644 index dba2067e..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/AccountService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.dto.AccountDetails; -import com.springboot.bank.dto.WrapperBankCustomerAccount; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; - -/** - * @author Ram - * - */ -public interface AccountService { - - Account createAccount(WrapperBankCustomerAccount wrapperBankCustomerAccount) throws BankException; - - Account depositMoney(AccountDetails accountDetails) throws BankException; - - Account withdrawMoney(AccountDetails accountDetails) throws BankException; - - Account getAccountDetails(Long accountId) throws BankException; -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/AccountServiceImpl.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/AccountServiceImpl.java deleted file mode 100644 index 8819a7fc..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,192 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.AccountDetails; -import com.springboot.bank.dto.WrapperBankCustomerAccount; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Bank; -import com.springboot.bank.model.Customer; -import com.springboot.bank.model.Transaction; -import com.springboot.bank.repository.AccountDAO; -import com.springboot.bank.repository.BankDAO; -import com.springboot.bank.repository.CustomerDAO; - -/** - * @author Ram - * - */ -@Service("accountService") -public class AccountServiceImpl implements AccountService { - - @Autowired - BankDAO bankDao; - - @Autowired - CustomerDAO customerDao; - - @Autowired - AccountDAO accountDao; - - @Autowired - TransactionService transactionService; - - /* - * @see - * com.springboot.bank.service.AccountService#createAccount(com.springboot.bank. - * wrapper.WrapperBankCustomerAccount) - */ - @Override - public Account createAccount(WrapperBankCustomerAccount wrapperBankCustomerAccount) throws BankException { - - Account account = wrapperBankCustomerAccount.getAccount(); - if (account == null) - throw new BankException("Account not found"); - else { - Long bankId = wrapperBankCustomerAccount.getBankId(); - // System.out.println(bankId); - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - // System.out.println(bank); - if (bank == null) { - throw new BankException("Bank with such Id doesnt exist"); - } else { - account.setBank(bank); - } - Long customerId = wrapperBankCustomerAccount.getCustomerId(); - Optional customerList = customerDao.findById(customerId); - Customer customer = customerList.get(); - if (customer == null) { - throw new BankException("Customer with such Id doesnt exist"); - } else { - account.setCustomer(customer); - account = accountDao.save(account); - } - } - return account; - } - - @Transactional - @Override - public Account depositMoney(AccountDetails accountDetails) throws BankException { - - Long accountId = accountDetails.getAccountId(); - Long bankId = accountDetails.getBankId(); - Long customerId = accountDetails.getCustomerId(); - BigDecimal amountToBeAdded = accountDetails.getAmount(); - Account account = null; - Bank bank = null; - Customer customer = null; - if (accountId == 0 || bankId == 0 || customerId == 0 || amountToBeAdded.compareTo(BigDecimal.ZERO) == 0) - throw new BankException("Id or amount cannot be zero"); - else { - Optional accountList = accountDao.findById(accountId); - account = accountList.get(); - BigDecimal newAccountBalance; - if (account == null) { - throw new BankException("No such account id exists"); - } else { - newAccountBalance = amountToBeAdded.add(account.getAmount()); - Optional customerList = customerDao.findById(customerId); - customer = customerList.get(); - if (customer == null) { - throw new BankException("No such customer account exists"); - } else { - Optional bankList = bankDao.findById(bankId); - bank = bankList.get(); - if (bank == null) { - throw new BankException("No such bank account exists"); - } else { - account.setAmount(newAccountBalance); - accountDao.save(account); - Transaction transaction = new Transaction(customer, account, amountToBeAdded, - "Money Deposited"); - transactionService.createTransaction(transaction); - BigDecimal newBankBalance = amountToBeAdded.add(bank.getAmount()); - bank.setAmount(newBankBalance); - bankDao.save(bank); - } - } - } - } - return account; - } - - @Transactional - @Override - public Account withdrawMoney(AccountDetails accountDetails) throws BankException { - Long accountId = accountDetails.getAccountId(); - Long bankId = accountDetails.getBankId(); - Long customerId = accountDetails.getCustomerId(); - BigDecimal amountToBeWithdrawn = accountDetails.getAmount(); - Account account = null; - Bank bank = null; - Customer customer = null; - if (accountId == 0 || bankId == 0 || customerId == 0) { - throw new BankException("Id or amount cannot be zero"); - }else { - Optional accountList = accountDao.findById(accountId); - account = accountList.get(); - BigDecimal newAccountBalance; - if (account == null) { - throw new BankException("No such account exists"); - } else { - newAccountBalance = account.getAmount().subtract(amountToBeWithdrawn); - if (newAccountBalance.compareTo(BigDecimal.ZERO) == -1) { - throw new BankException("Account Balance cannot be 0 or negative"); - } else { - Optional bankList = bankDao.findById(bankId); - bank = bankList.get(); - if (bank == null) { - throw new BankException("No such bank id exists"); - } else { - BigDecimal newBankBalance = bank.getAmount().subtract(amountToBeWithdrawn); - if (newBankBalance.compareTo(BigDecimal.ZERO) == 0 - || newBankBalance.compareTo(BigDecimal.ZERO) == -1) { - throw new BankException("Bank Balance cannot be 0 or negative"); - } else { - Optional customerList = customerDao.findById(customerId); - customer = customerList.get(); - if (customer == null) { - throw new BankException("No such customer id exists"); - } else { - Transaction transaction = new Transaction(customer, account, amountToBeWithdrawn, - "Money Withdrawn"); - transactionService.createTransaction(transaction); - account.setAmount(newAccountBalance); - accountDao.save(account); - bank.setAmount(newBankBalance); - bankDao.save(bank); - - } - } - } - } - } - } - return account; - } - - @Override - public Account getAccountDetails(Long accountId) throws BankException { - Optional accountList = accountDao.findById(accountId); - Account account = null; - account = accountList.get(); - if (account == null) - throw new BankException("Account id doesnt exist"); - else { - account = accountDao.save(account); - } - return account; - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankDenominationService.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankDenominationService.java deleted file mode 100644 index 761aed66..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankDenominationService.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.dto.WrapperDenomination; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Denomination; - -/** - * @author Ram - * - */ -public interface BankDenominationService { - - - - void addDenominationNew(Integer amount) throws BankException; - -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankDenominationServiceImpl.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index 5387ca94..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Random; -import java.util.logging.Logger; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.WrapperDenomination; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Bank; -import com.springboot.bank.model.Denomination; -import com.springboot.bank.model.Denomination; -import com.springboot.bank.repository.BankDAO; -import com.springboot.bank.repository.BankDenominationDAO; - -/** - * @author Ram - * - */ -@Service("bankDenominationService") -public class BankDenominationServiceImpl implements BankDenominationService { - - - - private static final Logger LOGGER = Logger.getLogger( Account.class.getName() ); - - - - @Autowired - private BankDenominationDAO bankDenominationDAO; - - - @Autowired - BankDAO bankDao; - - /* - * @Override public BankDenomination addDenomination(WrapperBankDenomination - * wrapperBankDenomination) throws BankException { Long bankId = - * wrapperBankDenomination.getBankId(); Integer amount = - * wrapperBankDenomination.getAmount(); BankDenomination bankDenomination = - * wrapperBankDenomination.getBankDenomination(); Bank bank = null; Integer - * noOf2000s = null; Integer noOf500s = null; Integer noOf100s = null; Integer - * temperoryCount = 0; if (amount / 2000 != 0) { noOf2000s = amount / 2000; - * amount = amount % 2000; System.out.println(noOf2000s); temperoryCount = - * temperoryCount + noOf2000s; bankDenomination.setNoOf2000s(noOf2000s); } if - * (amount != 0 & amount / 500 != 0) { noOf500s = amount / 500; amount = amount - * % 500; temperoryCount = temperoryCount + noOf500s; - * bankDenomination.setNoOf500s(noOf500s); } - * - * if (amount != 0 & amount / 100 != 0) { noOf100s = amount / 100; amount = - * amount % 100; temperoryCount = temperoryCount + noOf100s; - * bankDenomination.setNoOf100s(noOf100s); } - * - * Optional bankList = bankDao.findById(bankId); if (bankList.isPresent()) - * { bank = bankList.get(); bankDenomination.setBank(bank); - * bankDenomination.setNoOfDenomination(temperoryCount); - * bankDenominationDAO.save(bankDenomination); } else { throw new - * BankException("bank is not present"); } return bankDenomination; } - */ - - @Override - public void addDenominationNew(final Integer amount) throws BankException { - - final List list1 = new ArrayList(); - list1.add(2000); - list1.add(500); - list1.add(100); - list1.add(200); - final Random rand = new Random(); - Integer remainder = amount; - //System.out.println("list >>>>" + list1); - LOGGER.info("list >>>>" + list1); - for (int i = 0; i <= list1.size(); i++) { - final Integer randomIndex = rand.nextInt(list1.size()); - // System.out.println("randomIndex >>" + randomIndex); - final Integer randomElement = list1.get(randomIndex); - // System.out.println("randomElement >>" + randomElement); - if (randomElement.compareTo(remainder) == 0 || randomElement.compareTo(remainder) == -1) { - final Denomination bankDenominationNew = new Denomination(); - bankDenominationNew.setNoOfDenomination(remainder / randomElement); - bankDenominationNew.setDenomination(randomElement); - remainder = remainder % randomElement; - //System.out.println(bankDenominationNew); - LOGGER.info(">>>> Denomination"+bankDenominationNew); - if (remainder == 0) { - break; - } - } - list1.remove(randomIndex); - } - - } -} \ No newline at end of file diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankService.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankService.java deleted file mode 100644 index ef543af1..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankService.java +++ /dev/null @@ -1,22 +0,0 @@ - -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; - -/** - * @author Ram - * @nterface BankService - * Description : It has 2 methods declaration in it. whichever class will implements, - * will provide implemenatation for this methods. - * - */ -public interface BankService { - - Bank createBank(Bank bank) throws BankException; - - Bank getBankDetails(Long bankId) throws BankException; -} \ No newline at end of file diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankServiceImpl.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankServiceImpl.java deleted file mode 100644 index 9fafbc48..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.repository.BankDAO; - -/** - * @author Ram - * @Service("bankService") - * Description : It provide implementation for BankServices method. - * 1.It Helps to create new bank - * 2.getBankDetails - */ -@Service("bankService") -public class BankServiceImpl implements BankService { - - - //Injecting properties of BankDAO - @Autowired - private BankDAO bankDao; - - /* - * BankService#createBank - * Desc: this method helps to create a new bank with default amount 0. - * - */ - @Override - public Bank createBank(Bank bank) throws BankException { - Bank bankData = null; - final BigDecimal amount = bank.getAmount(); - /*if (amount.compareTo(BigDecimal.ZERO) == -1) - throw new BankException("amount cannot be zero or less than zero"); - else {*/ - bankData = bankDao.save(bank); - return bankData; - } - - /* - *BankService#getBankDetails - *Desc : It will helps to get information about details of bank passing a Id of it. - *Exception : it will throw exception if Id not found. - */ - @Override - public Bank getBankDetails(Long bankId) throws BankException { - Optional bankList = bankDao.findById(bankId); - if (bankList.isPresent()) { - Bank bank = bankList.get(); - return bank; - } else - throw new BankException("Bank details not found"); - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/CustomerService.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/CustomerService.java deleted file mode 100644 index a857db87..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/CustomerService.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Customer; - -/** - * @author Ram - *@entity CustomerService - *Desc: It has 2 methods declared which helps to create customer and get customer details. - */ -public interface CustomerService { - - Customer createCustomer(WrapperBankCustomer wrapperBankCustomer) throws BankException; - - Customer getCustomerDetails(Long customerId) throws BankException; -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/CustomerServiceImpl.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/CustomerServiceImpl.java deleted file mode 100644 index dfc9283e..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.model.Customer; -import com.springboot.bank.repository.BankDAO; -import com.springboot.bank.repository.CustomerDAO; - -/** - * @author Ram - *@Service("customerService") - *Desc: This class provide implementation for creating customer and - */ -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - - - //injecting properties of CustomerDAO - @Autowired - CustomerDAO customerDao; - //injecting properties of BankDAO - @Autowired - BankDAO bankDao; - - /* - * CustomerService#createCustomer - * DESC: it will create a new customer having bankId associated with it. - * It calls save method to save he state of customer object into database. - */ - - - @Override - public Customer createCustomer(WrapperBankCustomer wrapperBankCustomer) throws BankException { - Customer customer = null; - Customer customerData = null; - customer = wrapperBankCustomer.getCustomer(); - // System.out.println(customer); - Long bankId = wrapperBankCustomer.getBankId(); - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - customer.setBank(bank); - customerData = customerDao.save(customer); - // System.out.println(customerData); - return customerData; - } - /* - * CustomerService#createCustomer - * DESC: it will show customer details having customerId associated with it. - * It calls findById method to find that entity by id and return the object to responce. - */ - @Override - public Customer getCustomerDetails(Long customerId) throws BankException { - Optional customerList = customerDao.findById(customerId); - if (customerList.isPresent()) { - Customer customer = customerList.get(); - return customer; - } else - throw new BankException("Bank details not found"); - } -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/TransactionService.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/TransactionService.java deleted file mode 100644 index 0d4cdb20..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/TransactionService.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.Optional; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Transaction; - -/** - * @author Ram - *this interface has 2 methods which create a statements for an Customer - *and generate a report for statements - */ -public interface TransactionService { - - String createTransaction(Transaction transaction) throws BankException; - - Optional getTransactionDetails( Long customerId) throws BankException; -} diff --git a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/TransactionServiceImpl.java b/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 5575548d..00000000 --- a/16BankAppSpringBootJPA/src/main/java/com/springboot/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Customer; -import com.springboot.bank.model.Transaction; -import com.springboot.bank.repository.CustomerDAO; -import com.springboot.bank.repository.TransactionDAO; - -/** - * @author Ram - * - */ -@Service("transactionService") -public class TransactionServiceImpl implements TransactionService { - - //Injecting properties of TransactionDAO - @Autowired - private TransactionDAO transactionDao; - //Injecting properties of CustomerDAO - @Autowired - private CustomerDAO customerdao; - - /* - * - *TransactionService#createTransaction - * DESC: it will create a statement for a account of a customer - * which contain typeOfPayment,AMount etc. - * Exception: It throws exception if user enter acoount id or customr ID 0. - */ - @Override - public String createTransaction(Transaction transaction) throws BankException { - - Customer customer = transaction.getCustomer(); - Long customerId = customer.getCustomerId(); - Account account = transaction.getAccount(); - Long accountId = account.getAccountId(); - - if (accountId == 0) { - throw new BankException("accountId cannot be 0"); - } else if (customerId == 0) { - throw new BankException("customerId cannot be 0"); - } else { - transactionDao.save(transaction); - return "Transaction details added successfully"; - } - } - - - /* - * - *TransactionService#getTransactionDetails - * DESC: it will get details statement for a account of a customer - * which contain typeOfPayment,AMount etc. - */ - - @Override - public Optional getTransactionDetails(Long customerId) throws BankException { - - if (customerId == 0) { - throw new BankException("customerId cannot be 0"); - } else { - Optional transactionList = transactionDao.findById(customerId); - return transactionList; - } - } -} diff --git a/16BankAppSpringBootJPA/src/main/resources/application.properties b/16BankAppSpringBootJPA/src/main/resources/application.properties deleted file mode 100644 index 91dd5aff..00000000 --- a/16BankAppSpringBootJPA/src/main/resources/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.datasource.url= jdbc:mysql://localhost:3306/mybank -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -logging.level.root=info - diff --git a/16BankAppSpringBootJPA/src/test/java/com/springboot/bank/BankApplicationTests.java b/16BankAppSpringBootJPA/src/test/java/com/springboot/bank/BankApplicationTests.java deleted file mode 100644 index 3bccdd00..00000000 --- a/16BankAppSpringBootJPA/src/test/java/com/springboot/bank/BankApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.bank; - -import static org.mockito.Mockito.mock; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import com.springboot.bank.service.AccountService; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class BankApplicationTests { - - AccountService accountServiceMock = mock(AccountService.class); - - -} diff --git a/16BankAppSpringBootJPA/src/test/java/com/springboot/bank/CustomerServiceTest.java b/16BankAppSpringBootJPA/src/test/java/com/springboot/bank/CustomerServiceTest.java deleted file mode 100644 index 14b83d8d..00000000 --- a/16BankAppSpringBootJPA/src/test/java/com/springboot/bank/CustomerServiceTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package com.springboot.bank; - -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.model.Customer; -import com.springboot.bank.repository.CustomerDAO; -import com.springboot.bank.service.CustomerService; - -/** - * @author ram - * - */ -public class CustomerServiceTest { - - @Mock - private CustomerDAO daoMock; - - @InjectMocks - private CustomerService service; - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - @Test - public void testAddCustomer_returnsNewCustomer() { - - - } - -} diff --git a/16BankAppSpringBootJPA/target/classes/META-INF/MANIFEST.MF b/16BankAppSpringBootJPA/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d7c94a95..00000000 --- a/16BankAppSpringBootJPA/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Implementation-Title: MyBankDemo -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: trainee -Implementation-Vendor-Id: com.springboot -Build-Jdk: 1.8.0_171 -Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo - ot-starter-parent/bank -Created-By: Maven Integration for Eclipse - diff --git a/16BankAppSpringBootJPA/target/classes/META-INF/maven/com.springboot/bank/pom.properties b/16BankAppSpringBootJPA/target/classes/META-INF/maven/com.springboot/bank/pom.properties deleted file mode 100644 index 153572fd..00000000 --- a/16BankAppSpringBootJPA/target/classes/META-INF/maven/com.springboot/bank/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Tue May 22 10:18:26 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.springboot -m2e.projectName=bank -m2e.projectLocation=D\:\\training\\16BankAppSpringBootJPA -artifactId=bank diff --git a/16BankAppSpringBootJPA/target/classes/META-INF/maven/com.springboot/bank/pom.xml b/16BankAppSpringBootJPA/target/classes/META-INF/maven/com.springboot/bank/pom.xml deleted file mode 100644 index d09d388b..00000000 --- a/16BankAppSpringBootJPA/target/classes/META-INF/maven/com.springboot/bank/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - MyBankDemo - project for Bank Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - log4j - log4j - 1.2.17 - - - - org.mockito - mockito-all - 1.9.5 - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/16BankAppSpringBootJPA/target/classes/application.properties b/16BankAppSpringBootJPA/target/classes/application.properties deleted file mode 100644 index 91dd5aff..00000000 --- a/16BankAppSpringBootJPA/target/classes/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.datasource.url= jdbc:mysql://localhost:3306/mybank -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -logging.level.root=info - diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/BankApplication.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/BankApplication.class deleted file mode 100644 index ab7e0187..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/BankApplication.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/ATMController.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/ATMController.class deleted file mode 100644 index 1eaa0cfe..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/ATMController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/AccountController.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/AccountController.class deleted file mode 100644 index 3d0938c4..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/AccountController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/BankController.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/BankController.class deleted file mode 100644 index 9594887b..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/BankController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/BankDenominationController.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/BankDenominationController.class deleted file mode 100644 index 406a14d9..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/BankDenominationController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/CustomerController.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/CustomerController.class deleted file mode 100644 index 6f437e5c..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/CustomerController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/TransactionController.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/TransactionController.class deleted file mode 100644 index fc5f5c88..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/controller/TransactionController.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/ATMDetails.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/ATMDetails.class deleted file mode 100644 index a4b60d61..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/ATMDetails.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/AccountDetails.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/AccountDetails.class deleted file mode 100644 index 0126af32..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/AccountDetails.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperATMDenomination.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperATMDenomination.class deleted file mode 100644 index d166ddb0..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperATMDenomination.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperAccountDenomination.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperAccountDenomination.class deleted file mode 100644 index b764f297..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperAccountDenomination.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankATM.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankATM.class deleted file mode 100644 index 17d497fd..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankATM.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankCustomer.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankCustomer.class deleted file mode 100644 index d5e2f9ad..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankCustomer.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankCustomerAccount.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankCustomerAccount.class deleted file mode 100644 index 30646c54..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankCustomerAccount.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankDenomination.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankDenomination.class deleted file mode 100644 index dcabeb15..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperBankDenomination.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperDenomination.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperDenomination.class deleted file mode 100644 index 16292fae..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/dto/WrapperDenomination.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/exception/BankException.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/exception/BankException.class deleted file mode 100644 index bc0fb220..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/exception/BankException.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/ATM.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/ATM.class deleted file mode 100644 index 4d15c9d3..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/ATM.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Account.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Account.class deleted file mode 100644 index 07c168c0..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Account.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Bank.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Bank.class deleted file mode 100644 index 398e6d87..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Bank.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/BankDenomination.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/BankDenomination.class deleted file mode 100644 index f1a46277..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/BankDenomination.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Customer.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Customer.class deleted file mode 100644 index 5dfefaa9..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Customer.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Denomination.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Denomination.class deleted file mode 100644 index a3763c60..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Denomination.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Transaction.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Transaction.class deleted file mode 100644 index fd16e723..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/model/Transaction.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/ATMDAO.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/ATMDAO.class deleted file mode 100644 index 6326d873..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/ATMDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/AccountDAO.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/AccountDAO.class deleted file mode 100644 index 1f516ff9..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/AccountDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/BankDAO.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/BankDAO.class deleted file mode 100644 index de6da26a..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/BankDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/BankDenominationDAO.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/BankDenominationDAO.class deleted file mode 100644 index 6d542662..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/BankDenominationDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/CustomerDAO.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/CustomerDAO.class deleted file mode 100644 index 9d4b7691..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/CustomerDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/TransactionDAO.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/TransactionDAO.class deleted file mode 100644 index 0162a54e..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/repository/TransactionDAO.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/ATMService.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/ATMService.class deleted file mode 100644 index b87803fe..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/ATMService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/ATMServiceImpl.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/ATMServiceImpl.class deleted file mode 100644 index 8033e254..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/ATMServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/AccountService.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/AccountService.class deleted file mode 100644 index 9a9f3041..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/AccountService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/AccountServiceImpl.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/AccountServiceImpl.class deleted file mode 100644 index 1a4ce626..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/AccountServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankDenominationService.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankDenominationService.class deleted file mode 100644 index 3342e6f1..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankDenominationService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankDenominationServiceImpl.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankDenominationServiceImpl.class deleted file mode 100644 index c612e424..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankDenominationServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankService.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankService.class deleted file mode 100644 index 90716f05..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankServiceImpl.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankServiceImpl.class deleted file mode 100644 index 723b10ed..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/BankServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/CustomerService.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/CustomerService.class deleted file mode 100644 index a5be7366..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/CustomerService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/CustomerServiceImpl.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/CustomerServiceImpl.class deleted file mode 100644 index 396693fb..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/CustomerServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/TransactionService.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/TransactionService.class deleted file mode 100644 index 51667e7e..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/TransactionService.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/TransactionServiceImpl.class b/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/TransactionServiceImpl.class deleted file mode 100644 index f62346d2..00000000 Binary files a/16BankAppSpringBootJPA/target/classes/com/springboot/bank/service/TransactionServiceImpl.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/test-classes/com/springboot/bank/BankApplicationTests.class b/16BankAppSpringBootJPA/target/test-classes/com/springboot/bank/BankApplicationTests.class deleted file mode 100644 index faca8cfd..00000000 Binary files a/16BankAppSpringBootJPA/target/test-classes/com/springboot/bank/BankApplicationTests.class and /dev/null differ diff --git a/16BankAppSpringBootJPA/target/test-classes/com/springboot/bank/CustomerServiceTest.class b/16BankAppSpringBootJPA/target/test-classes/com/springboot/bank/CustomerServiceTest.class deleted file mode 100644 index 83775688..00000000 Binary files a/16BankAppSpringBootJPA/target/test-classes/com/springboot/bank/CustomerServiceTest.class and /dev/null differ diff --git a/17BankInCapg/.eclipse-pmd b/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/17BankInCapg/.gitignore b/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/17BankInCapg/mvnw b/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/17BankInCapg/mvnw.cmd b/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/17BankInCapg/pom.xml b/17BankInCapg/pom.xml deleted file mode 100644 index 91fcd516..00000000 --- a/17BankInCapg/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BANKAPPLICATION - 0.0.1-SNAPSHOT - jar - - transactionInBank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 5.1.38 - runtime - - - com.h2database - h2 - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/TransactionInBankApplication.java b/17BankInCapg/src/main/java/com/bank/TransactionInBankApplication.java deleted file mode 100644 index adfb82f0..00000000 --- a/17BankInCapg/src/main/java/com/bank/TransactionInBankApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class TransactionInBankApplication { - - public static void main(String[] args) { - SpringApplication.run(TransactionInBankApplication.class, args); - } -} diff --git a/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index 5d97e9fb..00000000 --- a/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/ATM.java b/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 40851219..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "atm_id") - private Long ATMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + ATMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - ATMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/Account.java b/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 35799591..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index 50e52e5f..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.bank.model; - -import java.sql.Timestamp; - -public class AuditLog { - - private String eventName; - private String eventType; - private Timestamp eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Timestamp getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Timestamp eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Timestamp eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/Bank.java b/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index d52ebb26..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.IDENTITY /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/Customer.java b/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index 8ca484b5..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.bank.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.IDENTITY/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index c958e83c..00000000 --- a/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - @SequenceGenerator(name = "transaction_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "transaction_seq") - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c08f97c5..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATMDenomination; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index bb53cc1c..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index c5754c5c..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 15a792ac..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index e603c132..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneByCustomerName(String CustomerName); -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 5711e5c3..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index ad5053dc..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - -} diff --git a/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index edeef456..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - // TODO Auto-generated method stub - final Optional atm = atmRepo.findById(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findById(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index b3dbada0..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findById(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findById(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findById(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index 4839f4fa..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - Optional deno=atmdenoRepository.findById(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findById(atmId).get(); - BankDenomination bank=bankDeno.findById(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index 1c583f50..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.service; - -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - //generate audit log - public AuditLog generateAudit(final AuditLog audit) - { - final RestTemplate restTemplate=new RestTemplate(); - final String uri="http://localhost:8082/audit"; - System.out.println("audit obnject " + audit); - final AuditLog audii=restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - } -} - \ No newline at end of file diff --git a/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index 1d2acb94..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - Optional deno = denominationRepo.findById(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findById(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index bb1f1c50..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // TODO Auto-generated method stub - final Optional bank = bankRepository.findById(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index 7f516c9f..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.bank.service; - -import java.sql.Timestamp; -import java.time.LocalDateTime; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService, Cloneable { - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - @Autowired - AuditServiceImpl auditService; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findById(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - // TODO Auto-generated method stub - final Customer customer = customerRepository.findById(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Timestamp time = Timestamp.valueOf(LocalDateTime.now()); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - AuditLog ob = auditService.generateAudit(audit); - return cust; - } else { - LOGGER.info("No customer is updated as id not exist"); - throw new ManagedException("no customer is updated"); - } - - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index 8a4a66f1..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - if(!refRepo.findById(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/17BankInCapg/src/main/resources/application.properties b/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index 6ebbc95c..00000000 --- a/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true \ No newline at end of file diff --git a/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index 15bba781..00000000 --- a/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -} \ No newline at end of file diff --git a/1Day1 Programs/ContainsDuplicateProgram3.java b/1Day1 Programs/ContainsDuplicateProgram3.java deleted file mode 100644 index 46e83893..00000000 --- a/1Day1 Programs/ContainsDuplicateProgram3.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.training.java; - -/************************************************************************************ - * Program Name: Contains Duplicate - * Description : In a word if there is 2 or more than 2 occurance of letter then output - * must be true or else false. - * Programmer Name: Ram Dafale - * DateOfRelease: 16-April-2018 - ***********************************************************************************/ - -public class ContainsDuplicate { - - public static void main(String[] args) { - String s = "abcdefga"; - System.out.println(s + " " + check(s)); //Calling ther method - s = "abcdefgh"; - System.out.println(s + " " + check(s)); //Calling ther method - s = "abcdefdh"; - System.out.println(s + " " + check(s)); //Calling ther metho - } - - - - /************************************************************************************ - *Method Name: check - *Description: it compare character by character in a given string and if occurance of - * letter is found then return boolean true else false. - ***********************************************************************************/ - - public static boolean check(String s) { - for (int i = 0; i < (s.length() - 1); i++) { - for (int j = i + 1; j < s.length(); j++) { - if (s.charAt(i) == s.charAt(j)) { - return true; // It means - } - } - } - return false; - } - - - } -/********** -Output: - abcdefga true - abcdefgh false - abcdefdh true -**********/ - - diff --git a/1Day1 Programs/FileIOProgram4.java b/1Day1 Programs/FileIOProgram4.java deleted file mode 100644 index 635b3418..00000000 --- a/1Day1 Programs/FileIOProgram4.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.training.java; - -import java.io.File; - -//*********************************************************************** -// Program name : FIleIO -// Program Description : Reading a file from local disk and making changes in file. -// reflect those changes in new file. -//*********************************************************************** - -// importing required library file - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FilterOutputStream; -import java.io.IOException; - -public class FileIO { - - public static void main(String[] args) { - - - - /********************************************************************************** - * Description :It uses class File to create a new file and uses a FileInputStream - * to read a byte from hello file till end of file and print the content - * into console - * ********************************************************************************/ - - File file = new File("./hello.txt"); - FileInputStream fis = null; - - try { - fis = new FileInputStream(file); - - - int content; - while ((content = fis.read()) != -1) { - // convert to char and display it - System.out.print((char) content); - } - - - - - /********************************************************************************** - * Description :It uses class File to create a new file and uses a FileOutputStream - * to write a content. - * - * ********************************************************************************/ - - - File data = new File("./hello.txt"); - FileOutputStream file2 = new FileOutputStream(data); - FilterOutputStream filter = new FilterOutputStream(file2); - String s="Welcome to java."; - byte b[]=s.getBytes(); - filter.write(b); - filter.flush(); - filter.close(); - file2.close(); - System.out.println("Success..."); - - - - - } catch (IOException e) { - e.printStackTrace(); // It tells Specified reason of exception. - - } finally { - try { - if (fis != null) - fis.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - } -} \ No newline at end of file diff --git a/1Day1 Programs/HelloWorld.java b/1Day1 Programs/HelloWorld.java deleted file mode 100644 index 7eedcaea..00000000 --- a/1Day1 Programs/HelloWorld.java +++ /dev/null @@ -1,10 +0,0 @@ -//package com.training.java; -// -//public class HelloWorld { -// -// public static void main(String[] args) { -// // this code is printing Hello world -//System.out.println("Hello World"); -// } -// -//} diff --git a/1Day1 Programs/PalindromeNumberAndSortProgram5.java b/1Day1 Programs/PalindromeNumberAndSortProgram5.java deleted file mode 100644 index 773665f2..00000000 --- a/1Day1 Programs/PalindromeNumberAndSortProgram5.java +++ /dev/null @@ -1,52 +0,0 @@ -package mypackage; - -import java.util.ArrayList; - - -import java.util.Iterator; -import java.util.List; -import java.util.Scanner; - -public class PalindromeSort { - public static void main(String[] args) { - - System.out.println("enter string"); - - String[] array = new String[5]; - Scanner sc = new Scanner(System.in); - for (int i = 0; i < array.length; i++) { - array[i] = sc.nextLine(); - - } - - for (String string : array) { - StringBuilder input = new StringBuilder(); - input.append(string); - StringBuilder input1 = input.reverse(); - - if (string.equals(input1.toString())) { - List list = new ArrayList(); - list.add(string); - System.out.println(list); - Iterator iterator = list.iterator(); - while (iterator.hasNext()) { - - String[] newarray = list.toArray(new String[0]); - for (int i = 0; i > newarray.length; i++) { - int count1 = newarray[i].length(); - int count2 = newarray[i + 1].length(); - if (count1 > count2) { - System.out.println(newarray[i]); - } else { - System.out.println(newarray[i + 1]); - } - } - sc.close(); - - } - } - - } - - } -} diff --git a/1Day1 Programs/PalindromeNumberProgram1.java b/1Day1 Programs/PalindromeNumberProgram1.java deleted file mode 100644 index aa50186f..00000000 --- a/1Day1 Programs/PalindromeNumberProgram1.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.training.java; -/********************************************************************************* - * Program name : Check if integer is palindrome or not. - * Program Description : It check if given number is read same from left and right. - * eg. 121, 131; - * Programmer Name: Ram Dafale - * DateOfRelease: 16-April-2018 - *********************************************************************************/ - -//Library to take input from user in console -import java.util.Scanner; - - -public class PalindromeNumber { - - - /************************************************************************************ - *Method Name: main - *Description: It takes input from user. then it breaks the number by getting remainder - * then it adds that remainder to sum varibale. and then divide the number. - * this process repeats till we get same number as user specified. - ************************************************************************************/ - public static void main(String[] args) { - - int num, temp, sum = 0,x; - // sum varibale to - // try block to monitor exception and to avoid the wrong input from user - try - { - // take input from user and store in a variable - Scanner inputNumber = new Scanner(System.in); - System.out.print("Enter any number:"); - num = inputNumber.nextInt(); - // temporary variable to store user input - temp = num; - // loop for checking the number greater than 0 - while(num > 0) - { - - x = num % 10; - sum = sum * 10 + x; - num = num / 10; - } - // comparing given integer with calculated integer - // if sum and temp are equal then given number is palindrome - if(sum == temp) - { - System.out.println("Given number "+temp+" is Palindrome"); - } - else - { - System.out.println("Given number "+temp+" is Not Palindrome"); - } - } - // catch block to catch exception if any and show appropriate response to user - catch(Exception e) - { - System.out.print("Enter only Number"); - - } - - - } -} - -/******************************************************************** -output: -Enter any number:131 -Given number 131 is Palindrome - -**********************************************************************/ - - diff --git a/1Day1 Programs/ReverseStringProgram2.java b/1Day1 Programs/ReverseStringProgram2.java deleted file mode 100644 index 7da9795f..00000000 --- a/1Day1 Programs/ReverseStringProgram2.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.training.java; - -/************************************************************************************ - * Program Name: Reverse String - * Description : Check if more than - * must be true or else false. - * Programmer Name: Ram Dafale - * DateOfRelease: 16-April-2018 - ***********************************************************************************/ - - - - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.Scanner; - -public class ReverseString { - - public static void main(String[] args) throws IOException { - - BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); - String input = br.readLine(); - String[] words = input.split(" "); // logic uses space as a delimter to separate words. - String reverse = ""; - for (int i = 0; i < words.length; i++) - { - for (int j = words[i].length() - 1; j >= 0; j--) - { - reverse += words[i].charAt(j); - } - System.out.print(reverse + " "); - reverse = ""; - } - } - } - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/2Day2apr17/LambdaExpressionDay2.java b/2Day2apr17/LambdaExpressionDay2.java deleted file mode 100644 index 6086e8fb..00000000 --- a/2Day2apr17/LambdaExpressionDay2.java +++ /dev/null @@ -1,118 +0,0 @@ - -/******************************************************************************************************************* - * Program Name: Lambda Expression - * Program Description : Write a lambda expression for finding a palindrome of following - * 1->IsOdd - * 2->IsPrime - * 3->IsPalindrome - * - *Programmer Name: Ram Dafale - *Release Date: 17-April-2018 - ********************************************************************************************************************/ - -package com.tarining.apr17; - -/******************************************************************************************************************* - * Class Name: LambdaExp Program Description : This class include the all - * Functional interface required. : Declaration of all Functional interfaces. - * - * Programmer Name: Ram Dafale Release Date: 17-April-2018 - ********************************************************************************************************************/ - -public class LambdaExp { - - // Functional Interface - interface IsOdd { - public boolean isOdd(int number); - } - - // Functional Interface - interface IsPrime { - public boolean isPrime(int number); - } - - // Functional Interface - interface isPalindrome { - public boolean isPalindrome(int number, int flag); - } - - /******************************************************************************************************************* - * Method Name: LambdaExp Program Description : Main method is consists of 3 - * different logic for 3 activities of the program. 1. IsOdd method take 1 - * parameter and check weather it is odd or not. 2. IsPrime method take 1 - * parameter and check weather it is prime or not. 3. isPalindrome method take 1 - * parameter and check weather it is palindrome or not. - ********************************************************************************************************************/ - - public static void main(String[] args) { - // Taking input - int input = 121; - - // lambda expression to check if a number is even/odd. - - /******************************************************************************************************************* - * Method Name: IsOdd() Program Description : 1. IsOdd method take 1 parameter - * and check weather it is odd or not. - ********************************************************************************************************************/ - IsOdd check1 = (number) -> { - if (input % 2 == 0) - return false; - else - return true; - }; - System.out.println("No is odd : " + check1.isOdd(input)); - - /******************************************************************************************************************* - * Method Name: IsPrime() Program Description : 2. IsPrime() method take 1 - * parameter and check weather it is prime or not. - ********************************************************************************************************************/ - - IsPrime prime1 = (number) -> { - for (int i = 2; i <= input / 2; i++) { - if (input % i == 0) - return false; - } - return true; - }; - System.out.println("No is prime : " + prime1.isPrime(input)); - - /******************************************************************************************************************* - * Method Name: isPalindrome() Program Description : 3. isPalindrome() method - * take 1 parameter and check weather it is palindrome or not. - ********************************************************************************************************************/ - - // lambda expression to check if a number is palindrome. - - isPalindrome palindrome1 = (number, flag) -> { - int no1 = number; - int remainder = 0, sum = 0; - while (number > 0) { - remainder = number % 10; - number = number / 10; - flag = flag * 10 + remainder; - sum = flag; - } - System.out.println(sum); - if (sum == no1) - return true; - else - return false; - - }; - int flag = 0; - System.out.println("No is palindrome : " + palindrome1.isPalindrome(input, flag)); - } - -} - -/******************************************** - * Output: - * No is odd : true -No is prime : false -121 -No is palindrome : true - - */ - - - diff --git a/2Day2apr17/Person.java b/2Day2apr17/Person.java deleted file mode 100644 index fba897dc..00000000 --- a/2Day2apr17/Person.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.tarining.apr17; - -/************************************************************************************************************** - * Program: To create a phone directory. - * Description: Program is to create a phone directory which includes person's 3 credentials:- - * 1) First Name - * 2) Last Name - * 3) Phone No. - * Then perfom operations :- - * 1) Enter the details. - * 2) Remove the specific detail. - * 3) Search a specific detail by First Name. - * 4) Sort by First Name. - *************************************************************************************************************/ -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Scanner; - -class Details { - - private String fname, lname; - private int number; - private static int id = 1; - - public Details(String fname, String lname, int number) { - this.fname = fname; - this.lname = lname; - this.number = number; - - } - - public String getFname() { - return fname; - } - - public String getLname() { - return lname; - } - - public int getNumber() { - return number; - } - - public int getId() { - return id++; - } - -} - - -class Sortbyname implements Comparator -{ - // setting record in Ascending order - public int compare(Details a, Details b) - { - return a.firstname.compareTo(b.firstname); - } -} - - - - - -public class Person { - // public Person(String fname, String lname, int number) { - // super(fname, lname, number); - - // } - - public static void main(String args[]) { - int choice; - List
list = new ArrayList<>(); - while (true) { - System.out.println("Enter the choice to do"); - - System.out.println("1:Add NEw data of Person \n " + "2.Remove data from collection \n " - + "3.Search person by name \n " + "4.Display All records \\n " + - "5.Search person by name "); - - Scanner input1 = new Scanner(System.in); - choice = input1.nextInt(); - - switch (choice) { - - // Enter the details from user. - case 1: { - System.out.println("ENter the details"); - - Scanner input2 = new Scanner(System.in); - String first = input2.next(); - String last = input2.next(); - int num = input2.nextInt(); - - // break; - - Details d1 = new Details(first, last, num); - - list.add(d1); - System.out.println("Record added successfully"); - break; - - } - - // Remove a specific detail by taking input as an ID - case 2: { - System.out.println("Remove the details of a person"); - Scanner sc1 = new Scanner(System.in); - int RemoveById = sc1.nextInt(); - list.remove(RemoveById); - System.out.println("Record deleted successfully"); - break; - - } - - // Search phone number by first name. - case 3: { - System.out.println("Search the details of a person by name"); - Scanner sc1 = new Scanner(System.in); - String SearchByName = sc1.next(); - Iterator
itr = list.iterator(); - String isFound = null; - while (itr.hasNext()) { - Details d1 = itr.next(); - isFound = d1.getFname(); - if (isFound.equalsIgnoreCase(SearchByName)) { - // System.out.println("Record found/n"); - System.out - .println(d1.getFname() + " " + d1.getLname() + " " + d1.getNumber() + " " + d1.getId()); - } else - System.out.println("Record not found"); - } - break; - } - - case 4: { - System.out.println("Display all the details"); - Iterator
itr = list.iterator(); - while (itr.hasNext()) { - Details d1 = itr.next(); - System.out.println(d1.getFname() + " " + d1.getLname() + " " + d1.getNumber() + " " + d1.getId()); - } - - } - - case 5: - System.out.println("Sorted list is =>> "); - if(list.size()>0) - { - Collections.sort(list, new Sortbyname()); - - - for (int i1=0; i1 0) { - bool = true; - } else { - bool = false; - } - } - return bool; - } - -} - diff --git a/3PMD junit of DAY1 and DAY2/FileIoRefactoring b/3PMD junit of DAY1 and DAY2/FileIoRefactoring deleted file mode 100644 index 6f2ac5b1..00000000 --- a/3PMD junit of DAY1 and DAY2/FileIoRefactoring +++ /dev/null @@ -1,61 +0,0 @@ -package com.cg.demo; - -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; - - - - -class myclass -{ - - public void Readmyfile() throws IOException - { - FileReader fr = null; - try { - fr = new FileReader("./hello.txt"); - } catch (FileNotFoundException e) { - - e.printStackTrace(); - } - int i; - while((i=fr.read())!=-1) - System.out.print((char)i); - fr.close(); -} - - public void writemyfile() throws IOException - { - try{ - FileWriter fw=new FileWriter("./hello.txt"); - fw.write("Welcome to javaTpoint."); - fw.close(); - }catch(Exception e){System.out.println(e);} - System.out.println("Success..."); -} - - - - - -public class fileio { - -} - public static void main(String args[]) { - - - myclass m = new myclass(); - try { - m.Readmyfile(); - m.writemyfile(); - } catch (IOException e) { - - e.printStackTrace(); - } - - - } -} - diff --git a/3PMD junit of DAY1 and DAY2/JUnit Palindrome b/3PMD junit of DAY1 and DAY2/JUnit Palindrome deleted file mode 100644 index 1b732f5e..00000000 --- a/3PMD junit of DAY1 and DAY2/JUnit Palindrome +++ /dev/null @@ -1,88 +0,0 @@ -package mavenjunit; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import srcpack.Palindrome; - - -public class PalindromeTest { - -@Test -public void testpalindrone() - -{ -// PalindromeTest test = new PalindromeTest(); // Palindrome is tested - -// assert statements -assertEquals("true", Palindrome.isPalindrome(121)); -assertEquals("false", Palindrome.isPalindrome(456),false); -assertEquals("false", Palindrome.isPalindrome(-121),false); -assertEquals("false", Palindrome.isPalindrome(-456), false); - -} - - -} - - - - - - - -package srcpack; - - - -/*Program name : Pallindrome - * Program Description : Determine whether an integer is a palindrome. An integer is a - * palindrome when it reads the same backward as forward. - * Date created : 16-April-2018 - */ - -import java.util.*; -import java.util.logging.Logger; - - - -public class Palindrome { - -public static void main(String[] args) { - final Scanner read=new Scanner(System.in); - final Logger lps=Logger.getLogger(Palindrome.class.getName()); -int number; - -// lps.info("Enter the number \t"); -number=read.nextInt(); -if(isPalindrome(number)) -lps.info(number + " is a Palindrome Number."); - else - lps.info(number + " is not a Palindrome Number."); - -} -//function to check number is Palindrome or not - public static boolean isPalindrome(int num) - { - int rem,sum=0,temp; - temp=num; - while(num>0) - { - rem=num%10; //getting remainder - sum=sum*10 +rem; - num=num/10; - } - if(temp==sum) - { - - return true; - - } - else - { - return false; - } - } - - } diff --git a/3PMD junit of DAY1 and DAY2/Palindrome.java b/3PMD junit of DAY1 and DAY2/Palindrome.java deleted file mode 100644 index db83d65b..00000000 --- a/3PMD junit of DAY1 and DAY2/Palindrome.java +++ /dev/null @@ -1,114 +0,0 @@ - -// Commenting like java docs - -/*Program Name: Lambda Expression - * Program Description : Write a lambda expression for finding a - * palindrome of following IsOdd,IsPrime,IsPalindrome - *Programmer Name: Ram Dafale - *Release Date: 17-April-2018 -*/ - -package palindromepmd; - -/* - * Class Name: LambdaExp Program Description : This class include the all - * Functional interface required. : Declaration of all Functional interfaces. - * - * Programmer Name: Ram Dafale Release Date: 17-April-2018 - */ -import java.util.logging.Logger; - -public class LambdaExp { - - @FunctionalInterface - interface IsOdd { - public boolean isOdd(int number); - } - - @FunctionalInterface - interface IsPrime { - public boolean isPrime(int number); - } - - @FunctionalInterface - interface isPalindrome { - public boolean isPalindrome(int number, int flag); - } - - /* - * Method Name: LambdaExp Program Description : Main method is consists of 3 - * different logic for 3 activities of the program. 1. IsOdd method take 1 - * parameter and check weather it is odd or not. 2. IsPrime method take 1 - * parameter and check weather it is prime or not. 3. isPalindrome method take 1 - * parameter and check weather it is palindrome or not. - */ - - // removed unnecessary String args from main - public static void main() { - - final Logger printf = Logger.getLogger(LambdaExp.class.getName()); - - // Taking input - // declaring local variable final because it is not going to change - - final int input = 121; - - // lambda expression to check if a number is even/odd. - - /* - * Method Name: IsOdd() Program Description : 1. IsOdd method take 1 parameter - * and check weather it is odd or not. - */ - IsOdd check1 = (number) -> { - if (input % 2 == 0) - return false; - else - return true; - }; - printf.info("No is odd : " + check1.isOdd(input)); - - /******************************************************************************************************************* - * Method Name: IsPrime() Program Description : 2. IsPrime() method take 1 - * parameter and check weather it is prime or not. - ********************************************************************************************************************/ - - IsPrime prime1 = (number) -> { - for (int i = 2; i <= input / 2; i++) { - if (input % i == 0) - return false; - } - return true; - }; - printf.info("No is prime : " + prime1.isPrime(input)); - - /* - * Method Name: isPalindrome() Program Description : 3. isPalindrome() method - * take 1 parameter and check weather it is palindrome or not. - */ - - isPalindrome palindrome1 = (number, flag) -> { - // write a every new variable into new line - int no1 = number; - int remainder = 0; - int sum = 0; - while (number > 0) { - remainder = number % 10; - number = number / 10; - flag = flag * 10 + remainder; - sum = flag; - } - // Using Logger - printf.info(sum); - if (sum == no1) - return true; - else - return false; - - }; - int flag = 0; - - printf.info("No is palindrome : " + palindrome1.isPalindrome(input, flag)); - - } - -} diff --git a/3PMD junit of DAY1 and DAY2/ReverseStringDone b/3PMD junit of DAY1 and DAY2/ReverseStringDone deleted file mode 100644 index cde64542..00000000 --- a/3PMD junit of DAY1 and DAY2/ReverseStringDone +++ /dev/null @@ -1,125 +0,0 @@ - - -// junit test case -import static org.junit.Assert.assertEquals; - - -import org.junit.Test; -public class StringRevTest { -// private static StringReverse srrv; -@Test -public void teststringreverse() - -{ -StringReverse srt = new StringReverse(); // Palindrome is tested - -// assert statements -assertEquals("true", srt.isReverse("Hello World"),true); - - -assertEquals("false", srt.isReverse("Hello World"),true); - -} - -} - ------------------------------------------------------------------------------------------------------------------- -//Program of String arrangement - - - -/******************************************************************************************************************* - * Program Name: String Reorganizing - * Program Description : Take a word and make sure that no two letter occuur adjacent to one another. - * - *Programmer Name: Ram Dafale - *Release Date: 17-April-2018 - ********************************************************************************************************************/ - - -package com.cg; - - -/* - * Class Name: ReorganizeString Program Description : - * Description: It takes input from user and - * - */ - - -import java.util.Scanner; - - -class myclass -{ - - -public void MyMethod() -{ - System.out.println("Enter a String:"); - - Scanner scan = new Scanner(System.in); - int cnt = 0; - String str = ""; - String string = scan.next(); - char arr[] = string.toCharArray(); - for (int input = 0; input < arr.length - 1; input++) { - if (arr[input] != arr[input + 1]) { - System.out.println(string); - } - break; - } - - for (int input = 0; input < arr.length - 1; input++) { - - if (arr[input] == arr[input + 1]) { - - cnt++; - continue; - } else { - - char temp = arr[input]; - arr[input] = arr[input + 1]; - arr[input + 1] = temp; - str = String.valueOf(arr); - } - } - if (cnt != 3) { - // System.out.println(str.length()); - for (int j = 0; j < str.length() - 1; j++) { - - if (str.charAt(j) == str.charAt(j + 1)) { - System.out.println("null"); - } else { - System.out.println("String is" + str); - break; - } - - } - - } else { - System.out.println(str); - } - scan.close(); - } - -} - - - - -public class CorrectionInReorganizeString { - - public static void main(String[] args) { - - myclass myob = new myclass(); - myob.MyMethod(); -} -} - - - - - - - diff --git a/4Day4-19-April/.eclipse-pmd b/4Day4-19-April/.eclipse-pmd deleted file mode 100644 index 917288ec..00000000 --- a/4Day4-19-April/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/4Day4-19-April/.settings/org.eclipse.jdt.core.prefs b/4Day4-19-April/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3a215370..00000000 --- a/4Day4-19-April/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/4Day4-19-April/bin/CustomException.class b/4Day4-19-April/bin/CustomException.class deleted file mode 100644 index e72236cd..00000000 Binary files a/4Day4-19-April/bin/CustomException.class and /dev/null differ diff --git a/4Day4-19-April/bin/InputFormatException.class b/4Day4-19-April/bin/InputFormatException.class deleted file mode 100644 index f94391a6..00000000 Binary files a/4Day4-19-April/bin/InputFormatException.class and /dev/null differ diff --git a/4Day4-19-April/bin/printArrayOfIntString.class b/4Day4-19-April/bin/printArrayOfIntString.class deleted file mode 100644 index 5ac84a77..00000000 Binary files a/4Day4-19-April/bin/printArrayOfIntString.class and /dev/null differ diff --git a/4Day4-19-April/src/CustomException.java b/4Day4-19-April/src/CustomException.java deleted file mode 100644 index b9a14819..00000000 --- a/4Day4-19-April/src/CustomException.java +++ /dev/null @@ -1,66 +0,0 @@ -import java.util.Scanner; - -/** - * - */ - - - - -/** - * @author trainee - * - */ - - -class InputFormatException extends Exception -{ - public InputFormatException(String Message) - { - super(Message); - - } -} - -public class CustomException { - -/** -* @param args -* @return - * @throws InputFormatException -*/ -public static int power(int numrs,int pows) throws InputFormatException //throws InputFormatException -{ - - if (numrs < 0) - { - throw new InputFormatException("Negative value not allowed"); - - } - -if (pows > 0 && numrs > 0 ) -{ - return numrs * power(numrs, pows - 1); -} - else - { - return 1; - } - - // else { - // throw new InputFormatException("Negative value not allowed"); - // } -} -public static void main(String[] args) throws InputFormatException { -Scanner read=new Scanner(System.in); -int numb1; -int numb2; -System.out.println("Enter two numbers\t"); -numb1=read.nextInt(); -numb2=read.nextInt(); -//long rest=; -System.out.println(power(numb1,numb2)); - -} - -} \ No newline at end of file diff --git a/4Day4-19-April/src/JUNITDay4PrintArray b/4Day4-19-April/src/JUNITDay4PrintArray deleted file mode 100644 index 746a0f87..00000000 --- a/4Day4-19-April/src/JUNITDay4PrintArray +++ /dev/null @@ -1,38 +0,0 @@ -package mavenjunit; - -import static org.junit.Assert.assertEquals; - -import java.util.Arrays; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import srcpack.printArrayOfIntString; - - -public class PrintArray { - - - @Before - public static String[] initObjects() { - String stringObject[] = {"Naruto","dsd"}; - return stringObject; - } - - - @Test - public void test() { - - ; - - assertEquals(true,printArrayOfIntString.printarray(PrintArray.initObjects())); - - - //assertEquals(false, printArrays.printarray()); - - - - } - -} diff --git a/4Day4-19-April/src/JunitDa4EXception b/4Day4-19-April/src/JunitDa4EXception deleted file mode 100644 index d16301f7..00000000 --- a/4Day4-19-April/src/JunitDa4EXception +++ /dev/null @@ -1,39 +0,0 @@ -package mavenjunit; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - - -import org.junit.Test; - -import srcpack.CustomException; -//import srcpack.InputFormatException; -// import srcpack.InputFormatException; - -public class JunitForException { - - - CustomException persist =new CustomException(); - - - @Test - public void exceptioncheck() - { - - - - - assertEquals("true",8,persist.power(2,3)); - - assertEquals("true",persist.power(0,0)); - - - -// @Test -// public void testEcxeption() throws IOException { - - // CustomException test = new CustomException(); - // assertEquals(false, test.power(-1, -2)); - - } -} diff --git a/4Day4-19-April/src/printArrayOfIntString.java b/4Day4-19-April/src/printArrayOfIntString.java deleted file mode 100644 index 517ac263..00000000 --- a/4Day4-19-April/src/printArrayOfIntString.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* -* Program name : Print Array Of Integer & String -* Program Description : Let's say you have an integer array and a string array. -* You have to write a single method -* printarray that can print all the elements of both arrays. -* The method should be able to -* accept both integer and string arrays. -* Date : 19-April-2018 -*/ - -import java.util.Scanner; - -/* - * @author ram dafale - * Generic method printarray is printing integer - * array list and string array list together. - */ -public class printArrayOfIntString { - - /** - * @param args - */ - public static void main(String[] args) { - final Scanner read = new Scanner(System.in); - int range1; - int range2; - int inti; - int stringi; - - System.out.println("Enter number of elements for integer array\t"); - range1 = read.nextInt(); - Integer intArr[] = new Integer[range1]; - for (inti = 0; inti < range1; inti++) { - intArr[inti] = read.nextInt(); - } - System.out.println("Enter number of elements for string array\t"); - range2 = read.nextInt(); - String[] stringArray = new String[range2]; - for (stringi = 0; stringi < range2; stringi++) { - stringArray[stringi] = read.nextLine(); - } - System.out.println("-----------------------------------"); - printarray(intArr); // pass an Integer array - printarray(stringArray); // pass a String array - read.close(); - } - - public static void printarray(E[] inputArray) { - // display array elements - for (E element : inputArray) - System.out.printf("%s ", element); - - System.out.println(); - - } -} diff --git a/5Bank Application/BankAppJunit.java b/5Bank Application/BankAppJunit.java deleted file mode 100644 index 817af257..00000000 --- a/5Bank Application/BankAppJunit.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Program Name: Test cases for abnk application using JUNIT - * @author Ram Dafale - * DateOF Completion : 4/42/2018 - */ - - - -package BankApplicationWIthMaven.BankApplicationAI; - - - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import bankapplication.Customer; - - - - -/* - * class Name: BankAppJunit - * Description : this class contains various test cases for bank application - * 1. Null values are not allowed in Name - * 2. Null values are not allowed in lASTnaME - * 3. Null values are not allowed in MOBILE NUMBER - * 4. checking if deposit method running or not - * 5. checking if withdraw method running or not - * 6. checking if addInterest method running or not - */ -public class BankAppJunit { - - - //Creating a customer class object - Customer cust = new Customer("ram", "dafale", "wardha", 97546545, "ramdafale@gmail.com"); - - - // 1. Null values are not allowed in Name - @Test - public void checknullInFirstName() - { - String str= null; - assertNotEquals("null not allowed ",str,cust.getFname()); - } - - - - @Test - public void checknullInLastName() - { - String str1= null; - assertNotEquals("null not allowed ",str1,cust.getLname()); - } - - - @Test - public void checknullInMobile() - { - String str2= null; - assertNotEquals("null not allowed ",str2,cust.getNumber()); - } - - - @Test - public void testWithdraw(){ - double balance =2000; - int amount = 1000; - assertTrue( (balance = balance - amount) == 1000); - } - - - - - @Test - public void testDeposit(){ - double balance = 0; - int amount = 1000; - - } - - - - @Test - public void addInterest() { - int balance=100; - double interestRate=0.087; - - assertFalse( ( balance = (int) (interestRate * balance + balance)) == 1000); ; - - } - - - - - -} - - - - - - - - - - diff --git a/5Bank Application/pom.xml b/5Bank Application/pom.xml deleted file mode 100644 index 0e78f6be..00000000 --- a/5Bank Application/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - bank - bank11 - 0.0.1-SNAPSHOT - jar - - bank11 - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 3.8.1 - test - - - diff --git a/5Bank Application/src/main/java/bank/bank11/App.java b/5Bank Application/src/main/java/bank/bank11/App.java deleted file mode 100644 index 49bccc0e..00000000 --- a/5Bank Application/src/main/java/bank/bank11/App.java +++ /dev/null @@ -1,220 +0,0 @@ -package bank.bank11; - -class Bank { - static String name = "My Bank"; - - public void bankName() { - - System.out.println(name); - - } - -} - -class Customer { - String fname = null; - String lname = null; - String address = null; - long number; - String email; - - /** - * @param fname - * @param lname - * @param address - * @param number - * @param email - */ - public Customer(String fname, String lname, String address, long number, String email) { - this.fname = fname; - this.lname = lname; - this.address = address; - this.number = number; - this.email = email; - } - - /** - * @return the fname - */ - public String getFname() { - return fname; - } - - /** - * @param fname - * the fname to set - */ - public void setFname(String fname) { - this.fname = fname; - } - - /** - * @return the lname - */ - public String getLname() { - return lname; - } - - /** - * @param lname - * the lname to set - */ - public void setLname(String lname) { - this.lname = lname; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address - * the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * @return the number - */ - public long getNumber() { - return number; - } - - /** - * @param number - * the number to set - */ - public void setNumber(long number) { - this.number = number; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email - * the email to set - */ - public void setEmail(String email) { - this.email = email; - } - -} - -abstract class Account { - Customer customer; - static int id = 0; - double balance = 0; - int accountNumber; - - /** - * @param balance - */ - public Account(double balance,Customer customer) { - // super(fname, lname, address, number, email); - this.balance = balance; - // this.accountNumber = account; - accountNumber = ++id; - this.customer=customer; - } - - /** - * @return the balance - */ - public double getBalance() { - return balance; - } - - /** - * @param balance - * the balance to set - */ - public void setBalance(double balance) { - this.balance = balance; - } - - /** - * @return the accountNumber - */ - public int getAccountNumber() { - return accountNumber; - } - - /* - * public abstract void calcsal(double a); public void disp() { - * - * System.out.println("Id"+ id+"Salary"+balance); - * - * } - */ - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Account [balance=" + balance + ", accountNumber=" + accountNumber + "]"; - } - -} - -class savingAccount extends Account { -Customer customer; - /** - * @param balance - * @param accountNumber - */ - public savingAccount(double balance,Customer customer) { - super(balance,customer); - this.customer=customer; - // TODO Auto-generated constructor stub - } - - public void Deposit(int amount) { - balance = balance + amount; - } - - public void Withdraw(int amount) { - if (balance - amount > 0) { - balance = balance - amount; - } else { - System.out.println("Not enough balance to withdraw " + amount); - } - } - - public void Disp() { - System.out.println(" \n Account no:" + accountNumber + "\n Balance:" + balance+" \n Name:"+customer.getFname()+" \n Surname:"+customer.getLname()); - } - -} - -public class App extends Bank { - - public static void main(String[] args) { - System.out.println("Welcome To" + name); - - Customer cust1=new Customer("ram","dafale","at wardha", 976651934, "ramdafale@gmail.com"); - Account Arr[] = new savingAccount[100]; - Arr[0] = new savingAccount(1000,cust1); - // Arr[1] = new savingAccount(5000); - - ((savingAccount) Arr[0]).Disp(); - ((savingAccount) Arr[0]).Deposit(1000); - ((savingAccount) Arr[0]).Disp(); - ((savingAccount) Arr[0]).Withdraw(1000); - ((savingAccount) Arr[0]).Disp(); - // ((savingAccount) Arr[1]).Disp(); - - } -} diff --git a/5Bank Application/src/main/java/bankapplication/Account.java b/5Bank Application/src/main/java/bankapplication/Account.java deleted file mode 100644 index 61377767..00000000 --- a/5Bank Application/src/main/java/bankapplication/Account.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - */ -package bankapplication; - -/** - * @author trainee - * - */ - -abstract class Account { - Customer customer; - static int id = 0; - double balance = 0; - int accountNumber; - - /** - * @param balance - */ - public Account(double balance,Customer customer) { - // super(fname, lname, address, number, email); - this.balance = balance; - // this.accountNumber = account; - accountNumber = ++id; - this.customer=customer; - } - - /** - * @return the balance - */ - public double getBalance() { - return balance; - } - - /** - * @param balance - * the balance to set - */ - public void setBalance(double balance) { - this.balance = balance; - } - - /** - * @return the accountNumber - */ - public int getAccountNumber() { - return accountNumber; - } - - /* - * public abstract void calcsal(double a); public void disp() { - * - * System.out.println("Id"+ id+"Salary"+balance); - * - * } - */ - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Account [balance=" + balance + ", accountNumber=" + accountNumber + "]"; - } - -} \ No newline at end of file diff --git a/5Bank Application/src/main/java/bankapplication/Apps.java b/5Bank Application/src/main/java/bankapplication/Apps.java deleted file mode 100644 index a3fbfaa4..00000000 --- a/5Bank Application/src/main/java/bankapplication/Apps.java +++ /dev/null @@ -1,120 +0,0 @@ -/* Program Name : Create Banking application in core java using concepts like collections and oops. - * Description: In Saving Account class and Current Account class there are methods withdraw and deposit amount. - * Author : Ram Dafale - * Date of Completion: 23/4/2018 - */ - -package bankapplication; - -/* - * Description: required librabry classes. - */ - -import java.util.HashMap; -import java.util.Map; - -/* - * class Name : Apps - * Description: In Saving Account class and Current Account class there are methods withdraw and deposit amount. - */ -public class Apps extends Bank { - - public static void main(String[] args) { - - /* - * using log4j - */ - final Logger LOGGER = Logger.getLogger(Apps.class.getName()); - - LOGGER.info("Welcome To" + name); - // Creating New account for customer - Customer cust1 = new Customer("ram", "dafale", "at wardha", 976651934, "ramdafale@gmail.com"); - // We can use ArrayList too - savingAccount Arr[] = new savingAccount[5]; - - Arr[0] = new savingAccount(1000, cust1); - - Arr[0].Disp(); - double depAmnt = Arr[0].Deposit(1000); - Arr[0].Disp(); - double withdAmnt = Arr[0].Withdraw(1000); - //System.out.println(" Balance after adding interest rate is :"); - Arr[0].addInterest(); - Arr[0].Disp(); - // Creating another account for customer - Customer cust2 = new Customer("shyam", "dafale", "at Delhi", 97665454, "shyamdafale@gmail.com"); - - Arr[1] = new savingAccount(5000, cust2); - - Arr[1].Disp(); - Arr[1].Deposit(1000); - Arr[1].Disp(); - Arr[1].Withdraw(700); - //System.out.println(" Balance after adding interest rate is :"); - Arr[1].addInterest(); - Arr[1].Disp(); - - // Code for printing the statement of each customer - - Map hm = new HashMap(); - hm.put(1, Arr[0]); - hm.put(2, Arr[1]); - - for (Map.Entry entry : hm.entrySet()) { - int key = entry.getKey(); - Account b = entry.getValue(); - LOGGER.info(key + " Mini Statement of :"); - LOGGER.info("AccountNo:" + b.getAccountNumber() + "Account Balance: " + b.getBalance() - + "Deposit Amt " + depAmnt + "Withdraw Amt:" + withdAmnt); - - } - } -} - - -//Output - -/* - Welcome To-------Indian Bank------ - - Account no:1 - Balance:1000.0 - Name:ram - Surname:dafale - - Account no:1 - Balance:2000.0 - Name:ram - Surname:dafale -Mon Apr 23 19:20:22 IST 2018 - Balance after adding interest rate is : -Salary After adding interest rate is :1070.0 - - Account no:1 - Balance:1070.0 - Name:ram - Surname:dafale - - Account no:2 - Balance:5000.0 - Name:shyam - Surname:dafale - - Account no:2 - Balance:6000.0 - Name:shyam - Surname:dafale -Mon Apr 23 19:20:22 IST 2018 - Balance after adding interest rate is : -Salary After adding interest rate is :5671.0 - - Account no:2 - Balance:5671.0 - Name:shyam - Surname:dafale -1 Mini Statement of : -AccountNo:1Account Balance: 1070.0Deposit Amt 2000.0Withdraw Amt:1000.0 -2 Mini Statement of : -AccountNo:2Account Balance: 5671.0Deposit Amt 2000.0Withdraw Amt:1000.0 - - */ diff --git a/5Bank Application/src/main/java/bankapplication/Bank.java b/5Bank Application/src/main/java/bankapplication/Bank.java deleted file mode 100644 index 67865d41..00000000 --- a/5Bank Application/src/main/java/bankapplication/Bank.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * - */ -package bankapplication; - -/** - * @author trainee - * - */ -class Bank { - static String name = "-------Indian Bank------"; - - public void bankName() { - - LOGGER.info(name); - - } - -} diff --git a/5Bank Application/src/main/java/bankapplication/Customer.java b/5Bank Application/src/main/java/bankapplication/Customer.java deleted file mode 100644 index d94ca7d6..00000000 --- a/5Bank Application/src/main/java/bankapplication/Customer.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - */ -package bankapplication; - -/** - * @author trainee Desc: class Customer has all required fields like firstname - * ,lastname etc. this class is sending all field values to the Account - * class - */ - -class Customer { - - private String fname = null; - private String lname = null; - private String address = null; - private long number; - private String email; - - /** - * @param fname - * @param lname - * @param address - * @param number - * @param email - */ - public Customer(String fname, String lname, String address, long number, String email) { - this.fname = fname; - this.lname = lname; - this.address = address; - this.number = number; - this.email = email; - } - - /** - * @return the fname - */ - public String getFname() { - return fname; - } - - /** - * @param fname - * the fname to set - */ - public void setFname(String fname) { - this.fname = fname; - } - - /** - * @return the lname - */ - public String getLname() { - return lname; - } - - /** - * @param lname - * the lname to set - */ - public void setLname(String lname) { - this.lname = lname; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address - * the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * @return the number - */ - public long getNumber() { - return number; - } - - /** - * @param number - * the number to set - */ - public void setNumber(long number) { - this.number = number; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email - * the email to set - */ - public void setEmail(String email) { - this.email = email; - } - -} diff --git a/5Bank Application/src/main/java/bankapplication/currentAccount.java b/5Bank Application/src/main/java/bankapplication/currentAccount.java deleted file mode 100644 index 0c7b8a3e..00000000 --- a/5Bank Application/src/main/java/bankapplication/currentAccount.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - */ -package bankapplication; - -/** - * @author ram dafale This class create a current account and perform basic - * deposit and witrdraw operations. - */ -class currentAccount extends Account { - Customer customer; - double interestRate = 0.08; - - public currentAccount(double balance, Customer customer) { - super(balance, customer); - this.customer = customer; - // TODO Auto-generated constructor stub - } - - /** - * @param amount - */ - public double Deposit(int amount) { - return balance = balance + amount; - } - - /** - * @param amount - */ - public void Withdraw(int amount) { - - if (amount < 0) { - - } - balance = balance - amount; - - } - - public void addInterest() { - - balance = interestRate * balance + balance; - LOGGER.info("Salary After adding interest rate is :" + balance); - - } - -} diff --git a/5Bank Application/src/main/java/bankapplication/savingAccount.java b/5Bank Application/src/main/java/bankapplication/savingAccount.java deleted file mode 100644 index 76a7717f..00000000 --- a/5Bank Application/src/main/java/bankapplication/savingAccount.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - */ -package bankapplication; - -/** - * @author trainee - * @class Account -> this class is abstract class which is then inherited by SavingAccount and currentAccount - * - */ - -abstract class Account { -final private Customer customer; -static int id = 0; -protected double balance = 0; // because this field is associated with Saving and FlexibleSaving -public final int accountNumber; - - /** - * @param balance - */ - public Account(final double balance, final Customer customer) { - // super(fname, lname, address, number, email); - this.balance = balance; - // this.accountNumber = account; - accountNumber = ++id; - this.customer=customer; - } - - /** - * @return the balance - */ - public double getBalance() { - return balance; - } - - /** - * @param balance - * the balance to set - */ - public void setBalance(final double balance) { - this.balance = balance; - } - - /** - * @return the accountNumber - */ - public int getAccountNumber() { - return accountNumber; - } - - - - @Override - public String toString() { - return "Account [balance=" + balance + ", accountNumber=" + accountNumber + "]"; - } - -} diff --git a/5Bank Application/src/main/java/bankapplication/statement.java b/5Bank Application/src/main/java/bankapplication/statement.java deleted file mode 100644 index 817af257..00000000 --- a/5Bank Application/src/main/java/bankapplication/statement.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Program Name: Test cases for abnk application using JUNIT - * @author Ram Dafale - * DateOF Completion : 4/42/2018 - */ - - - -package BankApplicationWIthMaven.BankApplicationAI; - - - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import bankapplication.Customer; - - - - -/* - * class Name: BankAppJunit - * Description : this class contains various test cases for bank application - * 1. Null values are not allowed in Name - * 2. Null values are not allowed in lASTnaME - * 3. Null values are not allowed in MOBILE NUMBER - * 4. checking if deposit method running or not - * 5. checking if withdraw method running or not - * 6. checking if addInterest method running or not - */ -public class BankAppJunit { - - - //Creating a customer class object - Customer cust = new Customer("ram", "dafale", "wardha", 97546545, "ramdafale@gmail.com"); - - - // 1. Null values are not allowed in Name - @Test - public void checknullInFirstName() - { - String str= null; - assertNotEquals("null not allowed ",str,cust.getFname()); - } - - - - @Test - public void checknullInLastName() - { - String str1= null; - assertNotEquals("null not allowed ",str1,cust.getLname()); - } - - - @Test - public void checknullInMobile() - { - String str2= null; - assertNotEquals("null not allowed ",str2,cust.getNumber()); - } - - - @Test - public void testWithdraw(){ - double balance =2000; - int amount = 1000; - assertTrue( (balance = balance - amount) == 1000); - } - - - - - @Test - public void testDeposit(){ - double balance = 0; - int amount = 1000; - - } - - - - @Test - public void addInterest() { - int balance=100; - double interestRate=0.087; - - assertFalse( ( balance = (int) (interestRate * balance + balance)) == 1000); ; - - } - - - - - -} - - - - - - - - - - diff --git a/5Bank Application/src/test/java/BankApplicationWIthMaven/BankApplicationAI/BankAppJunit.java b/5Bank Application/src/test/java/BankApplicationWIthMaven/BankApplicationAI/BankAppJunit.java deleted file mode 100644 index 5f52fab4..00000000 --- a/5Bank Application/src/test/java/BankApplicationWIthMaven/BankApplicationAI/BankAppJunit.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * - */ -package BankApplicationWIthMaven.BankApplicationAI; - -import junit.framework.TestCase; - -/** - * @author trainee - * - */ -public class BankAppJunit extends TestCase { - -} diff --git a/5Bank Application/src/test/java/bank/bank11/AppTest.java b/5Bank Application/src/test/java/bank/bank11/AppTest.java deleted file mode 100644 index bae21cb3..00000000 --- a/5Bank Application/src/test/java/bank/bank11/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package bank.bank11; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/5Bank Application/target/classes/META-INF/MANIFEST.MF b/5Bank Application/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index c8c47a73..00000000 --- a/5Bank Application/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: Ram -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/5Bank Application/target/classes/META-INF/maven/bank/bank11/pom.properties b/5Bank Application/target/classes/META-INF/maven/bank/bank11/pom.properties deleted file mode 100644 index a713885e..00000000 --- a/5Bank Application/target/classes/META-INF/maven/bank/bank11/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Sun Apr 22 12:23:40 IST 2018 -version=0.0.1-SNAPSHOT -groupId=bank -m2e.projectName=bank11 -m2e.projectLocation=C\:\\Users\\Ram\\Documents\\workspace-sts-3.9.4.RELEASE\\bank11 -artifactId=bank11 diff --git a/5Bank Application/target/classes/META-INF/maven/bank/bank11/pom.xml b/5Bank Application/target/classes/META-INF/maven/bank/bank11/pom.xml deleted file mode 100644 index 0e78f6be..00000000 --- a/5Bank Application/target/classes/META-INF/maven/bank/bank11/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - bank - bank11 - 0.0.1-SNAPSHOT - jar - - bank11 - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 3.8.1 - test - - - diff --git a/5Bank Application/target/classes/bank/bank11/Account.class b/5Bank Application/target/classes/bank/bank11/Account.class deleted file mode 100644 index ffc86068..00000000 Binary files a/5Bank Application/target/classes/bank/bank11/Account.class and /dev/null differ diff --git a/5Bank Application/target/classes/bank/bank11/App.class b/5Bank Application/target/classes/bank/bank11/App.class deleted file mode 100644 index 3bb79740..00000000 Binary files a/5Bank Application/target/classes/bank/bank11/App.class and /dev/null differ diff --git a/5Bank Application/target/classes/bank/bank11/Bank.class b/5Bank Application/target/classes/bank/bank11/Bank.class deleted file mode 100644 index 65ed060b..00000000 Binary files a/5Bank Application/target/classes/bank/bank11/Bank.class and /dev/null differ diff --git a/5Bank Application/target/classes/bank/bank11/Customer.class b/5Bank Application/target/classes/bank/bank11/Customer.class deleted file mode 100644 index e278e691..00000000 Binary files a/5Bank Application/target/classes/bank/bank11/Customer.class and /dev/null differ diff --git a/5Bank Application/target/classes/bank/bank11/savingAccount.class b/5Bank Application/target/classes/bank/bank11/savingAccount.class deleted file mode 100644 index 50acdd7c..00000000 Binary files a/5Bank Application/target/classes/bank/bank11/savingAccount.class and /dev/null differ diff --git a/5Bank Application/target/test-classes/bank/bank11/AppTest.class b/5Bank Application/target/test-classes/bank/bank11/AppTest.class deleted file mode 100644 index a4eb7347..00000000 Binary files a/5Bank Application/target/test-classes/bank/bank11/AppTest.class and /dev/null differ diff --git a/6SpringBank/.checkstyle b/6SpringBank/.checkstyle deleted file mode 100644 index 6a3751a4..00000000 --- a/6SpringBank/.checkstyle +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/6SpringBank/.eclipse-pmd b/6SpringBank/.eclipse-pmd deleted file mode 100644 index 917288ec..00000000 --- a/6SpringBank/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/6SpringBank/.settings/org.eclipse.core.resources.prefs b/6SpringBank/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/6SpringBank/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/6SpringBank/.settings/org.eclipse.jdt.core.prefs b/6SpringBank/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5df81821..00000000 --- a/6SpringBank/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,421 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.APILeak=warning -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 -org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=100 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=100 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines -org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/6SpringBank/.settings/org.eclipse.jdt.ui.prefs b/6SpringBank/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 1deb939e..00000000 --- a/6SpringBank/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_functional_interfaces=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=false -cleanup.format_source_code=false -cleanup.format_source_code_changes_only=false -cleanup.insert_inferred_type_arguments=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_redundant_type_arguments=false -cleanup.remove_trailing_whitespaces=false -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_anonymous_class_creation=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_lambda=true -cleanup.use_parentheses_in_expressions=false -cleanup.use_this_for_non_static_field_access=false -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=false -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_eclipse-cs HelloSpring2 -cleanup_settings_version=2 -eclipse.preferences.version=1 -formatter_profile=_eclipse-cs HelloSpring2 -formatter_settings_version=13 diff --git a/6SpringBank/.settings/org.eclipse.m2e.core.prefs b/6SpringBank/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/6SpringBank/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/6SpringBank/log4j.properties b/6SpringBank/log4j.properties deleted file mode 100644 index 8ce52e6a..00000000 --- a/6SpringBank/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -log4j.rootLogger=ERROR,stdout -log4j.logger.com.endeca=INFO -# Logger for crawl metrics -log4j.logger.com.endeca.itl.web.metrics=INFO - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n \ No newline at end of file diff --git a/6SpringBank/pom.xml b/6SpringBank/pom.xml deleted file mode 100644 index 4b815374..00000000 --- a/6SpringBank/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - 4.0.0 - - HelloSpring - HelloSpring1 - 0.0.1-SNAPSHOT - jar - - HelloSpring1 - http://maven.apache.org - - - UTF-8 - - - - - - - junit - junit - 4.12 - test - - - - - log4j - log4j - 1.2.17 - - - - org.springframework - spring-core - 4.3.5.RELEASE - - - - org.springframework - spring-beans - 4.3.5.RELEASE - - - org.springframework - spring-context - 4.3.5.RELEASE - - - - - - diff --git a/6SpringBank/src/main/java/controller/App.java b/6SpringBank/src/main/java/controller/App.java deleted file mode 100644 index ca2af5c6..00000000 --- a/6SpringBank/src/main/java/controller/App.java +++ /dev/null @@ -1,100 +0,0 @@ -package controller; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import model.Bank; -import model.Customer; -import model.SavingAccountM; -import repository.SavingAccountImpl; - -public class App extends Bank { - - /* - * Returns nothing - */ - public static void main(final String[] args) { - - final Logger logMe = Logger.getLogger(App.class.getName()); - - final ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); - - Bank bank = ctx.getBean("bank", Bank.class); - - List banklist = new ArrayList(); - System.out.println(); - service.IBankService bankService = ctx.getBean("bankService", service.BankServiceImpl.class); - banklist = bankService.addBank(bank); - - - - final Customer customer1 = ctx.getBean(Customer.class); - - final SavingAccountM mySaving = (SavingAccountM) ctx.getBean("savingAccount1"); - - - SavingAccountImpl savingImpl = new SavingAccountImpl(); - - System.out.println(savingImpl.Deposit(36)); - - System.out.println(savingImpl.Withdraw(99)); - - - - final List listSavingAccount = new ArrayList(); - - listSavingAccount.add(mySaving); - - for (final SavingAccountM item : listSavingAccount) { - logMe.info("retrieved element: " + item); - } - - - - - - mySaving.getAccountNumber(); - mySaving.getBalance(); - mySaving.getCustomer(); - mySaving.getInterestRate(); - - logMe.info("Welcome To Bank : " + customer1.getFname()); - logMe.info("Your balance is: " + mySaving.getBalance()); - - - - - - logMe.info("Update my Account"); - - customer1.setEmail("newEmailID@example.com"); - - logMe.info("After Update "); - System.out.println(customer1.getEmail()); - - - - if (listSavingAccount.contains(mySaving)) { - logMe.info("Account found"); - } else { - logMe.info("Account not found"); - } - - - - //Remove my account - listSavingAccount.remove(mySaving); - - if (listSavingAccount.contains(mySaving)) { - logMe.info("Account found"); - } else { - logMe.info("Account not found"); - } - - } - -} diff --git a/6SpringBank/src/main/java/controller/BankController.java b/6SpringBank/src/main/java/controller/BankController.java deleted file mode 100644 index 502f11c3..00000000 --- a/6SpringBank/src/main/java/controller/BankController.java +++ /dev/null @@ -1,89 +0,0 @@ -package controller; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import model.Bank; -import model.Customer; -import model.SavingAccountCollection; -import model.SavingAccountM; - -public class BankController { - - /* - * Returns nothing - */ - public static void main(final String[] args) { - - final Logger logMe = Logger.getLogger(BankController.class.getName()); - - final ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); - - Bank bank = ctx.getBean("bank", Bank.class); - - List banklist = new ArrayList(); - System.out.println(); - service.IBankService bankService = ctx.getBean("bankService", service.BankServiceImpl.class); - banklist = bankService.addBank(bank); - - final Customer customer1 = ctx.getBean("customer1", Customer.class); - - final SavingAccountM mySaving = (SavingAccountM) ctx.getBean("savingAccount1"); - - SavingAccountCollection jc=(SavingAccountCollection)ctx.getBean("savingsaccountcollection",SavingAccountCollection.class); - - System.out.println(jc.getAddressList()); - - service.SavingAccountImpl savingImpl = new service.SavingAccountImpl(); - - System.out.println(savingImpl.Deposit(36)); - - System.out.println(savingImpl.Withdraw(99)); - - // System.out.println(savingImpl.()); - - final List listSavingAccount = new ArrayList(); - - listSavingAccount.add(mySaving); - - for (final SavingAccountM item : listSavingAccount) { - logMe.info("retrieved element: " + item); - } - - mySaving.getAccountNumber(); - mySaving.getBalance(); - mySaving.getCustomer(); - mySaving.getInterestRate(); - - logMe.info("Welcome To Bank : " + customer1.getFname()); - logMe.info("Your balance is: " + mySaving.getBalance()); - - logMe.info("Update my Account"); - - customer1.setEmail("newEmailID@example.com"); - - logMe.info("After Update "); - System.out.println(customer1.getEmail()); - - if (listSavingAccount.contains(mySaving)) { - logMe.info("Account found"); - } else { - logMe.info("Account not found"); - } - - // Remove my account - listSavingAccount.remove(mySaving); - - if (listSavingAccount.contains(mySaving)) { - logMe.info("Account found"); - } else { - logMe.info("Account not found"); - } - - } - -} diff --git a/6SpringBank/src/main/java/model/Bank.java b/6SpringBank/src/main/java/model/Bank.java deleted file mode 100644 index 167334fa..00000000 --- a/6SpringBank/src/main/java/model/Bank.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - */ -package model; - -import java.util.logging.Logger; - - - -/** - * @author trainee - * - */ - -public class Bank { - - private String name; - - public Bank() { - // TODO Auto-generated constructor stub - } - - public Bank(String name) { - super(); - this.name = name; - } - - public String getName() { - return name; - } - -} - -/* - * public class Bank { static String name = "-------Indian Bank------"; - * - * public void bankName() { - * - * final Logger LOGGER = Logger.getLogger(Apps.class.getName()); LOGGER.info(name); - * - * } - * - * } - */ \ No newline at end of file diff --git a/6SpringBank/src/main/java/model/CurrentAccountM.java b/6SpringBank/src/main/java/model/CurrentAccountM.java deleted file mode 100644 index c8029891..00000000 --- a/6SpringBank/src/main/java/model/CurrentAccountM.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * - */ -package model; - -/** - * @author trainee - * - */ -public class CurrentAccountM { - Customer customer; - double interestRate = 0.08; - double balance; - - static int id = 100; - - int accountNumber; - - /** - * @param customer - * @param interestRate - * @param balance - * @param accountNumber - */ - public CurrentAccountM(final Customer customer, final double interestRate, final double balance, - final int accountNumber) { - super(); - this.customer = customer; - this.interestRate = interestRate; - this.balance = balance; - this.accountNumber = accountNumber; - } - - public CurrentAccountM() { - - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @return the interestRate - */ - public double getInterestRate() { - return interestRate; - } - - /** - * @param interestRate - * the interestRate to set - */ - public void setInterestRate(final double interestRate) { - this.interestRate = interestRate; - } - - /** - * @return the balance - */ - public double getBalance() { - return balance; - } - - /** - * @param balance - * the balance to set - */ - public void setBalance(final double balance) { - this.balance = balance; - } - - /** - * @return the accountNumber - */ - public int getAccountNumber() { - return accountNumber; - } - - /** - * @param accountNumber - * the accountNumber to set - */ - public void setAccountNumber(final int accountNumber) { - this.accountNumber = accountNumber; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "CurrentAccountM customer=" + customer + ", interestRate=" + interestRate + ", balance=" - + balance + ", accountNumber=" + accountNumber + ""; - } - -} diff --git a/6SpringBank/src/main/java/model/Customer.java b/6SpringBank/src/main/java/model/Customer.java deleted file mode 100644 index 1df9e987..00000000 --- a/6SpringBank/src/main/java/model/Customer.java +++ /dev/null @@ -1,120 +0,0 @@ -package model; - -/** - * @author trainee Desc: class Customer has all required fields like firstname - * ,lastname etc. this class is sending all field values to the Account - * class - */ - -public class Customer { - - private String fname = null; - private String lname = null; - private String address = null; - private long number; - private String email; - - /** - * @param fname - * @param lname - * @param address - * @param number - * @param email - */ - public Customer() { - - } - - public Customer(String fname, String lname, String address, long number, String email) { - this.fname = fname; - this.lname = lname; - this.address = address; - this.number = number; - this.email = email; - } - - /** - * @return the fname - */ - public String getFname() { - return fname; - } - - /** - * @param fname - * the fname to set - */ - public void setFname(String fname) { - this.fname = fname; - } - - /** - * @return the lname - */ - public String getLname() { - return lname; - } - - /** - * @param lname - * the lname to set - */ - public void setLname(String lname) { - this.lname = lname; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address - * the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * @return the number - */ - public long getNumber() { - return number; - } - - /** - * @param number - * the number to set - */ - public void setNumber(long number) { - this.number = number; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email - * the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Customer fname=" + fname + ", lname=" + lname + ", address=" + address + ", number=" + number - + ", email=" + email + ""; - } - -} diff --git a/6SpringBank/src/main/java/model/SavingAccountCollection.java b/6SpringBank/src/main/java/model/SavingAccountCollection.java deleted file mode 100644 index b74f5aa5..00000000 --- a/6SpringBank/src/main/java/model/SavingAccountCollection.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package model; - -/** - * @author trainee - * - */ -import java.util.*; -public class SavingAccountCollection { - - - List addressList; - - - // a setter method to set List - public void setAddressList(List addressList) { - this.addressList = addressList; - } - - // prints and returns all the elements of the list. - public List getAddressList() { - System.out.println("List Elements :" + addressList); - return addressList; - } - - -} - - - - - diff --git a/6SpringBank/src/main/java/model/SavingAccountM.java b/6SpringBank/src/main/java/model/SavingAccountM.java deleted file mode 100644 index 80983726..00000000 --- a/6SpringBank/src/main/java/model/SavingAccountM.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - */ -package model; - -/** - * @author trainee - * - */ -public class SavingAccountM { - - double balance=5000; - int accountNumber; - - final double interestRate = 0.07; - - static int id = 0; - Customer customer; - Statements statement; - /* - * @param balance - * @param accountNumber - * @param customer - */ - public SavingAccountM(double balance, Customer customer,Statements statement) { - super(); - this.balance = balance; -// this.accountNumber = ++id; - this.customer = customer; - this.statement=statement; - } - - - /** - * @return the statement - */ - public Statements getStatement() { - return statement; - } - - - /** - * @param statement the statement to set - */ - public void setStatement(Statements statement) { - this.statement = statement; - } - - - public SavingAccountM(double balance, Customer customer) { - super(); - this.balance = balance; - this.accountNumber = ++id; - this.customer = customer; - } - - - public SavingAccountM(double balance, int accountNumber) { - - this.balance = balance; - this.accountNumber = accountNumber; - - } - - public SavingAccountM() { - - } - - /** - * @return the balance - */ - public double getBalance() { - return balance; - } - - /** - * @param balance - * the balance to set - */ - public void setBalance(double balance) { - this.balance = balance; - } - - /** - * @return the accountNumber - */ - public int getAccountNumber() { - return accountNumber; - } - - /** - * @param accountNumber - * the accountNumber to set - */ - public void setAccountNumber(int accountNumber) { - this.accountNumber = accountNumber; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @return the interestRate - */ - public double getInterestRate() { - return interestRate; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SavingAccountM balance=" + balance + ", accountNumber=" + accountNumber - + ", interestRate=" + interestRate + ", customer=" + customer + ""; - } - -} diff --git a/6SpringBank/src/main/java/model/Statements.java b/6SpringBank/src/main/java/model/Statements.java deleted file mode 100644 index 34b3c282..00000000 --- a/6SpringBank/src/main/java/model/Statements.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package model; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; - -/** - * @author trainee - * - */ -public class Statements { - - - final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - final LocalDateTime now = LocalDateTime.now(); - - SavingAccountM listSaving = new SavingAccountM(); - - public void statement() - { - System.out.println("Balance in account number " + listSaving.getAccountNumber() + " is "+listSaving.balance +"" + dtf.format(now) ); - } - - -} - \ No newline at end of file diff --git a/6SpringBank/src/main/java/repository/AccountDaoCurrrent.java b/6SpringBank/src/main/java/repository/AccountDaoCurrrent.java deleted file mode 100644 index f4860678..00000000 --- a/6SpringBank/src/main/java/repository/AccountDaoCurrrent.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package repository; - -import model.CurrentAccountM; - -/** - * @author trainee - * - */ -public interface AccountDaoCurrrent { - - - - public CurrentAccountM Deposit1(double amount); - public CurrentAccountM Withdraw1(double amount); - - -} diff --git a/6SpringBank/src/main/java/repository/BankDaoImpl.java b/6SpringBank/src/main/java/repository/BankDaoImpl.java deleted file mode 100644 index b6a1b1e2..00000000 --- a/6SpringBank/src/main/java/repository/BankDaoImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package repository; - -import java.util.ArrayList; -import java.util.List; - -import model.Bank; - - - -/** - * @author trainee - * - */ -public class BankDaoImpl implements IBankDao { - - - public List addBank(Bank bank) { - final List list=new ArrayList(); - - list.add(bank); - // TODO Auto-generated method stub - return list; - - } - - - -} diff --git a/6SpringBank/src/main/java/repository/CurrentAccountImpl.java b/6SpringBank/src/main/java/repository/CurrentAccountImpl.java deleted file mode 100644 index cd80e5de..00000000 --- a/6SpringBank/src/main/java/repository/CurrentAccountImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - */ -package repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - - -import model.CurrentAccountM; -import model.Customer; -import model.SavingAccountM; - -/** - * @author ram dafale This class create a current account and perform basic - * deposit and witrdraw operations. - */ - class CurrentAccountImpl implements AccountDaoCurrrent { - - - - - - public CurrentAccountM Withdraw1(double amount) { - - CurrentAccountM currAccount = new CurrentAccountM(); - - double balance = currAccount.getBalance(); - - balance = balance - amount; - Date date = new Date(); - List list = new ArrayList(); - // list.add(date); - list.add("Amount withdraw from current account is" + amount); - return currAccount; - } - - public CurrentAccountM Deposit1(double amount) { - - CurrentAccountM currAccount = new CurrentAccountM(); - double balance = currAccount.getBalance(); - - balance = balance + amount; - Date date = new Date(); - List list = new ArrayList(); - list.add(date); - list.add("Amount Deposit from current account is" + amount); - return currAccount; - } - - - -} \ No newline at end of file diff --git a/6SpringBank/src/main/java/repository/CustomerDAOImpl.java b/6SpringBank/src/main/java/repository/CustomerDAOImpl.java deleted file mode 100644 index d5fef6d3..00000000 --- a/6SpringBank/src/main/java/repository/CustomerDAOImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - */ -package repository; - -import java.util.ArrayList; -import java.util.List; - -import model.Customer; - -/** - * @author trainee - * - */ -public class CustomerDAOImpl implements ICustomerDao -{ - - public List addCustomer(Customer customer) { - // TODO Auto-generated method stub - List list = new ArrayList(); - list.add(customer); - return list; - - } -} - diff --git a/6SpringBank/src/main/java/repository/IAccountDAO.java b/6SpringBank/src/main/java/repository/IAccountDAO.java deleted file mode 100644 index fa7cfa99..00000000 --- a/6SpringBank/src/main/java/repository/IAccountDAO.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.SavingAccountM; - -/** - * @author trainee - * - */ -public interface IAccountDAO { - - public SavingAccountM Deposit(double amount); - - public SavingAccountM Withdraw(double amount); - - // public List getStatment(List list); - -} diff --git a/6SpringBank/src/main/java/repository/IBankDao.java b/6SpringBank/src/main/java/repository/IBankDao.java deleted file mode 100644 index 08828369..00000000 --- a/6SpringBank/src/main/java/repository/IBankDao.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.Bank; - - - -/** - * @author trainee - * - */ -public interface IBankDao { - - public List addBank(Bank bank); - - -} diff --git a/6SpringBank/src/main/java/repository/ICustomerDao.java b/6SpringBank/src/main/java/repository/ICustomerDao.java deleted file mode 100644 index 2ff2963f..00000000 --- a/6SpringBank/src/main/java/repository/ICustomerDao.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.Customer; - - - - -/** - * @author trainee - * - */ -public interface ICustomerDao { - public List addCustomer(Customer customer); -} - - - diff --git a/6SpringBank/src/main/java/repository/SavingAccountImpl.java b/6SpringBank/src/main/java/repository/SavingAccountImpl.java deleted file mode 100644 index e4199e93..00000000 --- a/6SpringBank/src/main/java/repository/SavingAccountImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - */ -package repository; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; - -import model.SavingAccountM; - -/** - * @author trainee This class create a saving account and perform basic deposit and witrdraw - * operations. - */ -public class SavingAccountImpl implements IAccountDAO { - - public SavingAccountM Deposit(double amount) { - - SavingAccountM savingAccount = new SavingAccountM(); - - double balance = savingAccount.getBalance(); - System.out.println("Current Balance is :" + savingAccount.getBalance()); - balance = balance + amount; - // Date date = new Date(); - List list = new ArrayList(); - // list.add(date); - // list.add("Amount Deposit from saving account is" + amount); - System.out.println("Amount Deposit in saving account is" + amount); - System.out.println("Current Balance after deposit is : " + balance); - - - final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - final LocalDateTime now = LocalDateTime.now(); - System.out.println("Deposit made at Time "+dtf.format(now)); - - //System.out.println("Deposit amde at Time : " date.format(now)); - - return savingAccount; - } - - public SavingAccountM Withdraw(double amount) { - - SavingAccountM savingAccount = new SavingAccountM(); - - double balance = savingAccount.getBalance(); - System.out.println("Current Balance" + savingAccount.getBalance()); - - balance = balance - amount; - - System.out.println("Amount withdraw from saving account is" + amount); - System.out.println("Current Balance after withdrawl is : " + balance); - final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - final LocalDateTime now = LocalDateTime.now(); - System.out.println("Withdraw is made at Time "+dtf.format(now)); - return savingAccount; - } - -} diff --git a/6SpringBank/src/main/java/service/Account.java b/6SpringBank/src/main/java/service/Account.java deleted file mode 100644 index d8ebb80c..00000000 --- a/6SpringBank/src/main/java/service/Account.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * - */ -package service; - -/** - * @author trainee - * - */ -public interface Account { - - - public double Deposit(int amount); - public double Withdraw(int amount); - public void addInterest(); - - -} diff --git a/6SpringBank/src/main/java/service/AccountServiceImpl.java b/6SpringBank/src/main/java/service/AccountServiceImpl.java deleted file mode 100644 index 5924b0fe..00000000 --- a/6SpringBank/src/main/java/service/AccountServiceImpl.java +++ /dev/null @@ -1,55 +0,0 @@ - -package service; - - -import java.util.logging.Logger; - -import model.Customer; -import model.SavingAccountM; - - -/** - * @author trainee - * - */ -public class AccountServiceImpl implements IAccountService { - - final Logger logMe = Logger.getLogger(AccountServiceImpl.class.getName()); - - public IAccountDAO accountDao = new SavingAccountImpl(); - SavingAccountM aAct = new SavingAccountM(); - // Map list = new HashMap(); - - public SavingAccountM Withdraw(double amtToWithdraw) throws WithdrawException { - - if (amtToWithdraw > aAct.getBalance() ) { - - throw new WithdrawException("Insufficient Balance in your Account : Do deposit first ", aAct.getAccountNumber(), - aAct.getBalance()); - - - } else { - - // list=accountDao.Withdraw(amtToWithdraw); - - } - return aAct; - - } - - - - - - public SavingAccountM Deposit(double amount) { - - return null; - } - - - public void UpdateDetails(Customer customer, String checkAccountNumber, int newChange) { - // TODO Auto-generated method stub - - } - -} diff --git a/6SpringBank/src/main/java/service/BankServiceImpl.java b/6SpringBank/src/main/java/service/BankServiceImpl.java deleted file mode 100644 index a97131d1..00000000 --- a/6SpringBank/src/main/java/service/BankServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Bank; -import repository.IBankDao; - -/** - * @author trainee - * - */ -public class BankServiceImpl implements IBankService { - - public IBankDao bankDao; - - public BankServiceImpl() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankDao - */ - public BankServiceImpl(IBankDao bankDao) { - super(); - this.bankDao = bankDao; - } - - public List addBank(Bank bank) { - // TODO Auto-generated method stub - return bankDao.addBank(bank); - } - -} diff --git a/6SpringBank/src/main/java/service/CustomerServiceImpl.java b/6SpringBank/src/main/java/service/CustomerServiceImpl.java deleted file mode 100644 index c334d457..00000000 --- a/6SpringBank/src/main/java/service/CustomerServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package service; - -import java.util.List; - -import model.Customer; -import repository.CustomerDAOImpl; -import repository.ICustomerDao; - - -public class CustomerServiceImpl implements ICustomerService { - - - public ICustomerDao customerDao=new CustomerDAOImpl(); - - public List addCustomer(Customer customer) { - - return customerDao.addCustomer(customer); - -} -} diff --git a/6SpringBank/src/main/java/service/IAccountDAO.java b/6SpringBank/src/main/java/service/IAccountDAO.java deleted file mode 100644 index 4792ce4c..00000000 --- a/6SpringBank/src/main/java/service/IAccountDAO.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package service; - -import model.SavingAccountM; - -/** - * @author trainee - * - */ -public interface IAccountDAO { - - public SavingAccountM Deposit(double amount); - - public SavingAccountM Withdraw(double amount); - - // public List getStatment(List list); - -} diff --git a/6SpringBank/src/main/java/service/IAccountService.java b/6SpringBank/src/main/java/service/IAccountService.java deleted file mode 100644 index b5dc6366..00000000 --- a/6SpringBank/src/main/java/service/IAccountService.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * - */ -package service; - -import model.Customer; -import model.SavingAccountM; - -/** - * @author trainee - * - */ -public interface IAccountService { - SavingAccountM Deposit(double amount); - SavingAccountM Withdraw(double amount) throws WithdrawException; - void UpdateDetails(Customer customer, String checkAccountNumber, int newChange) ; -} diff --git a/6SpringBank/src/main/java/service/IBankService.java b/6SpringBank/src/main/java/service/IBankService.java deleted file mode 100644 index d5f59538..00000000 --- a/6SpringBank/src/main/java/service/IBankService.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Bank; - - - -/** - * @author trainee - * - */ -public interface IBankService { - - public List addBank(Bank bank); - - -} diff --git a/6SpringBank/src/main/java/service/ICustomerService.java b/6SpringBank/src/main/java/service/ICustomerService.java deleted file mode 100644 index 595ce070..00000000 --- a/6SpringBank/src/main/java/service/ICustomerService.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Customer; - - - -/** - * @author trainee - * - */ -public interface ICustomerService { - public List addCustomer(Customer customer); - -} diff --git a/6SpringBank/src/main/java/service/SavingAccountImpl.java b/6SpringBank/src/main/java/service/SavingAccountImpl.java deleted file mode 100644 index 2a152d8f..00000000 --- a/6SpringBank/src/main/java/service/SavingAccountImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - */ -package service; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; - -import model.SavingAccountM; - - -/** - * @author trainee This class create a saving account and perform basic deposit and withdraw - * operations. - */ -public class SavingAccountImpl implements IAccountDAO { - - public SavingAccountM Deposit(double amount) { - - SavingAccountM savingAccount = new SavingAccountM(); - - double balance = savingAccount.getBalance(); - System.out.println("Current Balance is :" + savingAccount.getBalance()); - balance = balance + amount; - // Date date = new Date(); - List list = new ArrayList(); - // list.add(date); - // list.add("Amount Deposit from saving account is" + amount); - System.out.println("Amount Deposit in saving account is" + amount); - System.out.println("Current Balance after deposit is : " + balance); - - - final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - final LocalDateTime now = LocalDateTime.now(); - System.out.println("Deposit made at Time "+dtf.format(now)); - - //System.out.println("Deposit amde at Time : " date.format(now)); - - return savingAccount; - } - - public SavingAccountM Withdraw(double amount) { - - SavingAccountM savingAccount = new SavingAccountM(); - - double balance = savingAccount.getBalance(); - System.out.println("Current Balance" + savingAccount.getBalance()); - - balance = balance - amount; - - System.out.println("Amount withdraw from saving account is" + amount); - System.out.println("Current Balance after withdrawl is : " + balance); - final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - final LocalDateTime now = LocalDateTime.now(); - System.out.println("Withdraw is made at Time "+dtf.format(now)); - return savingAccount; - } - -} diff --git a/6SpringBank/src/main/java/service/WithdrawException.java b/6SpringBank/src/main/java/service/WithdrawException.java deleted file mode 100644 index da1fc624..00000000 --- a/6SpringBank/src/main/java/service/WithdrawException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package service; - -/** - * @author trainee - * - */ -public class WithdrawException extends Exception { - - - - - public String message; - public String name; - public Double balance; - - - public WithdrawException(String message, int i, Double balance) - { - this.message = message; - // this.name = i; - this.balance = balance; - } - - - - - -} diff --git a/6SpringBank/src/main/resources/beans.xml b/6SpringBank/src/main/resources/beans.xml deleted file mode 100644 index 0edea518..00000000 --- a/6SpringBank/src/main/resources/beans.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - savingAccount1 - savingAccount2 - - - - - diff --git a/6SpringBank/src/test/java/junitpackage/BankAppJunit.java b/6SpringBank/src/test/java/junitpackage/BankAppJunit.java deleted file mode 100644 index 7508f553..00000000 --- a/6SpringBank/src/test/java/junitpackage/BankAppJunit.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Program Name: Test cases for abnk application using JUNIT - * @author Ram Dafale - * DateOF Completion : 4/42/2018 - */ -package junitpackage; - -import model.Customer; -import model.SavingAccountM; -import model.Statements; - - -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -/* - * class Name: BankAppJunit - * * Description : this class contains various test cases for bank application -* 1. Null values are not allowed in Name -* 2. Null values are not allowed in lASTnaME -* 3. Null values are not allowed in MOBILE NUMBER -* 4. checking if deposit method running or not -* 5. checking if withdraw method running or not -* 6. checking if addInterest method running or not -*/ -public class BankAppJunit { - - private final String str = null; - - // Creating a customer class object - final Customer cust = new Customer("ram", "dafale", "wardha", 97546545, "ramdafale@gmail.com"); - - // 1. Null values are not allowed in Name - @Test - public void checknullInFirstName() { - - assertNotEquals("null not allowed ", str, cust.getFname()); - } - - @Test - public void checknullInLastName() { - - assertNotEquals("null not allowed ", str, cust.getLname()); - } - - @Test - public void checknullInMobile() { - - assertNotEquals("null not allowed ", str, cust.getNumber()); - } - - Statements st = new Statements(); - service.SavingAccountImpl li = new service.SavingAccountImpl(); - SavingAccountM savingacc = new SavingAccountM(1000, cust, st); - private final double amount = 1000; - - @Test - public void testDeposit() { - // double balance =2000; - - SavingAccountM a = li.Deposit(amount); - assertTrue(savingacc.getBalance() == 1000); - } - - @Test - public void testWithdraw() { - - final SavingAccountM a = li.Withdraw(amount); - assertTrue(savingacc.getBalance() == 1000); - } - -} diff --git a/6SpringBank/target/classes/META-INF/MANIFEST.MF b/6SpringBank/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index 77e542dd..00000000 --- a/6SpringBank/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_162 -Created-By: Maven Integration for Eclipse - diff --git a/6SpringBank/target/classes/META-INF/maven/HelloSpring/HelloSpring1/pom.properties b/6SpringBank/target/classes/META-INF/maven/HelloSpring/HelloSpring1/pom.properties deleted file mode 100644 index 6ca3f9d7..00000000 --- a/6SpringBank/target/classes/META-INF/maven/HelloSpring/HelloSpring1/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Fri Apr 27 11:09:33 IST 2018 -version=0.0.1-SNAPSHOT -groupId=HelloSpring -m2e.projectName=SpringBank -m2e.projectLocation=C\:\\Users\\trainee\\Documents\\workspace-sts-3.9.3.RELEASE\\SpringBank -artifactId=HelloSpring1 diff --git a/6SpringBank/target/classes/META-INF/maven/HelloSpring/HelloSpring1/pom.xml b/6SpringBank/target/classes/META-INF/maven/HelloSpring/HelloSpring1/pom.xml deleted file mode 100644 index 4b815374..00000000 --- a/6SpringBank/target/classes/META-INF/maven/HelloSpring/HelloSpring1/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - 4.0.0 - - HelloSpring - HelloSpring1 - 0.0.1-SNAPSHOT - jar - - HelloSpring1 - http://maven.apache.org - - - UTF-8 - - - - - - - junit - junit - 4.12 - test - - - - - log4j - log4j - 1.2.17 - - - - org.springframework - spring-core - 4.3.5.RELEASE - - - - org.springframework - spring-beans - 4.3.5.RELEASE - - - org.springframework - spring-context - 4.3.5.RELEASE - - - - - - diff --git a/6SpringBank/target/classes/beans.xml b/6SpringBank/target/classes/beans.xml deleted file mode 100644 index 0edea518..00000000 --- a/6SpringBank/target/classes/beans.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - savingAccount1 - savingAccount2 - - - - - diff --git a/6SpringBank/target/classes/controller/App.class b/6SpringBank/target/classes/controller/App.class deleted file mode 100644 index 1b7d4df6..00000000 Binary files a/6SpringBank/target/classes/controller/App.class and /dev/null differ diff --git a/6SpringBank/target/classes/controller/BankController.class b/6SpringBank/target/classes/controller/BankController.class deleted file mode 100644 index 62d62b87..00000000 Binary files a/6SpringBank/target/classes/controller/BankController.class and /dev/null differ diff --git a/6SpringBank/target/classes/model/Bank.class b/6SpringBank/target/classes/model/Bank.class deleted file mode 100644 index 2d588b6b..00000000 Binary files a/6SpringBank/target/classes/model/Bank.class and /dev/null differ diff --git a/6SpringBank/target/classes/model/CurrentAccountM.class b/6SpringBank/target/classes/model/CurrentAccountM.class deleted file mode 100644 index be40bde9..00000000 Binary files a/6SpringBank/target/classes/model/CurrentAccountM.class and /dev/null differ diff --git a/6SpringBank/target/classes/model/Customer.class b/6SpringBank/target/classes/model/Customer.class deleted file mode 100644 index a3415716..00000000 Binary files a/6SpringBank/target/classes/model/Customer.class and /dev/null differ diff --git a/6SpringBank/target/classes/model/SavingAccountCollection.class b/6SpringBank/target/classes/model/SavingAccountCollection.class deleted file mode 100644 index 0adb1b3a..00000000 Binary files a/6SpringBank/target/classes/model/SavingAccountCollection.class and /dev/null differ diff --git a/6SpringBank/target/classes/model/SavingAccountM.class b/6SpringBank/target/classes/model/SavingAccountM.class deleted file mode 100644 index fd7c99ea..00000000 Binary files a/6SpringBank/target/classes/model/SavingAccountM.class and /dev/null differ diff --git a/6SpringBank/target/classes/model/Statements.class b/6SpringBank/target/classes/model/Statements.class deleted file mode 100644 index 336508aa..00000000 Binary files a/6SpringBank/target/classes/model/Statements.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/AccountDaoCurrrent.class b/6SpringBank/target/classes/repository/AccountDaoCurrrent.class deleted file mode 100644 index 4a0dca2d..00000000 Binary files a/6SpringBank/target/classes/repository/AccountDaoCurrrent.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/BankDaoImpl.class b/6SpringBank/target/classes/repository/BankDaoImpl.class deleted file mode 100644 index d790805d..00000000 Binary files a/6SpringBank/target/classes/repository/BankDaoImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/CurrentAccountImpl.class b/6SpringBank/target/classes/repository/CurrentAccountImpl.class deleted file mode 100644 index 4b038a65..00000000 Binary files a/6SpringBank/target/classes/repository/CurrentAccountImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/CustomerDAOImpl.class b/6SpringBank/target/classes/repository/CustomerDAOImpl.class deleted file mode 100644 index d0adaa6b..00000000 Binary files a/6SpringBank/target/classes/repository/CustomerDAOImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/IAccountDAO.class b/6SpringBank/target/classes/repository/IAccountDAO.class deleted file mode 100644 index 94a34184..00000000 Binary files a/6SpringBank/target/classes/repository/IAccountDAO.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/IBankDao.class b/6SpringBank/target/classes/repository/IBankDao.class deleted file mode 100644 index 0f3a5070..00000000 Binary files a/6SpringBank/target/classes/repository/IBankDao.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/ICustomerDao.class b/6SpringBank/target/classes/repository/ICustomerDao.class deleted file mode 100644 index 581bf268..00000000 Binary files a/6SpringBank/target/classes/repository/ICustomerDao.class and /dev/null differ diff --git a/6SpringBank/target/classes/repository/SavingAccountImpl.class b/6SpringBank/target/classes/repository/SavingAccountImpl.class deleted file mode 100644 index a482dd4e..00000000 Binary files a/6SpringBank/target/classes/repository/SavingAccountImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/Account.class b/6SpringBank/target/classes/service/Account.class deleted file mode 100644 index b76ea7c9..00000000 Binary files a/6SpringBank/target/classes/service/Account.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/AccountServiceImpl.class b/6SpringBank/target/classes/service/AccountServiceImpl.class deleted file mode 100644 index 866884aa..00000000 Binary files a/6SpringBank/target/classes/service/AccountServiceImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/BankServiceImpl.class b/6SpringBank/target/classes/service/BankServiceImpl.class deleted file mode 100644 index ec4052f9..00000000 Binary files a/6SpringBank/target/classes/service/BankServiceImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/CustomerServiceImpl.class b/6SpringBank/target/classes/service/CustomerServiceImpl.class deleted file mode 100644 index 27e0d1a7..00000000 Binary files a/6SpringBank/target/classes/service/CustomerServiceImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/IAccountDAO.class b/6SpringBank/target/classes/service/IAccountDAO.class deleted file mode 100644 index e6ffb239..00000000 Binary files a/6SpringBank/target/classes/service/IAccountDAO.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/IAccountService.class b/6SpringBank/target/classes/service/IAccountService.class deleted file mode 100644 index 40c636da..00000000 Binary files a/6SpringBank/target/classes/service/IAccountService.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/IBankService.class b/6SpringBank/target/classes/service/IBankService.class deleted file mode 100644 index a69611c6..00000000 Binary files a/6SpringBank/target/classes/service/IBankService.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/ICustomerService.class b/6SpringBank/target/classes/service/ICustomerService.class deleted file mode 100644 index 42d6a4de..00000000 Binary files a/6SpringBank/target/classes/service/ICustomerService.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/SavingAccountImpl.class b/6SpringBank/target/classes/service/SavingAccountImpl.class deleted file mode 100644 index 33d5bece..00000000 Binary files a/6SpringBank/target/classes/service/SavingAccountImpl.class and /dev/null differ diff --git a/6SpringBank/target/classes/service/WithdrawException.class b/6SpringBank/target/classes/service/WithdrawException.class deleted file mode 100644 index 92cbd8c2..00000000 Binary files a/6SpringBank/target/classes/service/WithdrawException.class and /dev/null differ diff --git a/6SpringBank/target/test-classes/junitpackage/BankAppJunit.class b/6SpringBank/target/test-classes/junitpackage/BankAppJunit.class deleted file mode 100644 index 5087dd67..00000000 Binary files a/6SpringBank/target/test-classes/junitpackage/BankAppJunit.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/.eclipse-pmd b/7SpringGettingDataFromJunit/.eclipse-pmd deleted file mode 100644 index 8c5b4482..00000000 --- a/7SpringGettingDataFromJunit/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/7SpringGettingDataFromJunit/.settings/org.eclipse.core.resources.prefs b/7SpringGettingDataFromJunit/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f9fe3459..00000000 --- a/7SpringGettingDataFromJunit/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/7SpringGettingDataFromJunit/.settings/org.eclipse.jdt.core.prefs b/7SpringGettingDataFromJunit/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2b81a1f2..00000000 --- a/7SpringGettingDataFromJunit/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,103 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.APILeak=warning -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning -org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled -org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/7SpringGettingDataFromJunit/.settings/org.eclipse.m2e.core.prefs b/7SpringGettingDataFromJunit/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/7SpringGettingDataFromJunit/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/7SpringGettingDataFromJunit/.springBeans b/7SpringGettingDataFromJunit/.springBeans deleted file mode 100644 index 8d2bcffd..00000000 --- a/7SpringGettingDataFromJunit/.springBeans +++ /dev/null @@ -1,16 +0,0 @@ - - - 1 - - - - - - - src/main/resources/applicationContext.xml - - - - - - diff --git a/7SpringGettingDataFromJunit/log4j.properties b/7SpringGettingDataFromJunit/log4j.properties deleted file mode 100644 index 8ce52e6a..00000000 --- a/7SpringGettingDataFromJunit/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -log4j.rootLogger=ERROR,stdout -log4j.logger.com.endeca=INFO -# Logger for crawl metrics -log4j.logger.com.endeca.itl.web.metrics=INFO - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n \ No newline at end of file diff --git a/7SpringGettingDataFromJunit/pom.xml b/7SpringGettingDataFromJunit/pom.xml deleted file mode 100644 index 52ef9764..00000000 --- a/7SpringGettingDataFromJunit/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - 4.0.0 - - com.bankspring - spring3 - 0.0.1-SNAPSHOT - jar - - spring3 - http://maven.apache.org - - - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.2 - - 1.8 - 1.8 - - - - - - - - - - org.springframework - spring-core - 5.0.5.RELEASE - - - - org.springframework - spring-beans - 5.0.5.RELEASE - - - junit - junit - 3.8.1 - test - - - junit - junit - 3.8.1 - test - - - diff --git a/7SpringGettingDataFromJunit/src/main/java/controller/Demo.java b/7SpringGettingDataFromJunit/src/main/java/controller/Demo.java deleted file mode 100644 index 3d0846e9..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/controller/Demo.java +++ /dev/null @@ -1,5 +0,0 @@ -package controller; - -public class Demo { - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/model/Account.java b/7SpringGettingDataFromJunit/src/main/java/model/Account.java deleted file mode 100644 index 4c435f19..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/model/Account.java +++ /dev/null @@ -1,126 +0,0 @@ -package model; - -import java.util.List; -/* - * @RamDafale - * - */ - -/* - * @Class this class is use to create a account of customer - * - */ -/** - * @author trainee - * - */ -public class Account { - - private String accountNo; - private double interestRate; - private double balance; - private int interestPeriod; - private List statementList; - private String typeOfAccount; - - public Account(final String accountNo, final double interestRate, final double balance, final int interestPeriod, - final List statementList, final String typeOfAccount) { - this.accountNo = accountNo; - this.interestRate = interestRate; - this.balance = balance; - this.interestPeriod = interestPeriod; - this.statementList = statementList; - this.typeOfAccount = typeOfAccount; - } - - /** - * @return the accountNo - */ - public String getAccountNo() { - return accountNo; - } - - /** - * @param accountNo - * the accountNo to set - */ - public void setAccountNo(String accountNo) { - this.accountNo = accountNo; - } - - /** - * @return the interestRate - */ - public double getInterestRate() { - return interestRate; - } - - /** - * @param interestRate - * the interestRate to set - */ - public void setInterestRate(int interestRate) { - this.interestRate = interestRate; - } - - /** - * @return the money - */ - public double getBalance() { - return balance; - } - - /** - * @param money - * the money to set - */ - public void setBalance(double money) { - this.balance = money; - } - - /** - * @return the interestPeriod - */ - public int getInterestPeriod() { - return interestPeriod; - } - - /** - * @param interestPeriod - * the interestPeriod to set - */ - public void setInterestPeriod(int interestPeriod) { - this.interestPeriod = interestPeriod; - } - - /** - * @return the statementList - */ - public List getStatementList() { - return statementList; - } - - /** - * @param statementList - * the statementList to set - */ - public void setStatementList(List statementList) { - this.statementList = statementList; - } - - /** - * @return the typeOfAccount - */ - public String getTypeOfAccount() { - return typeOfAccount; - } - - /** - * @param typeOfAccount - * the typeOfAccount to set - */ - public void setTypeOfAccount(String typeOfAccount) { - this.typeOfAccount = typeOfAccount; - } - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/model/Address.java b/7SpringGettingDataFromJunit/src/main/java/model/Address.java deleted file mode 100644 index b06838ec..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/model/Address.java +++ /dev/null @@ -1,57 +0,0 @@ -package model; - -/* - * @ramdafale - * - */ -public class Address { -/* -* Creating Address class for initializing address -* -*/ - - private String street; - private String houseNumber; - private String zipCode; - private String city; - - public Address(String street, String houseNumber, String zipCode, String city) { - super(); - this.street = street; - this.houseNumber = houseNumber; - this.zipCode = zipCode; - this.city = city; - } - - public String getStreet() { - return street; - } - public void setStreet(String street) { - this.street = street; - } - public String getHouseNumber() { - return houseNumber; - } - public void setHouseNumber(String houseNumber) { - this.houseNumber = houseNumber; - } - public String getZopCode() { - return zipCode; - } - public void setZopCode(String zopCode) { - this.zipCode = zopCode; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - - - - - - - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/model/Bank.java b/7SpringGettingDataFromJunit/src/main/java/model/Bank.java deleted file mode 100644 index a3382189..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/model/Bank.java +++ /dev/null @@ -1,38 +0,0 @@ -package model; - -import java.util.List; - -public class Bank { - - private String bankName; - List custom; - - - - public Bank(final String bankName, final List custom) { - this.bankName = bankName; - this.custom = custom; - } - - public List getCustomer() { - return custom; - } - - public void setCustomer(final List custom) { - this.custom = custom; - } - - public String getBankName() { - return bankName; - } - - public void setBankName(final String bankName) { - this.bankName = bankName; - } - - - - - - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/model/Contact.java b/7SpringGettingDataFromJunit/src/main/java/model/Contact.java deleted file mode 100644 index 5c8f8a5b..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/model/Contact.java +++ /dev/null @@ -1,58 +0,0 @@ -package model; - -/* - * ramdafale - * - */ -public class Contact { - /* - * Creating Contact clsass for initializing contact details - * - */ - - private Integer phoneNumber; - private int mobileNumber; - private String email; - Address addr; - - public Contact(final Integer phoneNumber, final int mobileNumber, final String email, final Address addr) { - super(); - this.phoneNumber = phoneNumber; - this.mobileNumber = mobileNumber; - this.email = email; - this.addr = addr; - } - - public Integer getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(final Integer phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public int getMobileNumber() { - return mobileNumber; - } - - public void setMobileNumber(final int mobileNumber) { - this.mobileNumber = mobileNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(final String email) { - this.email = email; - } - - public Address getAddr() { - return addr; - } - - public void setAddr(final Address addr) { - this.addr = addr; - } - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/model/Customer.java b/7SpringGettingDataFromJunit/src/main/java/model/Customer.java deleted file mode 100644 index b26ecc34..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/model/Customer.java +++ /dev/null @@ -1,57 +0,0 @@ -package model; - -import java.util.List; - - - - -public class Customer { - - private String firstname; - private String surname; - private Contact contobj; - private List accunlist; - private Integer customerId; - - - public Customer(final String firstname,final String surname,final Contact contobj,final List accunlist,final Integer customerId) { - this.firstname = firstname; - this.surname = surname; - this.contobj = contobj; - this.accunlist = accunlist; - this.customerId = customerId; - } - - public String getFirstname() { - return firstname; - } - public void setFirstname(final String firstname) { - this.firstname = firstname; - } - public String getSurname() { - return surname; - } - public void setSurname(final String surname) { - this.surname = surname; - } - public Contact getContobj() { - return contobj; - } - public void setContobj(final Contact contobj) { - this.contobj = contobj; - } - public List getAccunlist() { - return accunlist; - } - public void setAccunlist(final List accunlist) { - this.accunlist = accunlist; - } - public Integer getCustomerId() { - return customerId; - } - public void setCustomerId(final Integer customerId) { - this.customerId = customerId; - } - - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/model/Statement.java b/7SpringGettingDataFromJunit/src/main/java/model/Statement.java deleted file mode 100644 index b9dd2ba1..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/model/Statement.java +++ /dev/null @@ -1,44 +0,0 @@ -package model; - -import java.util.Date; - - -/* - *@ramdafale - */ -/* - * @Class Statements It is use to generate a statement for a customer at what time date - */ -public class Statement { - - - private Date date; - private String showmsg; - Account account; - /** - * @param date - * @param account - */ - public Statement(Date date, Account account,String showmsg) { - super(); - this.date = date; - this.account = account; - this.showmsg= showmsg; - } - - public Statement(Date date) { - super(); - this.date = date; - - } - - public Statement(String showmsg) { - super(); - this.showmsg=showmsg; - - } - - - - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/service/AccountImp.java b/7SpringGettingDataFromJunit/src/main/java/service/AccountImp.java deleted file mode 100644 index d13e6438..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/service/AccountImp.java +++ /dev/null @@ -1,102 +0,0 @@ -package service; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import model.Account; -import model.Contact; -import model.Customer; -import model.Statement; - -/* - * @author RamDafale - * - */ - -/* - * Implementing AccountService class to implements its services - */ -public class AccountImp implements AccountService { - - Account account; - Contact contact1; - - // For deposit - @Override - public void deposit(final Customer cust1, final String accountNo, final double val1) { - // TODO Auto-generated method stub - final List list1 = cust1.getAccunlist(); - - for (final Account acc1 : list1) { - - if (acc1.getAccountNo().equals(accountNo)) { - final double amount = acc1.getBalance() + val1; - acc1.setBalance(amount); - final Statement st = new Statement("Amount deposited successfully !!!"); - - final List list8 = new ArrayList<>(); - list8.add(st); - acc1.getStatementList().addAll(list8); - } - } - - } - - // For withdrawl - @Override - public void withdraw(final Customer cust2, final String accountNo, final double val2) { - // TODO Auto-generated method stub - - final List list1 = cust2.getAccunlist(); - - for (final Account acc1 : list1) { - - if (acc1.getAccountNo().equals(accountNo)) { - if (acc1.getBalance() >= val2) { - final double amount = acc1.getBalance() - val2; - acc1.setBalance(amount); - Statement st = new Statement("Amount debited successfully "); - - List list8 = new ArrayList<>(); - list8.add(st); - acc1.getStatementList().addAll(list8); - } else { - final double amount1 = acc1.getBalance(); - acc1.setBalance(amount1); - } - } - } - - } - - // For deleting account - @Override - public void deleteAccount(Customer cust3, String accountNo) { - - List list5 = cust3.getAccunlist(); - - Iterator itr = list5.iterator(); - - while (itr.hasNext()) { - account = (Account) itr.next(); - if (account.getAccountNo().equals(accountNo)) { - - itr.remove(); - break; - } - - } - - } - - // For updating mobile number - @Override - public void update(Customer cust4, String accountNo, int moNo) { - - Contact cont = cust4.getContobj(); - cont.setMobileNumber(moNo); - - } - -} diff --git a/7SpringGettingDataFromJunit/src/main/java/service/AccountService.java b/7SpringGettingDataFromJunit/src/main/java/service/AccountService.java deleted file mode 100644 index 5b2cb1d6..00000000 --- a/7SpringGettingDataFromJunit/src/main/java/service/AccountService.java +++ /dev/null @@ -1,18 +0,0 @@ -package service; - -import model.Customer; -/* - * @Interface this interface provide a definition to operations such as deposit, - * withdraw, deleteAccount, update - */ -public interface AccountService { - - public void deposit(Customer cust1, String accountNo, double val1); - - public void withdraw(Customer cust2, String accountNo, double val2); - - public void deleteAccount(Customer cust3, String accountNo); - - public void update(Customer cut4, String accountNo, int num); - -} diff --git a/7SpringGettingDataFromJunit/src/main/resources/applicationContext.xml b/7SpringGettingDataFromJunit/src/main/resources/applicationContext.xml deleted file mode 100644 index 87fa5071..00000000 --- a/7SpringGettingDataFromJunit/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/7SpringGettingDataFromJunit/src/test/java/com/bankspring/spring3/JunitTest.java b/7SpringGettingDataFromJunit/src/test/java/com/bankspring/spring3/JunitTest.java deleted file mode 100644 index 4241b433..00000000 --- a/7SpringGettingDataFromJunit/src/test/java/com/bankspring/spring3/JunitTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.bankspring.spring3; - -import static org.junit.Assert.assertEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Test; - -import model.Account; -import model.Address; -import model.Bank; -import model.Contact; -import model.Customer; -import model.Statement; -import service.AccountImp; -import service.AccountService; - -public class JunitTest { - - AccountService accObj = new AccountImp(); - - // Testing deposit amount method - @Test - public void checkDeposit() { - - final Address address1 = new Address("Nagpur Road", "100", "442001", "Wardha"); - final Contact contact1 = new Contact(976651485, 0715225, "ramdafale@gmail.com", address1); - final Statement statement1 = new Statement("Saving account created Succesfully !!!"); - - final List statementList = new ArrayList<>(); - statementList.add(statement1); - - final Account acc = new Account("111", 0.07, 5555, 5, statementList, "SavingType"); - - final List accountList = new ArrayList<>(); - accountList.add(acc); - - final Customer cust1 = new Customer("Ram", "Dafale", contact1, accountList, 1); - List list6 = new ArrayList<>(); - - list6.add(cust1); - - Bank bank1 = new Bank("CapgBank", list6); - - - accObj.deposit(cust1, "111", 1000); - assertEquals("test case", 6555, acc.getBalance(), 3); - - } - - // Testing withdraw amount method - @Test - public void checkWithdraw() { - final Address address2 = new Address("Wardha Road", "100", "442001", "Wardha"); - final Contact contact = new Contact(9865452, 9584615, "shyamdafale@gmail.com", address2); - final Statement statement = new Statement("Saving account created Successfully"); - final List list2 = new ArrayList<>(); - list2.add(statement); - final Account acc = new Account("112", 0.07, 6000, 12, list2, "Saving"); - final List list3 = new ArrayList<>(); - list3.add(acc); - final Customer cust1 = new Customer("", "Jais", contact, list3, 1); - List list6 = new ArrayList<>(); - list6.add(cust1); - Bank bank1 = new Bank("CapgBank", list6); - - accObj.withdraw(cust1, "112", 3000); - assertEquals("test case", 3000, acc.getBalance(), 3); - - } - - // Update Mobile Number - @Test - public void checkUpdate() { - final Address address1 = new Address("Nagpur Road", "100", "442001", "Wardha"); - final Contact contact1 = new Contact(976651485, 0715225, "ramdafale@gmail.com", address1); - final Statement statement1 = new Statement("Saving account created Succesfully !!!"); - - final List statementList = new ArrayList<>(); - statementList.add(statement1); - - final Account acc = new Account("111", 0.07, 5555, 5, statementList, "SavingType"); - - final List accountList = new ArrayList<>(); - accountList.add(acc); - - final Customer cust1 = new Customer("Ram", "Dafale", contact1, accountList, 1); - List list6 = new ArrayList<>(); - - list6.add(cust1); - - Bank bank1 = new Bank("CapgBank", list6); - - accObj.update(cust1, "112", 000001); - assertEquals(000001, contact1.getMobileNumber()); - - } - - // Delete My Account - @Test - public void checkDelete() { - final Address address = new Address("Nagpur Road", "102", "442012", "Delhi"); - final Contact contact = new Contact(984515, 4575678, "mymail@gmail.com", address); - final Statement stat = new Statement("Saving account created Succesfully !!!"); - final Statement stat1 = new Statement("Saving account created Succesfully !!!"); - final List list2 = new ArrayList<>(); - final List list4 = new ArrayList<>(); - list2.add(stat); - list4.add(stat1); - final Account acc = new Account("1", 11, 4000, 5, list2, "Saving"); - final Account acc1 = new Account("2", 12, 5000, 5, list4, "Saving"); - final List list3 = new ArrayList<>(); - list3.add(acc); - list3.add(acc1); - final Customer cust1 = new Customer("emaual", "kaif", contact, list3, 1); - List list6 = new ArrayList<>(); - list6.add(cust1); - Bank bank1 = new Bank("CapgBank", list6); - - accObj.deleteAccount(cust1, "1"); - assertEquals("test case", 1, cust1.getAccunlist().size()); - - } - -} diff --git a/7SpringGettingDataFromJunit/target/classes/META-INF/MANIFEST.MF b/7SpringGettingDataFromJunit/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/7SpringGettingDataFromJunit/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/7SpringGettingDataFromJunit/target/classes/META-INF/maven/com.bankspring/spring3/pom.properties b/7SpringGettingDataFromJunit/target/classes/META-INF/maven/com.bankspring/spring3/pom.properties deleted file mode 100644 index 7ffb95a0..00000000 --- a/7SpringGettingDataFromJunit/target/classes/META-INF/maven/com.bankspring/spring3/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Fri Apr 27 18:07:50 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.bankspring -m2e.projectName=spring3 -m2e.projectLocation=D\:\\Users\\trainee\\Desktop\\trainingProgram-master\\src\\April-26\\spring3 -artifactId=spring3 diff --git a/7SpringGettingDataFromJunit/target/classes/META-INF/maven/com.bankspring/spring3/pom.xml b/7SpringGettingDataFromJunit/target/classes/META-INF/maven/com.bankspring/spring3/pom.xml deleted file mode 100644 index 52ef9764..00000000 --- a/7SpringGettingDataFromJunit/target/classes/META-INF/maven/com.bankspring/spring3/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - 4.0.0 - - com.bankspring - spring3 - 0.0.1-SNAPSHOT - jar - - spring3 - http://maven.apache.org - - - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.2 - - 1.8 - 1.8 - - - - - - - - - - org.springframework - spring-core - 5.0.5.RELEASE - - - - org.springframework - spring-beans - 5.0.5.RELEASE - - - junit - junit - 3.8.1 - test - - - junit - junit - 3.8.1 - test - - - diff --git a/7SpringGettingDataFromJunit/target/classes/applicationContext.xml b/7SpringGettingDataFromJunit/target/classes/applicationContext.xml deleted file mode 100644 index 87fa5071..00000000 --- a/7SpringGettingDataFromJunit/target/classes/applicationContext.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/7SpringGettingDataFromJunit/target/classes/controller/Demo.class b/7SpringGettingDataFromJunit/target/classes/controller/Demo.class deleted file mode 100644 index 409ef0d2..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/controller/Demo.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/model/Account.class b/7SpringGettingDataFromJunit/target/classes/model/Account.class deleted file mode 100644 index acd48739..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/model/Account.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/model/Address.class b/7SpringGettingDataFromJunit/target/classes/model/Address.class deleted file mode 100644 index 01178ed8..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/model/Address.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/model/Bank.class b/7SpringGettingDataFromJunit/target/classes/model/Bank.class deleted file mode 100644 index 2bb70568..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/model/Bank.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/model/Contact.class b/7SpringGettingDataFromJunit/target/classes/model/Contact.class deleted file mode 100644 index 8f48f189..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/model/Contact.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/model/Customer.class b/7SpringGettingDataFromJunit/target/classes/model/Customer.class deleted file mode 100644 index e2fc2027..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/model/Customer.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/model/Statement.class b/7SpringGettingDataFromJunit/target/classes/model/Statement.class deleted file mode 100644 index 35672145..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/model/Statement.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/service/AccountImp.class b/7SpringGettingDataFromJunit/target/classes/service/AccountImp.class deleted file mode 100644 index f82924fc..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/service/AccountImp.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/classes/service/AccountService.class b/7SpringGettingDataFromJunit/target/classes/service/AccountService.class deleted file mode 100644 index 35e3c25f..00000000 Binary files a/7SpringGettingDataFromJunit/target/classes/service/AccountService.class and /dev/null differ diff --git a/7SpringGettingDataFromJunit/target/test-classes/com/bankspring/spring3/JunitTest.class b/7SpringGettingDataFromJunit/target/test-classes/com/bankspring/spring3/JunitTest.class deleted file mode 100644 index 53a50f16..00000000 Binary files a/7SpringGettingDataFromJunit/target/test-classes/com/bankspring/spring3/JunitTest.class and /dev/null differ diff --git a/8SuperMarketxml/.settings/org.eclipse.core.resources.prefs b/8SuperMarketxml/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/8SuperMarketxml/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/8SuperMarketxml/.settings/org.eclipse.jdt.core.prefs b/8SuperMarketxml/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index ec4300d5..00000000 --- a/8SuperMarketxml/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/8SuperMarketxml/MydatabaseQueries.txt b/8SuperMarketxml/MydatabaseQueries.txt deleted file mode 100644 index 0c560094..00000000 --- a/8SuperMarketxml/MydatabaseQueries.txt +++ /dev/null @@ -1,47 +0,0 @@ -create database mydb; - - -CREATE TABLE Customer ( - customerId int primary key auto_increment, - customerName varchar(255), - customerAddress varchar(255), - paymentMode varchar(20) -); - - - - - - - - - - -CREATE TABLE `mydb1`.`goods` ( - `goodsId` INT NOT NULL AUTO_INCREMENT, - `goodsName` VARCHAR(45) NOT NULL, - `goodsQuantity` VARCHAR(45) NOT NULL, - `goodsPrice` VARCHAR(45) NOT NULL, - PRIMARY KEY (`goodsId`)); - - - - - - - -CREATE TABLE `mydb1`.`supplier` ( - `supplierId` INT NOT NULL AUTO_INCREMENT, - `supplierName` VARCHAR(45) NOT NULL, - `supplierAddress` VARCHAR(45) NOT NULL, - `quantityOrder` INT NOT NULL, - `orderId` INT NOT NULL, - `amount` DOUBLE NOT NULL, - PRIMARY KEY (`supplierId`)); - - - -CREATE TABLE `mydb1`.`retailer` ( - `retailerName` VARCHAR(25) NOT NULL, - `retailerAddress` VARCHAR(45) NOT NULL, - PRIMARY KEY (`retailerName`)); diff --git a/8SuperMarketxml/bin/MydatabaseQueries.txt b/8SuperMarketxml/bin/MydatabaseQueries.txt deleted file mode 100644 index 0c560094..00000000 --- a/8SuperMarketxml/bin/MydatabaseQueries.txt +++ /dev/null @@ -1,47 +0,0 @@ -create database mydb; - - -CREATE TABLE Customer ( - customerId int primary key auto_increment, - customerName varchar(255), - customerAddress varchar(255), - paymentMode varchar(20) -); - - - - - - - - - - -CREATE TABLE `mydb1`.`goods` ( - `goodsId` INT NOT NULL AUTO_INCREMENT, - `goodsName` VARCHAR(45) NOT NULL, - `goodsQuantity` VARCHAR(45) NOT NULL, - `goodsPrice` VARCHAR(45) NOT NULL, - PRIMARY KEY (`goodsId`)); - - - - - - - -CREATE TABLE `mydb1`.`supplier` ( - `supplierId` INT NOT NULL AUTO_INCREMENT, - `supplierName` VARCHAR(45) NOT NULL, - `supplierAddress` VARCHAR(45) NOT NULL, - `quantityOrder` INT NOT NULL, - `orderId` INT NOT NULL, - `amount` DOUBLE NOT NULL, - PRIMARY KEY (`supplierId`)); - - - -CREATE TABLE `mydb1`.`retailer` ( - `retailerName` VARCHAR(25) NOT NULL, - `retailerAddress` VARCHAR(45) NOT NULL, - PRIMARY KEY (`retailerName`)); diff --git a/8SuperMarketxml/bin/pom.xml b/8SuperMarketxml/bin/pom.xml deleted file mode 100644 index cebcfbed..00000000 --- a/8SuperMarketxml/bin/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/8SuperMarketxml/bin/retailShopDB.mwb b/8SuperMarketxml/bin/retailShopDB.mwb deleted file mode 100644 index f663073c..00000000 Binary files a/8SuperMarketxml/bin/retailShopDB.mwb and /dev/null differ diff --git a/8SuperMarketxml/bin/retailShopDB.mwb.bak b/8SuperMarketxml/bin/retailShopDB.mwb.bak deleted file mode 100644 index 0a194377..00000000 Binary files a/8SuperMarketxml/bin/retailShopDB.mwb.bak and /dev/null differ diff --git a/8SuperMarketxml/bin/src/applicationContext.xml b/8SuperMarketxml/bin/src/applicationContext.xml deleted file mode 100644 index bfd26546..00000000 --- a/8SuperMarketxml/bin/src/applicationContext.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/8SuperMarketxml/bin/src/main/java/controller/GroceryMain.class b/8SuperMarketxml/bin/src/main/java/controller/GroceryMain.class deleted file mode 100644 index bb7e47d8..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/controller/GroceryMain.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/model/Customer.class b/8SuperMarketxml/bin/src/main/java/model/Customer.class deleted file mode 100644 index a2fa1e08..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/model/Customer.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/model/Goods.class b/8SuperMarketxml/bin/src/main/java/model/Goods.class deleted file mode 100644 index 8ce8fe42..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/model/Goods.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/model/Retailer.class b/8SuperMarketxml/bin/src/main/java/model/Retailer.class deleted file mode 100644 index 006b70d6..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/model/Retailer.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/model/Supplier.class b/8SuperMarketxml/bin/src/main/java/model/Supplier.class deleted file mode 100644 index d2d9956f..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/model/Supplier.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/CustomerDAO.class b/8SuperMarketxml/bin/src/main/java/repository/CustomerDAO.class deleted file mode 100644 index 48bfc15c..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/CustomerDAO.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/CustomerDAOImpl.class b/8SuperMarketxml/bin/src/main/java/repository/CustomerDAOImpl.class deleted file mode 100644 index ef8ba457..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/CustomerDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/GoodsDAO.class b/8SuperMarketxml/bin/src/main/java/repository/GoodsDAO.class deleted file mode 100644 index 3591ad50..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/GoodsDAO.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/GoodsDAOImpl.class b/8SuperMarketxml/bin/src/main/java/repository/GoodsDAOImpl.class deleted file mode 100644 index 751b0db3..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/GoodsDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/RetailerDAO.class b/8SuperMarketxml/bin/src/main/java/repository/RetailerDAO.class deleted file mode 100644 index 2e9bede2..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/RetailerDAO.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/RetailerDAOImpl.class b/8SuperMarketxml/bin/src/main/java/repository/RetailerDAOImpl.class deleted file mode 100644 index f7c1164e..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/RetailerDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/SupplierDAO.class b/8SuperMarketxml/bin/src/main/java/repository/SupplierDAO.class deleted file mode 100644 index 24ed59b5..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/SupplierDAO.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/repository/SupplierDAOImpl.class b/8SuperMarketxml/bin/src/main/java/repository/SupplierDAOImpl.class deleted file mode 100644 index 9ed93047..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/repository/SupplierDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/service/CustomerService.class b/8SuperMarketxml/bin/src/main/java/service/CustomerService.class deleted file mode 100644 index 6ac864e2..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/service/CustomerService.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/service/CustomerServiceImpl.class b/8SuperMarketxml/bin/src/main/java/service/CustomerServiceImpl.class deleted file mode 100644 index 056e7556..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/service/CustomerServiceImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/service/GoodsSeriveImpl.class b/8SuperMarketxml/bin/src/main/java/service/GoodsSeriveImpl.class deleted file mode 100644 index 610d7cc1..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/service/GoodsSeriveImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/service/GoodsService.class b/8SuperMarketxml/bin/src/main/java/service/GoodsService.class deleted file mode 100644 index 858a3725..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/service/GoodsService.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/service/SupplierService.class b/8SuperMarketxml/bin/src/main/java/service/SupplierService.class deleted file mode 100644 index 4d163d71..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/service/SupplierService.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/java/service/SupplierServiceImpl.class b/8SuperMarketxml/bin/src/main/java/service/SupplierServiceImpl.class deleted file mode 100644 index 6d0fe1fb..00000000 Binary files a/8SuperMarketxml/bin/src/main/java/service/SupplierServiceImpl.class and /dev/null differ diff --git a/8SuperMarketxml/bin/src/main/resources/applicationContext.xml b/8SuperMarketxml/bin/src/main/resources/applicationContext.xml deleted file mode 100644 index c4390341..00000000 --- a/8SuperMarketxml/bin/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/8SuperMarketxml/bin/src/test/java/com/training/groceryApp/AppTest.class b/8SuperMarketxml/bin/src/test/java/com/training/groceryApp/AppTest.class deleted file mode 100644 index 8ae4c103..00000000 Binary files a/8SuperMarketxml/bin/src/test/java/com/training/groceryApp/AppTest.class and /dev/null differ diff --git a/8SuperMarketxml/bin/target/classes/META-INF/MANIFEST.MF b/8SuperMarketxml/bin/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/8SuperMarketxml/bin/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/8SuperMarketxml/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.properties b/8SuperMarketxml/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.properties deleted file mode 100644 index f3b7de0c..00000000 --- a/8SuperMarketxml/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Mon Apr 30 12:17:07 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.training -m2e.projectName=SuperMarket -m2e.projectLocation=D\:\\Users\\trainee\\Desktop\\SuperMarket -artifactId=groceryApp diff --git a/8SuperMarketxml/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.xml b/8SuperMarketxml/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.xml deleted file mode 100644 index cebcfbed..00000000 --- a/8SuperMarketxml/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/8SuperMarketxml/bin/target/classes/applicationContext.xml b/8SuperMarketxml/bin/target/classes/applicationContext.xml deleted file mode 100644 index c4390341..00000000 --- a/8SuperMarketxml/bin/target/classes/applicationContext.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/8SuperMarketxml/pom.xml b/8SuperMarketxml/pom.xml deleted file mode 100644 index cebcfbed..00000000 --- a/8SuperMarketxml/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/8SuperMarketxml/retailShopDB.mwb b/8SuperMarketxml/retailShopDB.mwb deleted file mode 100644 index f663073c..00000000 Binary files a/8SuperMarketxml/retailShopDB.mwb and /dev/null differ diff --git a/8SuperMarketxml/retailShopDB.mwb.bak b/8SuperMarketxml/retailShopDB.mwb.bak deleted file mode 100644 index 0a194377..00000000 Binary files a/8SuperMarketxml/retailShopDB.mwb.bak and /dev/null differ diff --git a/8SuperMarketxml/src/applicationContext.xml b/8SuperMarketxml/src/applicationContext.xml deleted file mode 100644 index 030fae19..00000000 --- a/8SuperMarketxml/src/applicationContext.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/8SuperMarketxml/src/main/java/controller/GroceryMain.class b/8SuperMarketxml/src/main/java/controller/GroceryMain.class deleted file mode 100644 index d027b9bb..00000000 Binary files a/8SuperMarketxml/src/main/java/controller/GroceryMain.class and /dev/null differ diff --git a/8SuperMarketxml/src/main/java/controller/GroceryMain.java b/8SuperMarketxml/src/main/java/controller/GroceryMain.java deleted file mode 100644 index 984dccfd..00000000 --- a/8SuperMarketxml/src/main/java/controller/GroceryMain.java +++ /dev/null @@ -1,153 +0,0 @@ -package controller; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.jdbc.core.JdbcTemplate; - -import model.Customer; -import model.Retailer; - -import repository.CustomerDAOImpl; -import repository.GoodsDAOImpl; -import repository.RetailerDAO; -import repository.RetailerDAOImpl; -import repository.SupplierDAOImpl; -import service.GoodsService; - -/** - * @author Ram - * - */ -public class GroceryMain { - - public static void main(String[] args) { - ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); - //JdbcTemplate jdbcTemplate = (JdbcTemplate) context.getBean("dataSource"); - - CustomerDAOImpl dao=(CustomerDAOImpl) context.getBean("cdao"); - - - /* int status=dao.addCustomer(new Customer(106,"Amit","amravati","debit card")); - System.out.println(status); - - */ - - - /* int status1=dao.updateCustomer(104,"Mahesh"); - System.out.println(status1); */ - - - - - - // Customer e=new Customer(); - // e.setCustomerId(520); - /* - int status2=dao.removeCustomer(104); - - System.out.println(status2); - - - */ - - GoodsDAOImpl gdao =(GoodsDAOImpl) context.getBean("gdao"); //goods bean + jdbc template - - /* - //@ add goods - int status3 = gdao.addGoods(12, "Doodle", 5, 50.12); - System.out.println(status3); - - int status4 = gdao.addGoods(13, "Soap", 5, 250.12); - System.out.println(status4); - */ - - /* - //@remove goods - int status4 = gdao.removeGoods(12); - System.out.println(status4); - - */ - /* - //@update goods - int status5 = gdao.updateGoods(12,"Pen"); - System.out.println(status5); - */ - - - SupplierDAOImpl sdao =(SupplierDAOImpl) context.getBean("sdao"); //goods bean + jdbc template - - - /* //@ add supplier - int status6 = sdao.addSupplier(22, "ram saheb", "wardha", 12, 211, 21211.2); - System.out.println(status6); - */ - - /* - //@remove supplier - int status7 = sdao.removeSupplier(21); - System.out.println(status7); - - */ - - - - //@update supplier - - - //int status8 = sdao.updateSupplier(22, "Prateek saheb", "Amravati", 121, 211, 2011.2); - //int status8 = sdao.updateSupplier(22, "Prateek saheb"); - //System.out.println(status8); - - - RetailerDAOImpl rdao =(RetailerDAOImpl) context.getBean("rdao"); - - - - /* //@ add supplier - int status9 = rdao.addRetailer("jasonRoy","England"); - System.out.println(status9); - */ - - - //rdao.viewCustomer(106); - //rdao.getAllGoods(); - rdao.viewSupplier(22); - - - } - -} - - - - - - - - - - - - - /*GoodsService goodsService = null; - int dummy = goodsService.addGoods(1, "soap", 4, 20.0); - System.out.println(dummy); - - CustomerDAO customerDAO = context.getBean(CustomerDAO.class); - RetailerDAO retailer = context.getBean(RetailerDAO.class); - - - System.out.println("List of Goods is:"); - - for (Retailer p : retailer.viewGoods()) { - - System.out.println(p); - } - */ - - - - - - - diff --git a/8SuperMarketxml/src/main/java/model/Customer.java b/8SuperMarketxml/src/main/java/model/Customer.java deleted file mode 100644 index 58b5caf9..00000000 --- a/8SuperMarketxml/src/main/java/model/Customer.java +++ /dev/null @@ -1,99 +0,0 @@ -package model; - -import java.util.List; - -/** - * @author Ram - * - */ -public class Customer { - - private int customerId; - private String customerName; - private String customerAddress; - private String paymentMode; - - /** - * @param customerId - * @param customerName - * @param customerAddress - * @param paymentMode - */ - public Customer(int customerId, String customerName, String customerAddress, String paymentMode) { - this.customerId = customerId; - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - } - - public Customer(String customerName) { - this.customerId = customerId; - this.customerName = customerName; - - } - - public Customer() { - - } - - /** - * @return the customerId - */ - public int getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(int customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - - /** - * @param customerAddress - * the customerAddress to set - */ - public void setCustomerAddress(String customerAddress) { - this.customerAddress = customerAddress; - } - - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - - /** - * @param paymentMode - * the paymentMode to set - */ - public void setPaymentMode(String paymentMode) { - this.paymentMode = paymentMode; - } - -} diff --git a/8SuperMarketxml/src/main/java/model/Goods.java b/8SuperMarketxml/src/main/java/model/Goods.java deleted file mode 100644 index 77b19f9d..00000000 --- a/8SuperMarketxml/src/main/java/model/Goods.java +++ /dev/null @@ -1,88 +0,0 @@ -package model; - -public class Goods { - - private int goodsId; - private String goodsName; - private int goodsQuantity; - private double goodsPrice; - - /** - * @param goodsId - * @param goodsName - * @param goodsQuantity - * @param goodsPrice - */ - public Goods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - this.goodsId = goodsId; - this.goodsName = goodsName; - this.goodsQuantity = goodsQuantity; - this.goodsPrice = goodsPrice; - } - - public Goods() { - // TODO Auto-generated constructor stub - } - - /** - * @return the goodsId - */ - public int getGoodsId() { - return goodsId; - } - - /** - * @param goodsId - * the goodsId to set - */ - public void setGoodsId(int goodsId) { - this.goodsId = goodsId; - } - - /** - * @return the goodsName - */ - public String getGoodsName() { - return goodsName; - } - - /** - * @param goodsName - * the goodsName to set - */ - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - - /** - * @return the goodsQuantity - */ - public int getGoodsQuantity() { - return goodsQuantity; - } - - /** - * @param goodsQuantity - * the goodsQuantity to set - */ - public void setGoodsQuantity(int goodsQuantity) { - this.goodsQuantity = goodsQuantity; - } - - /** - * @return the goodsPrice - */ - public double getGoodsPrice() { - return goodsPrice; - } - - /** - * @param goodsPrice - * the goodsPrice to set - */ - public void setGoodsPrice(double goodsPrice) { - this.goodsPrice = goodsPrice; - } - -} diff --git a/8SuperMarketxml/src/main/java/model/Retailer.java b/8SuperMarketxml/src/main/java/model/Retailer.java deleted file mode 100644 index 19054d91..00000000 --- a/8SuperMarketxml/src/main/java/model/Retailer.java +++ /dev/null @@ -1,56 +0,0 @@ - -package model; - -/** - * @author Ram - * - */ -public class Retailer { - - private String retailerName; - private String retailerAddres; - /** - * @param retailerName - * @param retailerAddres - */ - public Retailer(String retailerName, String retailerAddres) { - this.retailerName = retailerName; - this.retailerAddres = retailerAddres; - } - - public Retailer() { - // TODO Auto-generated constructor stub - } - - /** - * @return the retailerName - */ - public String getRetailerName() { - return retailerName; - } - - /** - * @param retailerName - * the retailerName to set - */ - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - /** - * @return the retailerAddres - */ - public String getRetailerAddres() { - return retailerAddres; - } - - /** - * @param retailerAddres - * the retailerAddres to set - */ - public void setRetailerAddres(String retailerAddres) { - this.retailerAddres = retailerAddres; - } - - -} diff --git a/8SuperMarketxml/src/main/java/model/Supplier.java b/8SuperMarketxml/src/main/java/model/Supplier.java deleted file mode 100644 index ca55f40a..00000000 --- a/8SuperMarketxml/src/main/java/model/Supplier.java +++ /dev/null @@ -1,158 +0,0 @@ -package model; - -import java.util.List; - -/** - * @author Sumit - * - */ -public class Supplier { - - private int supplierId; - private String supplierName; - private String supplierAddress; - private int quantityOrder; - private int orderId; - private double amount; - List goodsList; - - /** - * @param supplierId - * @param supplierName - * @param supplierAddress - * @param quantityOrder - * @param orderId - * @param amount - * @param goodsList - */ - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount, List goodsList) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - this.goodsList = goodsList; - } - - public Supplier() { - // TODO Auto-generated constructor stub - } - - public Supplier(int i, String string, String string2, int j, int k, double d) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - } - - /** - * @return the supplierId - */ - public int getSupplierId() { - return supplierId; - } - - /** - * @param supplierId - * the supplierId to set - */ - public void setSupplierId(int supplierId) { - this.supplierId = supplierId; - } - - /** - * @return the supplierName - */ - public String getSupplierName() { - return supplierName; - } - - /** - * @param supplierName - * the supplierName to set - */ - public void setSupplierName(String supplierName) { - this.supplierName = supplierName; - } - - /** - * @return the supplierAddress - */ - public String getSupplierAddress() { - return supplierAddress; - } - - /** - * @param supplierAddress - * the supplierAddress to set - */ - public void setSupplierAddress(String supplierAddress) { - this.supplierAddress = supplierAddress; - } - - /** - * @return the quantityOrder - */ - public int getQuantityOrder() { - return quantityOrder; - } - - /** - * @param quantityOrder - * the quantityOrder to set - */ - public void setQuantityOrder(int quantityOrder) { - this.quantityOrder = quantityOrder; - } - - /** - * @return the orderId - */ - public int getOrderId() { - return orderId; - } - - /** - * @param orderId - * the orderId to set - */ - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - /** - * @return the amount - */ - public double getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(double amount) { - this.amount = amount; - } - - /** - * @return the goodsList - */ - public List getGoodsList() { - return goodsList; - } - - /** - * @param goodsList - * the goodsList to set - */ - public void setGoodsList(List goodsList) { - this.goodsList = goodsList; - } - -} diff --git a/8SuperMarketxml/src/main/java/repository/CustomerDAO.java b/8SuperMarketxml/src/main/java/repository/CustomerDAO.java deleted file mode 100644 index f6c8f8b9..00000000 --- a/8SuperMarketxml/src/main/java/repository/CustomerDAO.java +++ /dev/null @@ -1,11 +0,0 @@ -package repository; - -import model.Customer; - -public interface CustomerDAO { - - - public int addCustomer(Customer e); - public int updateCustomer(int customerID, String name); - public int removeCustomer(int id); -} diff --git a/8SuperMarketxml/src/main/java/repository/CustomerDAOImpl.java b/8SuperMarketxml/src/main/java/repository/CustomerDAOImpl.java deleted file mode 100644 index 9b565a4a..00000000 --- a/8SuperMarketxml/src/main/java/repository/CustomerDAOImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -package repository; - -import org.springframework.jdbc.core.JdbcTemplate; - -import model.Customer; - -public class CustomerDAOImpl implements CustomerDAO { - - private JdbcTemplate jdbcTemplate; - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - public int addCustomer(Customer e) { - - String query = "insert into customer values('" + e.getCustomerId() + "','" + e.getCustomerName() + "','" - + e.getCustomerAddress() + "','" + e.getPaymentMode() + "')"; - System.out.println(query); - return jdbcTemplate.update(query); - - } - - public int updateCustomer(int customerID, String name) { - - String query = "update customer set customerName=" + "'" + name + "'" + " where customerId=" + customerID; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - - } - - public int removeCustomer(int id) { - String query = "delete from customer where customerId="+id; - System.out.println(query); - return jdbcTemplate.update(query); - } -} diff --git a/8SuperMarketxml/src/main/java/repository/GoodsDAO.java b/8SuperMarketxml/src/main/java/repository/GoodsDAO.java deleted file mode 100644 index fa09faa5..00000000 --- a/8SuperMarketxml/src/main/java/repository/GoodsDAO.java +++ /dev/null @@ -1,11 +0,0 @@ -package repository; - -public interface GoodsDAO { - - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - public int removeGoods(int goodsId); - - public int updateGoods(int goodsId,String goodsName ); -} diff --git a/8SuperMarketxml/src/main/java/repository/GoodsDAOImpl.java b/8SuperMarketxml/src/main/java/repository/GoodsDAOImpl.java deleted file mode 100644 index 69c134e3..00000000 --- a/8SuperMarketxml/src/main/java/repository/GoodsDAOImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -package repository; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.Statement; -import java.sql.SQLException; -import javax.sql.DataSource; - -import org.springframework.jdbc.core.JdbcTemplate; - -/** - * @author Ram - * - */ -public class GoodsDAOImpl implements GoodsDAO { - - private DataSource dataSource; - - private JdbcTemplate jdbcTemplate = new JdbcTemplate(); - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) - { - String query = "insert into goods values(" +goodsId+","+ "'"+goodsName +"'"+","+goodsQuantity+","+ goodsPrice +")"; - System.out.println(query); - - return jdbcTemplate.update(query); - } - - - - @Override - public int updateGoods(int goodsId, String goodsName) { - String query = "update goods set goodsName=" + "'" + goodsName + "'" + " where goodsId=" + goodsId; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int removeGoods(int goodsId) { - - String query = "delete from goods where goodsId="+goodsId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - - /* - Connection connection = null; - int addData = 0; - - try { - - connection = dataSource.getConnection(); - Statement statement = connection.createStatement(); - - addData = statement - .executeUpdate("INSERT INTO Goods values(goodsId,goodsName,goodsQuantity,goodsPrice)"); - - statement.close(); - connection.close(); - } catch (SQLException e) { - System.out.println(e); - } - - return addData; - } - - public String removeGoods(int goodsId) { - Connection connection = null; - try { - connection = dataSource.getConnection(); - String sql = "DELETE FROM Goods where goodsId=?"; - PreparedStatement statement = connection.prepareStatement(sql); - statement.setInt(1, goodsId); - statement.executeUpdate(); - statement.close(); - connection.close(); - } catch (SQLException e) { - System.out.println(e); - } - return "Data deleted"; - } - - public String updateGoods(int goodsId) { - Connection connection = null; - try { - connection = dataSource.getConnection(); - String sql = "UPDATE Goods set goodsQuantity=1 where goodsId=?"; - PreparedStatement statement = connection.prepareStatement(sql); - statement.setInt(1, goodsId); - statement.executeUpdate(); - statement.close(); - connection.close(); - } catch (SQLException e) { - System.out.println(e); - } - return "Data updated"; - } -*/ - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - - -} diff --git a/8SuperMarketxml/src/main/java/repository/RetailerDAO.java b/8SuperMarketxml/src/main/java/repository/RetailerDAO.java deleted file mode 100644 index a57220a8..00000000 --- a/8SuperMarketxml/src/main/java/repository/RetailerDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerDAO { - - - int addRetailer(String name, String address); - -public List viewGoods(); - -public List viewCustomer(int customerId); - -public List viewSupplier(int supplierId); - - -} diff --git a/8SuperMarketxml/src/main/java/repository/RetailerDAOImpl.java b/8SuperMarketxml/src/main/java/repository/RetailerDAOImpl.java deleted file mode 100644 index a15935a5..00000000 --- a/8SuperMarketxml/src/main/java/repository/RetailerDAOImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * - */ -package repository; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public class RetailerDAOImpl implements RetailerDAO { - - private JdbcTemplate jdbcTemplate; - - /*@Override - public int viewGoods() { - // TODO Auto-generated method stub - String query = "select * from goods"; - System.out.println(query); - return jdbcTemplate.update(query); - - }*/ - - - public List getAllGoods(){ - return jdbcTemplate.query("select * from goods",new ResultSetExtractor>(){ - @Override - public List extractData(ResultSet rs) throws SQLException, - DataAccessException { - - List list=new ArrayList(); - while(rs.next()){ - Goods e=new Goods(); - e.setGoodsId(rs.getInt(1)); - e.setGoodsName(rs.getString(2)); - e.setGoodsQuantity(rs.getInt(3)); - e.setGoodsPrice(rs.getInt(4)); - list.add(e); - System.out.println(e.getGoodsName()); - System.out.println(e.getGoodsPrice()); - System.out.println(e.getGoodsQuantity()); - - - } - - return list; - } - }); - } - - /** - * @return the jdbcTemplate - */ - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - /** - * @param jdbcTemplate - * the jdbcTemplate to set - */ - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - @Override - public List viewCustomer(int customerId) { - - String query = "select * from customer where customerId=" + customerId; - System.out.println(query); - return jdbcTemplate.query(query,new ResultSetExtractor>(){ - @Override - public List extractData(ResultSet rs) throws SQLException, - DataAccessException { - - List list=new ArrayList(); - while(rs.next()){ - Customer c=new Customer(); - c.setCustomerAddress(rs.getString(3)); - c.setCustomerId(rs.getInt(1)); - c.setCustomerName(rs.getString(2)); - c.setPaymentMode(rs.getString(4)); - list.add(c); - System.out.println(c.getCustomerId()); - System.out.println(c.getCustomerName()); - System.out.println(c.getCustomerAddress()); - System.out.println(c.getPaymentMode()); - - - } - - return list; - } - }); - - } - - @Override - public List viewSupplier(int supplierId) { - String query = "select * from supplier where supplierId=" + supplierId; - System.out.println(query); - return jdbcTemplate.query(query,new ResultSetExtractor>(){ - @Override - public List extractData(ResultSet rs) throws SQLException, - DataAccessException { - - List list=new ArrayList(); - while(rs.next()){ - Supplier c=new Supplier(); - c.setSupplierId(rs.getInt(1)); - c.setSupplierName(rs.getString(2)); - c.setSupplierAddress(rs.getString(3)); - c.setQuantityOrder(rs.getInt(4)); - c.setOrderId(rs.getInt(5)); - c.setAmount(rs.getDouble(6)); - list.add(c); - System.out.println(c.getSupplierId()); - System.out.println(c.getSupplierName()); - System.out.println(c.getSupplierAddress()); - System.out.println(c.getQuantityOrder()); - System.out.println(c.getOrderId()); - System.out.println(c.getAmount()); - - - } - - return list; - } - }); - - - - } - - @Override - public List viewGoods() { - // TODO Auto-generated method stub - return null; - } - - @Override - public int addRetailer(String name, String address) { - - String query = "insert into retailer values ("+ "'"+name+"'"+","+"'" + address +"'"+")"; - System.out.println(query); - return jdbcTemplate.update(query); - } - - - - } - - - - diff --git a/8SuperMarketxml/src/main/java/repository/SupplierDAO.java b/8SuperMarketxml/src/main/java/repository/SupplierDAO.java deleted file mode 100644 index 1db9abc3..00000000 --- a/8SuperMarketxml/src/main/java/repository/SupplierDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package repository; - -public interface SupplierDAO { - - public int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - - public int removeSupplier(int supplierId); -/* - public int updateSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); -*/ - public int updateSupplier(int supplierId, String supplierName); - -} diff --git a/8SuperMarketxml/src/main/java/repository/SupplierDAOImpl.java b/8SuperMarketxml/src/main/java/repository/SupplierDAOImpl.java deleted file mode 100644 index 8fa10243..00000000 --- a/8SuperMarketxml/src/main/java/repository/SupplierDAOImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package repository; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.sql.Statement; - -import javax.sql.DataSource; - -import org.springframework.jdbc.core.JdbcTemplate; - -public class SupplierDAOImpl implements SupplierDAO { - - private DataSource dataSource; - - JdbcTemplate jdbcTemplate; - - @Override - public int addSupplier(int supplierId, String supplierName, String supplierAddress, int quantityOrder, int orderId, - double amount) { - String Query = "insert into supplier values(" + supplierId + "," + "'" + supplierName + "'" + "," + "'" - + supplierAddress + "'" + "," + quantityOrder + "," + orderId + "," + amount + ")"; - System.out.println(Query); - return jdbcTemplate.update(Query); - } - - @Override - public int removeSupplier(int supplierId) { - - String query = "delete from supplier where supplierId=" + supplierId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - - @Override - public int updateSupplier(int supplierId, String supplierName) { - - String query = "update supplier set supplierName="+"'" +supplierName+"'"+ "where supplierId="+supplierId; - - System.out.println(query); - return jdbcTemplate.update(query); - } - - /** - * @return the jdbcTemplate - */ - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - /** - * @param jdbcTemplate - * the jdbcTemplate to set - */ - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - -} diff --git a/8SuperMarketxml/src/main/java/service/CustomerService.java b/8SuperMarketxml/src/main/java/service/CustomerService.java deleted file mode 100644 index 7ba47d0c..00000000 --- a/8SuperMarketxml/src/main/java/service/CustomerService.java +++ /dev/null @@ -1,11 +0,0 @@ -package service; - -public interface CustomerService { - - public int addCustomer(int customerId, String customerName,String customerAddress ,String paymentMode); - - public String removeCustomer(int goodsId); - - public String updateCustomer(int goodsId); - -} diff --git a/8SuperMarketxml/src/main/java/service/CustomerServiceImpl.java b/8SuperMarketxml/src/main/java/service/CustomerServiceImpl.java deleted file mode 100644 index 31ab1276..00000000 --- a/8SuperMarketxml/src/main/java/service/CustomerServiceImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -package service; - - - -/** - * @author Ram - * - */ -public class CustomerServiceImpl implements CustomerService { - - @Override - public int addCustomer(int customerId, String customerName, - String customerAddress, String paymentMode) { - - // CustomerDAO customerDAO = null; - int addData = addCustomer(customerId, customerName, - customerAddress, paymentMode); - return addData; - } - - - @Override - public String removeCustomer(int customerId) { - - //CustomerDAO customerDAO = null; - String removeData = removeCustomer(customerId); - return removeData; - } - - @Override - public String updateCustomer(int customerId) { - - //CustomerDAO customerDAO = null; - String updateData = updateCustomer(customerId); - return updateData; - } - -} diff --git a/8SuperMarketxml/src/main/java/service/GoodsSeriveImpl.java b/8SuperMarketxml/src/main/java/service/GoodsSeriveImpl.java deleted file mode 100644 index 9c5e6893..00000000 --- a/8SuperMarketxml/src/main/java/service/GoodsSeriveImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -import repository.GoodsDAO; - -public class GoodsSeriveImpl implements GoodsService { - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - GoodsDAO goodsDAO = null; - int addData = goodsDAO.addGoods(goodsId, goodsName, goodsQuantity, - goodsPrice); - return addData; - } - - @Override - public String removeGoods(int goodsId) { - GoodsDAO goodsDAO = null; - String remmoveData = goodsDAO.removeGoods(goodsId); - return remmoveData; - } - - @Override - public String updateGoods(int goodsId) { - GoodsDAO goodsDAO = null; - String updateData = goodsDAO.updateGoods(goodsId); - return updateData; - } - -} diff --git a/8SuperMarketxml/src/main/java/service/GoodsService.java b/8SuperMarketxml/src/main/java/service/GoodsService.java deleted file mode 100644 index dc80c5ac..00000000 --- a/8SuperMarketxml/src/main/java/service/GoodsService.java +++ /dev/null @@ -1,10 +0,0 @@ -package service; - -public interface GoodsService { - - public int addGoods( int goodsId,String goodsName,int goodsQuantity,double goodsPrice); - public String removeGoods(int goodsId); - public String updateGoods(int goodsId); - //public String orderGoods(int goodsId); - -} diff --git a/8SuperMarketxml/src/main/java/service/RetailerService.java b/8SuperMarketxml/src/main/java/service/RetailerService.java deleted file mode 100644 index 6f5b94ae..00000000 --- a/8SuperMarketxml/src/main/java/service/RetailerService.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerService { - - //int addSupplier(String supplierName, String supplierAddress); - - int addRetailer(Supplier s); - - -public List viewGoods(); - -public List viewCustomer(int customerId); - -public List viewSupplier(int supplierId); - - -} diff --git a/8SuperMarketxml/src/main/java/service/RetailerServiceImpl.java b/8SuperMarketxml/src/main/java/service/RetailerServiceImpl.java deleted file mode 100644 index d4c856b7..00000000 --- a/8SuperMarketxml/src/main/java/service/RetailerServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; - -import model.Customer; -import model.Goods; -import model.Supplier; -import repository.CustomerDAO; -import repository.RetailerDAO; - -/** - * @author trainee - * - */ -public class RetailerServiceImpl implements RetailerService { - - - private RetailerDAO retailerDao; - - @Override - public int addRetailer(final Supplier s) { - - return retailerDao.addRetailer(s); - - } - - @Override - public List viewCustomer(final int customerId) { - - return retailerDao.viewCustomer(customerId); - } - - @Override - public List viewSupplier(final int supplierId) { - // TODO Auto-generated method stub - return retailerDao.viewSupplier(supplierId); - } - - @Override - public List viewGoods() { - // TODO Auto-generated method stub - return retailerDao.viewGoods(); - } - -} diff --git a/8SuperMarketxml/src/main/java/service/SupplierService.java b/8SuperMarketxml/src/main/java/service/SupplierService.java deleted file mode 100644 index 7cb316e4..00000000 --- a/8SuperMarketxml/src/main/java/service/SupplierService.java +++ /dev/null @@ -1,13 +0,0 @@ -package service; - -public interface SupplierService { - - public int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - - public int removeSupplier(int supplierId); - - public int updateSupplier(int supplierId); - -} diff --git a/8SuperMarketxml/src/main/java/service/SupplierServiceImpl.java b/8SuperMarketxml/src/main/java/service/SupplierServiceImpl.java deleted file mode 100644 index c1d9f9d4..00000000 --- a/8SuperMarketxml/src/main/java/service/SupplierServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package service; - -import repository.SupplierDAO; - -public class SupplierServiceImpl implements SupplierService { - - @Override - public int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount) { - - SupplierDAO supplierDAO = null; - int addData = supplierDAO.addSupplier(supplierId, supplierName, - supplierAddress, quantityOrder, orderId, amount); - return addData; - - } - - @Override - public int removeSupplier(int supplierId) { - SupplierDAO supplierDAO = null; - int removeData = supplierDAO.removeSupplier(supplierId); - return removeData; - } - - @Override - public int updateSupplier(int supplierId) { - SupplierDAO supplierDAO = null; - int removeData = supplierDAO.updateSupplier(supplierId); - return removeData; - } - -} diff --git a/8SuperMarketxml/src/main/resources/applicationContext.xml b/8SuperMarketxml/src/main/resources/applicationContext.xml deleted file mode 100644 index c4390341..00000000 --- a/8SuperMarketxml/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/8SuperMarketxml/src/test/java/com/training/groceryApp/AppTest.java b/8SuperMarketxml/src/test/java/com/training/groceryApp/AppTest.java deleted file mode 100644 index bf7d030e..00000000 --- a/8SuperMarketxml/src/test/java/com/training/groceryApp/AppTest.java +++ /dev/null @@ -1,310 +0,0 @@ -package com.training.groceryApp; - -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -import model.Customer; -import model.Goods; -import model.Retailer; -import model.Supplier; -import repository.CustomerDAOImpl; -import repository.GoodsDAOImpl; - -/** - * Unit test for simple Application. - */ -public class AppTest { - - CustomerDAOImpl testAddCustomer; - GoodsDAOImpl testGoods; - - @Before - public void LoadXml() { - ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); - // JdbcTemplate jdbcTemplate = (JdbcTemplate) context.getBean("dataSource"); - - DriverManagerDataSource ds = context.getBean("dataSource", DriverManagerDataSource.class); - - JdbcTemplate jt = context.getBean("jdbcTemplate", JdbcTemplate.class); - - testAddCustomer = context.getBean("cdao", CustomerDAOImpl.class); - testGoods = context.getBean("gdao", GoodsDAOImpl.class); - - } - - @Test - public void checkForNull() { - String retailerName = null; - String retailerAddress = null; - - Retailer retailer = new Retailer("Spectre Litt", "NY"); - assertNotEquals("Enter valid Name", retailerName, retailer.getRetailerName()); - - assertNotEquals("Enter valid address", retailerAddress, retailer.getRetailerAddres()); - } - - @Test - public void checkForNullCustomer() { - - String customerId = null; - String customerName = null; - String customerAddress = null; - String paymentMode = null; - - Customer customer = new Customer(1, "rama", "wardhaa", "debitcard"); - assertNotEquals("Enter valid id", customerId, customer.getCustomerId()); - assertNotEquals("Enter valid name", customerName, customer.getCustomerName()); - assertNotEquals("Enter valid address", customerAddress, customer.getCustomerAddress()); - assertNotEquals("Enter valid paymentMode", paymentMode, customer.getPaymentMode()); - } - - @Test - public void checkForNullSupplier() { - - String supplierId = null; - String supplierName = null; - String supplierAddress = null; - int quantityOrder = 0; - int orderId = 0; - double amount = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - assertNotEquals("Enter valid id", supplierName, supplier.getSupplierId()); - assertNotEquals("Enter valid name", supplierAddress, supplier.getSupplierName()); - assertNotEquals("Enter valid quantity", quantityOrder, supplier.getQuantityOrder()); - assertNotEquals("Enter valid Id", orderId, supplier.getOrderId()); - assertNotEquals("Enter valid amount", amount, supplier.getAmount()); - } - - @Test - public void checkCustName() { - final String customerName = null; - final Customer customer = new Customer(1, "rama", "wardhaa", "debitcard"); - assertNotEquals("Enter valid name", customerName, customer.getCustomerName()); - } - - @Test - public void checkCustAddress() { - final String customerAddress = null; - final Customer customer = new Customer(1, "rama", "wardhaa", "debitcard"); - assertNotEquals("Enter valid address", customerAddress, customer.getCustomerAddress()); - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierId() { - - final int supplierId = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid id", supplierId, supplier.getSupplierId()); - - } - - public void checkForNullSupplierName() { - - final String supplierName = null; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - System.out.println("supplier:" + supplier); - // assertNotEquals("Enter valid id", supplierId, supplier.getSupplierId()); - assertNotEquals("Enter valid name", supplierName, supplier.getSupplierName()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierquantityOrder() { - - final int quantityOrder = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid quantity", quantityOrder, supplier.getQuantityOrder()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierAddress() { - - final String supplierAddress = null; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid address", supplierAddress, supplier.getSupplierAddress()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierOrderID() { - - final int orderId = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid Id", orderId, supplier.getOrderId()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierAmount() { - - final double amount = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid amount", amount, supplier.getAmount()); - - } - - @Test - public void checkforCustomerOneArg() { - - final String name = null; - - final Customer customer = new Customer("johan"); - assertNotEquals("Enter valid id", name, customer.getCustomerId()); - - // System.out.println("supplier:" + supplier); - - } - - @Test - public void checkforsupplierid() { - long supplierId = 0; - Supplier supplier = new Supplier(706, "raman", "andheri", 10, 25, 2000); - assertNotEquals("Invalid id", supplierId, supplier.getSupplierId()); - } - - @Test - public void checkforsuppliername() { - String supplierName = null; - Supplier supplier = new Supplier(706, "raman", "andheri", 10, 25, 2000); - assertNotEquals("Invalid name", supplierName, supplier.getSupplierName()); - } - - @Test - public void checkforsupplieraddress() { - String supplierAddress = null; - Supplier supplier = new Supplier(706, "raman", "andheri", 10, 25, 2000); - assertNotEquals("Invalid address", supplierAddress, supplier.getSupplierAddress()); - } - - @Test - public void checkforquantityOrder() { - long quantityOrder = 0; - ; - Supplier supplier = new Supplier(706, "raman", "andheri", 10, 25, 2000); - assertNotEquals("Invalid order quantity", quantityOrder, supplier.getQuantityOrder()); - } - - @Test - public void checkfororderId() { - long orderId = 0; - Supplier supplier = new Supplier(706, "raman", "andheri", 10, 25, 2000); - assertNotEquals("Invalid order id", orderId, supplier.getOrderId()); - } - - @Test - public void checkforamount() { - float amount = 0; - Supplier supplier = new Supplier(706, "raman", "andheri", 10, 25, 2000); - assertNotEquals("Invalid amount", amount, supplier.getAmount()); - } - - @Test - public void testSetRetailerName() { - Retailer rname = new Retailer(); - rname.setRetailerName("Thanos"); - assertTrue(rname.getRetailerName() == "Thanos"); - } - - @Test - public void testSetRetailerAddress() { - Retailer raddress = new Retailer(); - raddress.setRetailerName("Knowwhere"); - assertTrue(raddress.getRetailerAddres() == "Knowwhere"); - } - - @Test - public void testGetAddress() { - Retailer rname = new Retailer(); - rname.setRetailerAddres("wardhaa"); - assertTrue(rname.getRetailerAddres() == "wardhaa"); - } - - @Test - public void testGetName() { - Retailer rname = new Retailer(); - rname.setRetailerName("gamora"); - assertTrue(rname.getRetailerName() == "gamora"); - } - - @Test - public void testSetGoodsId() { - final Goods goods = new Goods(); - goods.setGoodsId(8); - assertTrue(goods.getGoodsId() == 8); - } - - @Test - public void testSetGoodsName() { - final Goods goods = new Goods(); - goods.setGoodsName("Thanos"); - assertTrue(goods.getGoodsName() == "Thanos"); - } - - @Test - public void testsetGoodsQuantity() { - final Goods goods = new Goods(); - goods.setGoodsQuantity(5); - assertTrue(goods.getGoodsQuantity() == 5); - } - - @Test - public void testsetGoodsPrice() { - final Goods goods = new Goods(); - goods.setGoodsPrice(552); - assertTrue(goods.getGoodsPrice() == 552); - } - - @Test - public void testGetId() { - final Goods goods = new Goods(); - goods.setGoodsId(1); - assertTrue(goods.getGoodsId() == 1); - } - - @Test - public void testGetGoodsName() { - final Goods goods = new Goods(); - goods.setGoodsName("ironman"); - assertTrue(goods.getGoodsName() == "ironman"); - } - - @Test - public void testGetQuantity() { - final Goods goods = new Goods(); - goods.setGoodsQuantity(8); - assertTrue(goods.getGoodsQuantity() == 8); - } - - @Test - public void testGetPrice() { - final Goods goods = new Goods(); - goods.setGoodsPrice(8); - assertTrue(goods.getGoodsPrice() == 8); - } - -} diff --git a/8SuperMarketxml/target/classes/META-INF/MANIFEST.MF b/8SuperMarketxml/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/8SuperMarketxml/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/8SuperMarketxml/target/classes/META-INF/maven/com.training/groceryApp/pom.properties b/8SuperMarketxml/target/classes/META-INF/maven/com.training/groceryApp/pom.properties deleted file mode 100644 index 7963e99f..00000000 --- a/8SuperMarketxml/target/classes/META-INF/maven/com.training/groceryApp/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu May 03 10:56:06 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.training -m2e.projectName=SuperMarketxml -m2e.projectLocation=D\:\\RamCapg\\JavaTraining-Capg\\SuperMarketxml -artifactId=groceryApp diff --git a/8SuperMarketxml/target/classes/META-INF/maven/com.training/groceryApp/pom.xml b/8SuperMarketxml/target/classes/META-INF/maven/com.training/groceryApp/pom.xml deleted file mode 100644 index cebcfbed..00000000 --- a/8SuperMarketxml/target/classes/META-INF/maven/com.training/groceryApp/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/8SuperMarketxml/target/classes/applicationContext.xml b/8SuperMarketxml/target/classes/applicationContext.xml deleted file mode 100644 index c4390341..00000000 --- a/8SuperMarketxml/target/classes/applicationContext.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/8SuperMarketxml/target/classes/controller/GroceryMain.class b/8SuperMarketxml/target/classes/controller/GroceryMain.class deleted file mode 100644 index 3856cf90..00000000 Binary files a/8SuperMarketxml/target/classes/controller/GroceryMain.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/model/Customer.class b/8SuperMarketxml/target/classes/model/Customer.class deleted file mode 100644 index 79e27f5f..00000000 Binary files a/8SuperMarketxml/target/classes/model/Customer.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/model/Goods.class b/8SuperMarketxml/target/classes/model/Goods.class deleted file mode 100644 index 9ba808e6..00000000 Binary files a/8SuperMarketxml/target/classes/model/Goods.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/model/Retailer.class b/8SuperMarketxml/target/classes/model/Retailer.class deleted file mode 100644 index e59d4125..00000000 Binary files a/8SuperMarketxml/target/classes/model/Retailer.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/model/Supplier.class b/8SuperMarketxml/target/classes/model/Supplier.class deleted file mode 100644 index db845ad5..00000000 Binary files a/8SuperMarketxml/target/classes/model/Supplier.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/CustomerDAO.class b/8SuperMarketxml/target/classes/repository/CustomerDAO.class deleted file mode 100644 index dea0d980..00000000 Binary files a/8SuperMarketxml/target/classes/repository/CustomerDAO.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/CustomerDAOImpl.class b/8SuperMarketxml/target/classes/repository/CustomerDAOImpl.class deleted file mode 100644 index 1c43f94d..00000000 Binary files a/8SuperMarketxml/target/classes/repository/CustomerDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/GoodsDAO.class b/8SuperMarketxml/target/classes/repository/GoodsDAO.class deleted file mode 100644 index d9848dd9..00000000 Binary files a/8SuperMarketxml/target/classes/repository/GoodsDAO.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/GoodsDAOImpl.class b/8SuperMarketxml/target/classes/repository/GoodsDAOImpl.class deleted file mode 100644 index 573351ab..00000000 Binary files a/8SuperMarketxml/target/classes/repository/GoodsDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/RetailerDAO.class b/8SuperMarketxml/target/classes/repository/RetailerDAO.class deleted file mode 100644 index 2d83eb8e..00000000 Binary files a/8SuperMarketxml/target/classes/repository/RetailerDAO.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$1.class b/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$1.class deleted file mode 100644 index 35685c5b..00000000 Binary files a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$1.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$2.class b/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$2.class deleted file mode 100644 index 7e503bcf..00000000 Binary files a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$2.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$3.class b/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$3.class deleted file mode 100644 index 5961d69f..00000000 Binary files a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl$3.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl.class b/8SuperMarketxml/target/classes/repository/RetailerDAOImpl.class deleted file mode 100644 index e1a7b624..00000000 Binary files a/8SuperMarketxml/target/classes/repository/RetailerDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/SupplierDAO.class b/8SuperMarketxml/target/classes/repository/SupplierDAO.class deleted file mode 100644 index 8890dc82..00000000 Binary files a/8SuperMarketxml/target/classes/repository/SupplierDAO.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/repository/SupplierDAOImpl.class b/8SuperMarketxml/target/classes/repository/SupplierDAOImpl.class deleted file mode 100644 index 88e42a2f..00000000 Binary files a/8SuperMarketxml/target/classes/repository/SupplierDAOImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/CustomerService.class b/8SuperMarketxml/target/classes/service/CustomerService.class deleted file mode 100644 index 4abdab74..00000000 Binary files a/8SuperMarketxml/target/classes/service/CustomerService.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/CustomerServiceImpl.class b/8SuperMarketxml/target/classes/service/CustomerServiceImpl.class deleted file mode 100644 index 9bc494a4..00000000 Binary files a/8SuperMarketxml/target/classes/service/CustomerServiceImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/GoodsSeriveImpl.class b/8SuperMarketxml/target/classes/service/GoodsSeriveImpl.class deleted file mode 100644 index 6dc6b303..00000000 Binary files a/8SuperMarketxml/target/classes/service/GoodsSeriveImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/GoodsService.class b/8SuperMarketxml/target/classes/service/GoodsService.class deleted file mode 100644 index 0ab07de3..00000000 Binary files a/8SuperMarketxml/target/classes/service/GoodsService.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/RetailerService.class b/8SuperMarketxml/target/classes/service/RetailerService.class deleted file mode 100644 index f93c5931..00000000 Binary files a/8SuperMarketxml/target/classes/service/RetailerService.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/RetailerServiceImpl.class b/8SuperMarketxml/target/classes/service/RetailerServiceImpl.class deleted file mode 100644 index e5691edd..00000000 Binary files a/8SuperMarketxml/target/classes/service/RetailerServiceImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/SupplierService.class b/8SuperMarketxml/target/classes/service/SupplierService.class deleted file mode 100644 index 4f0960e2..00000000 Binary files a/8SuperMarketxml/target/classes/service/SupplierService.class and /dev/null differ diff --git a/8SuperMarketxml/target/classes/service/SupplierServiceImpl.class b/8SuperMarketxml/target/classes/service/SupplierServiceImpl.class deleted file mode 100644 index 2f937337..00000000 Binary files a/8SuperMarketxml/target/classes/service/SupplierServiceImpl.class and /dev/null differ diff --git a/8SuperMarketxml/target/test-classes/com/training/groceryApp/AppTest.class b/8SuperMarketxml/target/test-classes/com/training/groceryApp/AppTest.class deleted file mode 100644 index bc657ed5..00000000 Binary files a/8SuperMarketxml/target/test-classes/com/training/groceryApp/AppTest.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/.classpath b/9SuperMarketJavaConfig/.classpath deleted file mode 100644 index 698778fe..00000000 --- a/9SuperMarketJavaConfig/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/9SuperMarketJavaConfig/.eclipse-pmd b/9SuperMarketJavaConfig/.eclipse-pmd deleted file mode 100644 index 8c5b4482..00000000 --- a/9SuperMarketJavaConfig/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/.project b/9SuperMarketJavaConfig/.project deleted file mode 100644 index 1100f0d7..00000000 --- a/9SuperMarketJavaConfig/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - SuperMarketJavaConfig - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/9SuperMarketJavaConfig/.settings/org.eclipse.core.resources.prefs b/9SuperMarketJavaConfig/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/9SuperMarketJavaConfig/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/9SuperMarketJavaConfig/.settings/org.eclipse.jdt.core.prefs b/9SuperMarketJavaConfig/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index ec4300d5..00000000 --- a/9SuperMarketJavaConfig/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/9SuperMarketJavaConfig/MydatabaseQueries.txt b/9SuperMarketJavaConfig/MydatabaseQueries.txt deleted file mode 100644 index 0c560094..00000000 --- a/9SuperMarketJavaConfig/MydatabaseQueries.txt +++ /dev/null @@ -1,47 +0,0 @@ -create database mydb; - - -CREATE TABLE Customer ( - customerId int primary key auto_increment, - customerName varchar(255), - customerAddress varchar(255), - paymentMode varchar(20) -); - - - - - - - - - - -CREATE TABLE `mydb1`.`goods` ( - `goodsId` INT NOT NULL AUTO_INCREMENT, - `goodsName` VARCHAR(45) NOT NULL, - `goodsQuantity` VARCHAR(45) NOT NULL, - `goodsPrice` VARCHAR(45) NOT NULL, - PRIMARY KEY (`goodsId`)); - - - - - - - -CREATE TABLE `mydb1`.`supplier` ( - `supplierId` INT NOT NULL AUTO_INCREMENT, - `supplierName` VARCHAR(45) NOT NULL, - `supplierAddress` VARCHAR(45) NOT NULL, - `quantityOrder` INT NOT NULL, - `orderId` INT NOT NULL, - `amount` DOUBLE NOT NULL, - PRIMARY KEY (`supplierId`)); - - - -CREATE TABLE `mydb1`.`retailer` ( - `retailerName` VARCHAR(25) NOT NULL, - `retailerAddress` VARCHAR(45) NOT NULL, - PRIMARY KEY (`retailerName`)); diff --git a/9SuperMarketJavaConfig/bin/.eclipse-pmd b/9SuperMarketJavaConfig/bin/.eclipse-pmd deleted file mode 100644 index 8c5b4482..00000000 --- a/9SuperMarketJavaConfig/bin/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/bin/.project b/9SuperMarketJavaConfig/bin/.project deleted file mode 100644 index a102f811..00000000 --- a/9SuperMarketJavaConfig/bin/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - SuperMarketJavaConfig - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/9SuperMarketJavaConfig/bin/.settings/org.eclipse.core.resources.prefs b/9SuperMarketJavaConfig/bin/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/9SuperMarketJavaConfig/bin/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/9SuperMarketJavaConfig/bin/.settings/org.eclipse.jdt.core.prefs b/9SuperMarketJavaConfig/bin/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index ec4300d5..00000000 --- a/9SuperMarketJavaConfig/bin/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/9SuperMarketJavaConfig/bin/MydatabaseQueries.txt b/9SuperMarketJavaConfig/bin/MydatabaseQueries.txt deleted file mode 100644 index 0c560094..00000000 --- a/9SuperMarketJavaConfig/bin/MydatabaseQueries.txt +++ /dev/null @@ -1,47 +0,0 @@ -create database mydb; - - -CREATE TABLE Customer ( - customerId int primary key auto_increment, - customerName varchar(255), - customerAddress varchar(255), - paymentMode varchar(20) -); - - - - - - - - - - -CREATE TABLE `mydb1`.`goods` ( - `goodsId` INT NOT NULL AUTO_INCREMENT, - `goodsName` VARCHAR(45) NOT NULL, - `goodsQuantity` VARCHAR(45) NOT NULL, - `goodsPrice` VARCHAR(45) NOT NULL, - PRIMARY KEY (`goodsId`)); - - - - - - - -CREATE TABLE `mydb1`.`supplier` ( - `supplierId` INT NOT NULL AUTO_INCREMENT, - `supplierName` VARCHAR(45) NOT NULL, - `supplierAddress` VARCHAR(45) NOT NULL, - `quantityOrder` INT NOT NULL, - `orderId` INT NOT NULL, - `amount` DOUBLE NOT NULL, - PRIMARY KEY (`supplierId`)); - - - -CREATE TABLE `mydb1`.`retailer` ( - `retailerName` VARCHAR(25) NOT NULL, - `retailerAddress` VARCHAR(45) NOT NULL, - PRIMARY KEY (`retailerName`)); diff --git a/9SuperMarketJavaConfig/bin/pom.xml b/9SuperMarketJavaConfig/bin/pom.xml deleted file mode 100644 index cebcfbed..00000000 --- a/9SuperMarketJavaConfig/bin/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/9SuperMarketJavaConfig/bin/retailShopDB.mwb b/9SuperMarketJavaConfig/bin/retailShopDB.mwb deleted file mode 100644 index f663073c..00000000 Binary files a/9SuperMarketJavaConfig/bin/retailShopDB.mwb and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/retailShopDB.mwb.bak b/9SuperMarketJavaConfig/bin/retailShopDB.mwb.bak deleted file mode 100644 index 0a194377..00000000 Binary files a/9SuperMarketJavaConfig/bin/retailShopDB.mwb.bak and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/controller/AppJavaConfig.class b/9SuperMarketJavaConfig/bin/src/main/java/controller/AppJavaConfig.class deleted file mode 100644 index 664d9572..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/controller/AppJavaConfig.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/controller/GroceryMain.class b/9SuperMarketJavaConfig/bin/src/main/java/controller/GroceryMain.class deleted file mode 100644 index 99c03cd9..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/controller/GroceryMain.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/model/Customer.class b/9SuperMarketJavaConfig/bin/src/main/java/model/Customer.class deleted file mode 100644 index 44c6b4a6..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/model/Customer.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/model/Goods.class b/9SuperMarketJavaConfig/bin/src/main/java/model/Goods.class deleted file mode 100644 index 2fc692b2..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/model/Goods.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/model/Retailer.class b/9SuperMarketJavaConfig/bin/src/main/java/model/Retailer.class deleted file mode 100644 index 938e4b89..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/model/Retailer.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/model/Supplier.class b/9SuperMarketJavaConfig/bin/src/main/java/model/Supplier.class deleted file mode 100644 index b180e2ee..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/model/Supplier.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/CustomerDAO.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/CustomerDAO.class deleted file mode 100644 index 48bfc15c..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/CustomerDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/CustomerDAOImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/CustomerDAOImpl.class deleted file mode 100644 index 39355a14..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/CustomerDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/GoodsDAO.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/GoodsDAO.class deleted file mode 100644 index 46ed15b4..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/GoodsDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/GoodsDAOImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/GoodsDAOImpl.class deleted file mode 100644 index c167fcdd..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/GoodsDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/RetailerDAO.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/RetailerDAO.class deleted file mode 100644 index 1f479ece..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/RetailerDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/RetailerDAOImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/RetailerDAOImpl.class deleted file mode 100644 index 162314b2..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/RetailerDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/SupplierDAO.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/SupplierDAO.class deleted file mode 100644 index 24ed59b5..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/SupplierDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/repository/SupplierDAOImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/repository/SupplierDAOImpl.class deleted file mode 100644 index 02ec3f38..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/repository/SupplierDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/CustomerService.class b/9SuperMarketJavaConfig/bin/src/main/java/service/CustomerService.class deleted file mode 100644 index db70a81e..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/CustomerService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/CustomerServiceImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/service/CustomerServiceImpl.class deleted file mode 100644 index bfd7345f..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/CustomerServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsSeriveImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsSeriveImpl.class deleted file mode 100644 index f3452194..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsSeriveImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsService.class b/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsService.class deleted file mode 100644 index 9fd9d631..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsServiceImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsServiceImpl.class deleted file mode 100644 index 4ebdd062..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/GoodsServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/RetailerService.class b/9SuperMarketJavaConfig/bin/src/main/java/service/RetailerService.class deleted file mode 100644 index b22ab381..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/RetailerService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/RetailerServiceImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/service/RetailerServiceImpl.class deleted file mode 100644 index 1f60acd7..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/RetailerServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/SupplierService.class b/9SuperMarketJavaConfig/bin/src/main/java/service/SupplierService.class deleted file mode 100644 index d88e3ada..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/SupplierService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/java/service/SupplierServiceImpl.class b/9SuperMarketJavaConfig/bin/src/main/java/service/SupplierServiceImpl.class deleted file mode 100644 index 2484ce8c..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/main/java/service/SupplierServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/src/main/resources/applicationContext.xml b/9SuperMarketJavaConfig/bin/src/main/resources/applicationContext.xml deleted file mode 100644 index 70653781..00000000 --- a/9SuperMarketJavaConfig/bin/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/bin/src/main/resources/database.properties b/9SuperMarketJavaConfig/bin/src/main/resources/database.properties deleted file mode 100644 index 9c1f900e..00000000 --- a/9SuperMarketJavaConfig/bin/src/main/resources/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=com.mysql.jdbc.Driver -url=jdbc:mysql://localhost:3306/mydb1 -dbuser=root -dbpassword=root \ No newline at end of file diff --git a/9SuperMarketJavaConfig/bin/src/test/java/com/training/groceryApp/AppTest.class b/9SuperMarketJavaConfig/bin/src/test/java/com/training/groceryApp/AppTest.class deleted file mode 100644 index 44bfbd74..00000000 Binary files a/9SuperMarketJavaConfig/bin/src/test/java/com/training/groceryApp/AppTest.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/bin/target/classes/META-INF/MANIFEST.MF b/9SuperMarketJavaConfig/bin/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/9SuperMarketJavaConfig/bin/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/9SuperMarketJavaConfig/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.properties b/9SuperMarketJavaConfig/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.properties deleted file mode 100644 index 53c079fa..00000000 --- a/9SuperMarketJavaConfig/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu May 03 09:21:35 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.training -m2e.projectName=SuperMarketJavaConfig -m2e.projectLocation=D\:\\MyProject\\SuperMarketJavaConfig -artifactId=groceryApp diff --git a/9SuperMarketJavaConfig/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.xml b/9SuperMarketJavaConfig/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.xml deleted file mode 100644 index cebcfbed..00000000 --- a/9SuperMarketJavaConfig/bin/target/classes/META-INF/maven/com.training/groceryApp/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/9SuperMarketJavaConfig/bin/target/classes/applicationContext.xml b/9SuperMarketJavaConfig/bin/target/classes/applicationContext.xml deleted file mode 100644 index 70653781..00000000 --- a/9SuperMarketJavaConfig/bin/target/classes/applicationContext.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/bin/target/classes/database.properties b/9SuperMarketJavaConfig/bin/target/classes/database.properties deleted file mode 100644 index 9c1f900e..00000000 --- a/9SuperMarketJavaConfig/bin/target/classes/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=com.mysql.jdbc.Driver -url=jdbc:mysql://localhost:3306/mydb1 -dbuser=root -dbpassword=root \ No newline at end of file diff --git a/9SuperMarketJavaConfig/home.jsp b/9SuperMarketJavaConfig/home.jsp deleted file mode 100644 index 1cf0edb0..00000000 --- a/9SuperMarketJavaConfig/home.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> -<%@page import="java.util.ArrayList"%> -<%@page import="java.util.List"%> -<%@page import="model.Customer"%> - - - - <% - List customerList = (ArrayList) request.getAttribute("list"); - - for (Customer ref : customerList) { - out.print("Id: " + ref.getCustomerId()); - out.print("
"); - out.print("Name: " + ref.getCustomerName()); - out.print("
"); - out.print("Address: " + ref.getCustomerAddress()); - out.print("
"); - out.print("
"); - } - %> - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/index.html b/9SuperMarketJavaConfig/index.html deleted file mode 100644 index abf85823..00000000 --- a/9SuperMarketJavaConfig/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - -
- -
- - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/pom.xml b/9SuperMarketJavaConfig/pom.xml deleted file mode 100644 index 5ee67adb..00000000 --- a/9SuperMarketJavaConfig/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - jstl - jstl - 1.2 - - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/9SuperMarketJavaConfig/retailShopDB.mwb b/9SuperMarketJavaConfig/retailShopDB.mwb deleted file mode 100644 index f663073c..00000000 Binary files a/9SuperMarketJavaConfig/retailShopDB.mwb and /dev/null differ diff --git a/9SuperMarketJavaConfig/retailShopDB.mwb.bak b/9SuperMarketJavaConfig/retailShopDB.mwb.bak deleted file mode 100644 index 0a194377..00000000 Binary files a/9SuperMarketJavaConfig/retailShopDB.mwb.bak and /dev/null differ diff --git a/9SuperMarketJavaConfig/src/main/java/MainServlet/DemoServlet.java b/9SuperMarketJavaConfig/src/main/java/MainServlet/DemoServlet.java deleted file mode 100644 index 629a3824..00000000 --- a/9SuperMarketJavaConfig/src/main/java/MainServlet/DemoServlet.java +++ /dev/null @@ -1,50 +0,0 @@ -package MainServlet; - -import java.io.IOException; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; - -/** - * Servlet implementation class DemoServlet - */ - -// @WebServlet("/ramServlet") -public class DemoServlet extends HttpServlet { - - /** - * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse - * response) - */ - - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - response.setContentType("text/html"); - ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - CustomerService customerService = (CustomerService) context.getBean("customerService", - CustomerServiceImpl.class); - RetailerService retailerService = (RetailerService) context.getBean("retailerService", - RetailerServiceImpl.class); - List customerList = retailerService.viewCustomer(0); - - request.setAttribute("list", customerList); - RequestDispatcher requestDispatcher = request.getRequestDispatcher("home.jsp"); - requestDispatcher.forward(request, response); - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/controller/AppJavaConfig.java b/9SuperMarketJavaConfig/src/main/java/controller/AppJavaConfig.java deleted file mode 100644 index 448070a2..00000000 --- a/9SuperMarketJavaConfig/src/main/java/controller/AppJavaConfig.java +++ /dev/null @@ -1,154 +0,0 @@ -package controller; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -import repository.CustomerDAO; -import repository.CustomerDAOImpl; -import repository.GoodsDAO; -import repository.GoodsDAOImpl; -import repository.RetailerDAO; -import repository.RetailerDAOImpl; -import repository.SupplierDAO; -import repository.SupplierDAOImpl; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.GoodsService; -import service.GoodsServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; -import service.SupplierService; -import service.SupplierServiceImpl; - -/** - * @class this is java configuration file - */ -@Configuration -@ComponentScan("controller") -@PropertySource("classpath:database.properties") -public class AppJavaConfig { - - /** - * this is java configuration file - */ - AppJavaConfig() { - } - - /** - * @injection - * - */ - @Autowired - Environment environment; - - /** - * @url it is url for a connecting to mysql server and database - * - */ - private static final String URL = "url"; - - /** - * @USER it is USER for a connecting to mysql server with username - * - */ - private static final String USER = "dbuser"; - /** - * @DRIVER it is url for a connecting to mysql server with DRIVER - * - */ - private static final String DRIVER = "driver"; - - /** - * @DRIVER it is url for a connecting to mysql server with PASSWORD - * - */ - private static final String PASSWORD = "dbpassword"; - - - - @Bean - JdbcTemplate jdbcTempalte(DataSource dataSource) - {JdbcTemplate jdbcTemplate=new JdbcTemplate( dataSource); - return jdbcTemplate; - - } - - -/** - * @bean this is used to insert properties of database. - */ - - - @Bean - DataSource dataSource() { - final DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource(); - driverManagerDataSource.setUrl(environment.getProperty(URL)); - driverManagerDataSource.setUsername(environment.getProperty(USER)); - driverManagerDataSource.setPassword(environment.getProperty(PASSWORD)); - driverManagerDataSource.setDriverClassName(environment.getProperty(DRIVER)); - return driverManagerDataSource; - } - - @Bean - public CustomerDAO customerDaoBean() { - return new CustomerDAOImpl(); - } - - @Bean - public GoodsDAO goodsDAOBean() { - return new GoodsDAOImpl(); - } - - @Bean - public SupplierDAO supplierDAOBean() { - return new SupplierDAOImpl(); - } - - - /** - * this is CustomerService bean used to invoke the - * services - */ - @Bean - public RetailerDAO retailerDAOBean() { - return new RetailerDAOImpl(); - } - - /** - * this is CustomerService bean used to invoke the - * services - */ - @Bean - public CustomerService customerService() { - return new CustomerServiceImpl(); - } - - -/** - * this is GoodsService bean used to invoke the - * services - */ - @Bean - public GoodsService goodsService() { - return new GoodsServiceImpl(); - } - - @Bean - public SupplierService supplierService() { - return new SupplierServiceImpl(); - } - - @Bean - public RetailerService retailerService() { - return new RetailerServiceImpl(); - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/controller/GroceryMain.class b/9SuperMarketJavaConfig/src/main/java/controller/GroceryMain.class deleted file mode 100644 index d027b9bb..00000000 Binary files a/9SuperMarketJavaConfig/src/main/java/controller/GroceryMain.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/src/main/java/controller/GroceryMain.java b/9SuperMarketJavaConfig/src/main/java/controller/GroceryMain.java deleted file mode 100644 index 11f13d64..00000000 --- a/9SuperMarketJavaConfig/src/main/java/controller/GroceryMain.java +++ /dev/null @@ -1,120 +0,0 @@ -package controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import repository.RetailerDAOImpl; -import repository.SupplierDAOImpl; -import service.CustomerServiceImpl; -import service.GoodsServiceImpl; -import service.RetailerServiceImpl; -import service.SupplierServiceImpl; - -/** - * @author Ram this is controller Class which take data from input and call for - * Services. - */ -public class GroceryMain { - - public static void main(final String[] args) { - - final ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - // ApplicationContext context = new - // ClassPathXmlApplicationContext("applicationContext.xml"); - // JdbcTemplate jdbcTemplate = (JdbcTemplate) context.getBean("dataSource"); - - final CustomerServiceImpl dao = context.getBean("cudao", CustomerServiceImpl.class); - - /* - * int status=dao.addCustomer(new Customer(106,"Amit","amravati","debit card")); - * System.out.println(status); - * - */ - - /* - * int status1=dao.updateCustomer(104,"Mahesh"); System.out.println(status1); - */ - - // Customer e=new Customer(); - // e.setCustomerId(520); - /* - * - * - * - * int status2=dao.removeCustomer(104); - * - * System.out.println(status2); - * - * - */ - - final GoodsServiceImpl gdao = context.getBean("gdao", GoodsServiceImpl.class); // goods bean + jdbc template - - /* - * //@ add goods int status3 = gdao.addGoods(12, "Doodle", 5, 50.12); - * System.out.println(status3); - * - * int status4 = gdao.addGoods(13, "Soap", 5, 250.12); - * System.out.println(status4); - */ - - /* - * //@remove goods int status4 = gdao.removeGoods(12); - * System.out.println(status4); - * - */ - /* - * //@update goods int status5 = gdao.updateGoods(12,"Pen"); - * System.out.println(status5); - */ - - final SupplierServiceImpl sdao = context.getBean("sudao",SupplierServiceImpl.class); // goods bean + jdbc template - - /* - * //@ add supplier int status6 = sdao.addSupplier(22, "ram saheb", "wardha", - * 12, 211, 21211.2); System.out.println(status6); - */ - - /* - * //@remove supplier int status7 = sdao.removeSupplier(21); - * System.out.println(status7); - * - */ - - // @update supplier - - // int status8 = sdao.updateSupplier(22, "Prateek saheb", "Amravati", 121, 211, - // 2011.2); - // int status8 = sdao.updateSupplier(22, "Prateek saheb"); - // System.out.println(status8); - - final RetailerServiceImpl rdao = context.getBean("redao",RetailerServiceImpl.class); - - /* - * //@ add supplier int status9 = rdao.addRetailer("jasonRoy","England"); - * System.out.println(status9); - */ - - // rdao.viewCustomer(106); - // rdao.getAllGoods(); - rdao.viewSupplier(22); - - } - -} - -/* - * GoodsService goodsService = null; int dummy = goodsService.addGoods(1, - * "soap", 4, 20.0); System.out.println(dummy); - * - * CustomerDAO customerDAO = context.getBean(CustomerDAO.class); RetailerDAO - * retailer = context.getBean(RetailerDAO.class); - * - * - * System.out.println("List of Goods is:"); - * - * for (Retailer p : retailer.viewGoods()) { - * - * System.out.println(p); } - */ diff --git a/9SuperMarketJavaConfig/src/main/java/model/Customer.java b/9SuperMarketJavaConfig/src/main/java/model/Customer.java deleted file mode 100644 index 86ec6b13..00000000 --- a/9SuperMarketJavaConfig/src/main/java/model/Customer.java +++ /dev/null @@ -1,133 +0,0 @@ -package model; - -/** - * @author Ram - * - */ - - - - -/** - * @class this class represent a customer entity - * - */ -public class Customer { - - /** - * @field this is use to provide particular id which will represent a whole - * record in table - */ - private int customerId; - - /** - * @field this is use to provide particular id which will represent a whole - * record in table - */ - private String customerName; - /** - * @field this is use to represent a name of the customer - * - */ - private String customerAddress; - /** - * @field this is use to represent a payment of the customer - * - */ - private String paymentMode; - - /** - * @param customerId - * @param customerName - * @param customerAddress - * @param paymentMode - */ - public Customer(final int customerId, final String customerName, final String customerAddress, - final String paymentMode) { - this.customerId = customerId; - this.customerName = customerName; - this.customerAddress = customerAddress; - this.paymentMode = paymentMode; - } - - /** - * - * @param customerName - * - */ - public Customer(final String customerName) { - - this.customerName = customerName; - - } - - /** - * - * @constructor this is default constructor - * - */ - public Customer() { - - } - - /** - * @return the customerId - */ - public int getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(final int customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerAddress - */ - public String getCustomerAddress() { - return customerAddress; - } - - /** - * @param customerAddress - * the customerAddress to set - */ - public void setCustomerAddress(final String customerAddress) { - this.customerAddress = customerAddress; - } - - /** - * @return the paymentMode - */ - public String getPaymentMode() { - return paymentMode; - } - - /** - * @param paymentMode - * the paymentMode to set - */ - public void setPaymentMode(final String paymentMode) { - this.paymentMode = paymentMode; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/model/Goods.java b/9SuperMarketJavaConfig/src/main/java/model/Goods.java deleted file mode 100644 index 8a0ffeb1..00000000 --- a/9SuperMarketJavaConfig/src/main/java/model/Goods.java +++ /dev/null @@ -1,89 +0,0 @@ -package model; - -public class Goods { - - - private int goodsId; - private String goodsName; - private int goodsQuantity; - private double goodsPrice; - - /** - * @param goodsId - * @param goodsName - * @param goodsQuantity - * @param goodsPrice - */ - public Goods(final int goodsId, final String goodsName, final int goodsQuantity, - final double goodsPrice) { - this.goodsId = goodsId; - this.goodsName = goodsName; - this.goodsQuantity = goodsQuantity; - this.goodsPrice = goodsPrice; - } - - public Goods() { - // TODO Auto-generated constructor stub - } - - /** - * @return the goodsId - */ - public int getGoodsId() { - return goodsId; - } - - /** - * @param goodsId - * the goodsId to set - */ - public void setGoodsId(int goodsId) { - this.goodsId = goodsId; - } - - /** - * @return the goodsName - */ - public String getGoodsName() { - return goodsName; - } - - /** - * @param goodsName - * the goodsName to set - */ - public void setGoodsName(String goodsName) { - this.goodsName = goodsName; - } - - /** - * @return the goodsQuantity - */ - public int getGoodsQuantity() { - return goodsQuantity; - } - - /** - * @param goodsQuantity - * the goodsQuantity to set - */ - public void setGoodsQuantity(int goodsQuantity) { - this.goodsQuantity = goodsQuantity; - } - - /** - * @return the goodsPrice - */ - public double getGoodsPrice() { - return goodsPrice; - } - - /** - * @param goodsPrice - * the goodsPrice to set - */ - public void setGoodsPrice(double goodsPrice) { - this.goodsPrice = goodsPrice; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/model/Retailer.java b/9SuperMarketJavaConfig/src/main/java/model/Retailer.java deleted file mode 100644 index db73d143..00000000 --- a/9SuperMarketJavaConfig/src/main/java/model/Retailer.java +++ /dev/null @@ -1,68 +0,0 @@ - -package model; - -/** - * @author Ram - * - */ -public class Retailer { - - private String retailerName; - private String retailerAddres; - /** - * @param retailerName - * @param retailerAddres - */ - - public Retailer () - { - - } - - - public Retailer(String retailerName, String retailerAddres) { - this.retailerName = retailerName; - this.retailerAddres = retailerAddres; - } - - /** - * @return the retailerName - */ - public String getRetailerName() { - return retailerName; - } - - /** - * @param retailerName - * the retailerName to set - */ - public void setRetailerName(String retailerName) { - this.retailerName = retailerName; - } - - /** - * @return the retailerAddres - */ - public String getRetailerAddres() { - return retailerAddres; - } - - /** - * @param retailerAddres - * the retailerAddres to set - */ - public void setRetailerAddres(String retailerAddres) { - this.retailerAddres = retailerAddres; - } - - - - - - - - - - - -} diff --git a/9SuperMarketJavaConfig/src/main/java/model/Supplier.java b/9SuperMarketJavaConfig/src/main/java/model/Supplier.java deleted file mode 100644 index 00ffc730..00000000 --- a/9SuperMarketJavaConfig/src/main/java/model/Supplier.java +++ /dev/null @@ -1,173 +0,0 @@ -package model; - -import java.util.List; - -/** - * @author Sumit - * - */ -public class Supplier { - - private int supplierId; - private String supplierName; - private String supplierAddress; - private int quantityOrder; - private int orderId; - private double amount; - List goodsList; - - /** - * @param supplierId - * @param supplierName - * @param supplierAddress - * @param quantityOrder - * @param orderId - * @param amount - * @param goodsList - */ - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount, List goodsList) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - this.goodsList = goodsList; - } - - public Supplier() { - // TODO Auto-generated constructor stub - } - - public Supplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount) { - this.supplierId = supplierId; - this.supplierName = supplierName; - this.supplierAddress = supplierAddress; - this.quantityOrder = quantityOrder; - this.orderId = orderId; - this.amount = amount; - } - - /** - * @return the supplierId - */ - public int getSupplierId() { - return supplierId; - } - - /** - * @param supplierId - * the supplierId to set - */ - public void setSupplierId(int supplierId) { - this.supplierId = supplierId; - } - - /** - * @return the supplierName - */ - public String getSupplierName() { - return supplierName; - } - - /** - * @param supplierName - * the supplierName to set - */ - public void setSupplierName(String supplierName) { - this.supplierName = supplierName; - } - - /** - * @return the supplierAddress - */ - public String getSupplierAddress() { - return supplierAddress; - } - - /** - * @param supplierAddress - * the supplierAddress to set - */ - public void setSupplierAddress(String supplierAddress) { - this.supplierAddress = supplierAddress; - } - - /** - * @return the quantityOrder - */ - public int getQuantityOrder() { - return quantityOrder; - } - - /** - * @param quantityOrder - * the quantityOrder to set - */ - public void setQuantityOrder(int quantityOrder) { - this.quantityOrder = quantityOrder; - } - - /** - * @return the orderId - */ - public int getOrderId() { - return orderId; - } - - /** - * @param orderId - * the orderId to set - */ - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - /** - * @return the amount - */ - public double getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(double amount) { - this.amount = amount; - } - - /** - * @return the goodsList - */ - public List getGoodsList() { - return goodsList; - } - - /** - * @param goodsList - * the goodsList to set - */ - public void setGoodsList(List goodsList) { - this.goodsList = goodsList; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Supplier [supplierId=" + supplierId + ", supplierName=" + supplierName + ", supplierAddress=" - + supplierAddress + ", quantityOrder=" + quantityOrder + ", orderId=" + orderId + ", amount=" + amount - + ", goodsList=" + goodsList + "]"; - } - - - - -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/CustomerDAO.java b/9SuperMarketJavaConfig/src/main/java/repository/CustomerDAO.java deleted file mode 100644 index cfb9f3b7..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package repository; - -import model.Customer; - -public interface CustomerDAO { - - - public int addCustomer(Customer c); - - - public int updateCustomer(int customerID, String name); - - - public int removeCustomer(int id); -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/CustomerDAOImpl.java b/9SuperMarketJavaConfig/src/main/java/repository/CustomerDAOImpl.java deleted file mode 100644 index 2cda69ab..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/CustomerDAOImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Customer; -@Repository() -@Qualifier("customerDAO") -public class CustomerDAOImpl implements CustomerDAO { - - /* - * - */ - @Autowired - private JdbcTemplate jdbcTemplate; - - public void setJdbcTemplate(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - - - public int updateCustomer(final int customerID, final String name) { - - String query = "update customer set customerName=" + "'" + name + "'" + " where customerId=" + customerID; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - - } - - public int removeCustomer(final int identy) { - final String query = "delete from customer where customerId="+identy; - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int addCustomer(Customer c) { - String query = "insert into customer values('" + c.getCustomerId() + "','" + c.getCustomerName() + "','" - + c.getCustomerAddress() + "','" + c.getPaymentMode() + "')"; - System.out.println(query); - return jdbcTemplate.update(query); - } -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/GoodsDAO.java b/9SuperMarketJavaConfig/src/main/java/repository/GoodsDAO.java deleted file mode 100644 index bffefd8c..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/GoodsDAO.java +++ /dev/null @@ -1,13 +0,0 @@ -package repository; - -import model.Goods; - -public interface GoodsDAO { - - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - public int removeGoods(int goodsId); - - public int updateGoods(int goodsId,String goodsName); -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/GoodsDAOImpl.java b/9SuperMarketJavaConfig/src/main/java/repository/GoodsDAOImpl.java deleted file mode 100644 index 193eca4d..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/GoodsDAOImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import model.Goods; - -/** - * @author Ram - * - */ -@Repository() -@Qualifier("GoodsDAO") -public class GoodsDAOImpl implements GoodsDAO { - - // private DataSource dataSource; - - // private JdbcTemplate jdbcTemplate = new JdbcTemplate(); - - /** - * configuring a jdbc template - */ - @Autowired - private JdbcTemplate jdbcTemplate; - - public void setJdbcTemplate1(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - String query = "insert into goods values(" + goodsId + "," + "'" + goodsName + "'" + "," + goodsQuantity+ "," - + goodsPrice + ")"; - System.out.println(query); - - return jdbcTemplate.update(query); - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - String query = "update goods set goodsName=" + "'" + goodsName + "'" + " where goodsId=" + goodsId; - // String query = "update customer set customerName="+name+" where customerId="+ - // customerID; - - System.out.println(query); - return jdbcTemplate.update(query); - } - - @Override - public int removeGoods(int goodsId) { - - String query = "delete from goods where goodsId=" + goodsId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/RetailerDAO.java b/9SuperMarketJavaConfig/src/main/java/repository/RetailerDAO.java deleted file mode 100644 index 5e3aeed7..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/RetailerDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package repository; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerDAO { - - - int addRetailer(Supplier s); - -public List viewGoods(); - -public List viewCustomer(int customerId ); - -public List viewSupplier(int supplierId); - - -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/RetailerDAOImpl.java b/9SuperMarketJavaConfig/src/main/java/repository/RetailerDAOImpl.java deleted file mode 100644 index 331f7f9b..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/RetailerDAOImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * - */ -package repository; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public class RetailerDAOImpl implements RetailerDAO { - - private JdbcTemplate jdbcTemplate; - - /* - * @Override public int viewGoods() { // TODO Auto-generated method stub String - * query = "select * from goods"; System.out.println(query); return - * jdbcTemplate.update(query); - * - * } - */ - - public List getAllGoods() { - return jdbcTemplate.query("select * from goods", new ResultSetExtractor>() { - @Override - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - - List list = new ArrayList(); - while (rs.next()) { - Goods e = new Goods(); - e.setGoodsId(rs.getInt(1)); - e.setGoodsName(rs.getString(2)); - e.setGoodsQuantity(rs.getInt(3)); - e.setGoodsPrice(rs.getInt(4)); - list.add(e); - - System.out.println(e.getGoodsName()); - System.out.println(e.getGoodsPrice()); - System.out.println(e.getGoodsQuantity()); - - } - - return list; - } - }); - } - - /** - * @return the jdbcTemplate - */ - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - /** - * @param jdbcTemplate - * the jdbcTemplate to set - */ - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - - @Override - public List viewCustomer(int customerId ) { - - String query = "select * from customer where customerId=" + customerId; - System.out.println(query); - return jdbcTemplate.query(query, new ResultSetExtractor>() { - @Override - public List extractData(final ResultSet rs) throws SQLException, DataAccessException { - - final List list = new ArrayList(); - while (rs.next()) { - final Customer c = new Customer(); - c.setCustomerAddress(rs.getString(3)); - c.setCustomerId(rs.getInt(1)); - c.setCustomerName(rs.getString(2)); - c.setPaymentMode(rs.getString(4)); - list.add(c); - System.out.println(c.getCustomerId()); - System.out.println(c.getCustomerName()); - System.out.println(c.getCustomerAddress()); - System.out.println(c.getPaymentMode()); - - } - - return list; - } - }); - - } - - @Override - public List viewSupplier(int supplierId) { - String query = "select * from supplier where supplierId=" + supplierId; - System.out.println(query); - return jdbcTemplate.query(query, new ResultSetExtractor>() { - @Override - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - - List list = new ArrayList(); - while (rs.next()) { - Supplier c = new Supplier(); - c.setSupplierId(rs.getInt(1)); - c.setSupplierName(rs.getString(2)); - c.setSupplierAddress(rs.getString(3)); - c.setQuantityOrder(rs.getInt(4)); - c.setOrderId(rs.getInt(5)); - c.setAmount(rs.getDouble(6)); - list.add(c); - System.out.println(c.getSupplierId()); - System.out.println(c.getSupplierName()); - System.out.println(c.getSupplierAddress()); - System.out.println(c.getQuantityOrder()); - System.out.println(c.getOrderId()); - System.out.println(c.getAmount()); - - } - - return list; - } - }); - - } - - @Override - public List viewGoods() { - // TODO Auto-generated method stub - return null; - } - - @Override - public int addRetailer(Supplier s) { - - String query = "insert into retailer values (" + "'" + s.getSupplierName() + "'" + "," + "'" - + s.getSupplierAddress() + "'" + ")"; - System.out.println(query); - return jdbcTemplate.update(query); - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/SupplierDAO.java b/9SuperMarketJavaConfig/src/main/java/repository/SupplierDAO.java deleted file mode 100644 index 1db9abc3..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/SupplierDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package repository; - -public interface SupplierDAO { - - public int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - - public int removeSupplier(int supplierId); -/* - public int updateSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); -*/ - public int updateSupplier(int supplierId, String supplierName); - -} diff --git a/9SuperMarketJavaConfig/src/main/java/repository/SupplierDAOImpl.java b/9SuperMarketJavaConfig/src/main/java/repository/SupplierDAOImpl.java deleted file mode 100644 index c417c0ba..00000000 --- a/9SuperMarketJavaConfig/src/main/java/repository/SupplierDAOImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package repository; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - - -@Repository() -@Qualifier("supplierDAO") -public class SupplierDAOImpl implements SupplierDAO { - - private DataSource dataSource; - - JdbcTemplate jdbcTemplate; - - - - - - - @Override - public int addSupplier(final int supplierId, final String supplierName, final String supplierAddress, final int quantityOrder, final int orderId, - final double amount) { - String Query = "insert into supplier values(" + supplierId + "," + "'" + supplierName + "'" + "," + "'" - + supplierAddress + "'" + "," + quantityOrder + "," + orderId + "," + amount + ")"; - System.out.println(Query); - return jdbcTemplate.update(Query); - } - - @Override - public int removeSupplier(int supplierId) { - - String query = "delete from supplier where supplierId=" + supplierId; - System.out.println(query); - return jdbcTemplate.update(query); - } - - - @Override - public int updateSupplier(int supplierId, String supplierName) { - - String query = "update supplier set supplierName="+"'" +supplierName+"'"+ "where supplierId="+supplierId; - - System.out.println(query); - return jdbcTemplate.update(query); - } - - /** - * @return the jdbcTemplate - */ - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - /** - * @param jdbcTemplate - * the jdbcTemplate to set - */ - public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/CustomerService.java b/9SuperMarketJavaConfig/src/main/java/service/CustomerService.java deleted file mode 100644 index fffc1be3..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/CustomerService.java +++ /dev/null @@ -1,14 +0,0 @@ -package service; - -import model.Customer; - -public interface CustomerService { - - - //public String addCustomer(Customer e); -// public String updateCustomer(int customerID, String name); - //public int removeCustomer(int id); - int addCustomer(Customer c); - int updateCustomer(int customerId, String customerName); - int removeCusotmer(int customerId); -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/CustomerServiceImpl.java b/9SuperMarketJavaConfig/src/main/java/service/CustomerServiceImpl.java deleted file mode 100644 index 5cab024c..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/CustomerServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Customer; -import repository.CustomerDAO; - -/** - * @author Ram - * - */ -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - @Autowired - private CustomerDAO customerDAO; - - /** - * @param customerDAO - */ - public CustomerServiceImpl(final CustomerDAO customerDAO) { - super(); - this.customerDAO = customerDAO; - } - - public CustomerServiceImpl() { - // TODO Auto-generated constructor stub - } - - - public int addCustomer(final Customer c) { - final int addData = customerDAO.addCustomer(c); - return addData; - } - - public int updateCustomer(int customerId, String customerName) { - int updateData = customerDAO.updateCustomer(customerId, customerName); - return updateData; - } - - @Override - public int removeCusotmer(int customerId) { - int removeData = customerDAO.removeCustomer(customerId); - return removeData; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/GoodsSeriveImpl.java b/9SuperMarketJavaConfig/src/main/java/service/GoodsSeriveImpl.java deleted file mode 100644 index 8c572914..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/GoodsSeriveImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import repository.GoodsDAO; - -/** - * @author Ram - * - */ -@Service("goodsService") -public class GoodsSeriveImpl implements GoodsService { - - @Autowired - private GoodsDAO goodsDAO; - - /** - * @param goodsDAO - */ - public GoodsSeriveImpl(GoodsDAO goodsDAO) { - super(); - this.goodsDAO = goodsDAO; - } - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - int addData = goodsDAO.addGoods(goodsId, goodsName, goodsQuantity, - goodsPrice); - return addData; - } - - @Override - public int removeGoods(int goodsId) { - int remmoveData = goodsDAO.removeGoods(goodsId); - return remmoveData; - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - int updateData = goodsDAO.updateGoods(goodsId,goodsName); - return updateData; - } - - - - - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/GoodsService.java b/9SuperMarketJavaConfig/src/main/java/service/GoodsService.java deleted file mode 100644 index 345474c1..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/GoodsService.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -import model.Goods; - -public interface GoodsService { - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and adding goodsID, name,quantity,price - * - */ - int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice); - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and removing a perticular Goods from table - * - */ - int removeGoods(int goodsId); - - /** - * @method this method is calling a Repository Goods which connect to database - * table Goods and updating a perticular Goods - * - */ - int updateGoods(int goodsId, String goodsName); - // public String orderGoods(int goodsId); - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/GoodsServiceImpl.java b/9SuperMarketJavaConfig/src/main/java/service/GoodsServiceImpl.java deleted file mode 100644 index 92d25e31..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/GoodsServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import model.Goods; -import repository.GoodsDAO; - -@Service("goodsService") -public class GoodsServiceImpl implements GoodsService { - - public GoodsServiceImpl() { - - } - - @Autowired - private GoodsDAO goodsdao; - - public GoodsServiceImpl(final GoodsDAO goodsdao) { - super(); - this.goodsdao = goodsdao; - } - - @Override - public int addGoods(int goodsId, String goodsName, int goodsQuantity, - double goodsPrice) { - - int addData = goodsdao.addGoods(goodsId,goodsName,goodsQuantity,goodsPrice); - return addData; - } - - @Override - public int removeGoods(int goodsId) { - // GoodsDAO goodsDAO = null; - int remmoveData = goodsdao.removeGoods(goodsId); - return remmoveData; - } - - @Override - public int updateGoods(int goodsId, String goodsName) { - // GoodsDAO goodsDAO = null; - int updateData = goodsdao.updateGoods(goodsId, goodsName); - return updateData; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/RetailerService.java b/9SuperMarketJavaConfig/src/main/java/service/RetailerService.java deleted file mode 100644 index 536690d0..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/RetailerService.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - */ -package service; - -import java.util.List; - -import model.Customer; -import model.Goods; -import model.Supplier; - -/** - * @author trainee - * - */ -public interface RetailerService { - - //int addSupplier(String supplierName, String supplierAddress); - - int addRetailer(Supplier s); - - -public List viewGoods(); - -public List viewCustomer(int customerId ); - -public List viewSupplier(int supplierId); - - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/RetailerServiceImpl.java b/9SuperMarketJavaConfig/src/main/java/service/RetailerServiceImpl.java deleted file mode 100644 index 0ca673bd..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/RetailerServiceImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - */ -package service; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; - -import model.Customer; -import model.Goods; -import model.Supplier; -import repository.CustomerDAO; -import repository.RetailerDAO; -import repository.RetailerDAOImpl; - -/** - * @author trainee - * - */ -public class RetailerServiceImpl implements RetailerService { - - @Autowired - private RetailerDAO retailerDao; - - @Override - public int addRetailer(final Supplier s) { - - return retailerDao.addRetailer(s); - - } - - public List viewCustomer(int customerId ) { - List customerList = new ArrayList(); - customerList = retailerDao.viewCustomer(customerId); - return customerList; - } - - @Override - public List viewSupplier(final int supplierId) { - // TODO Auto-generated method stub - return retailerDao.viewSupplier(supplierId); - } - - @Override - public List viewGoods() { - // TODO Auto-generated method stub - return retailerDao.viewGoods(); - } - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/SupplierService.java b/9SuperMarketJavaConfig/src/main/java/service/SupplierService.java deleted file mode 100644 index b230abd2..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/SupplierService.java +++ /dev/null @@ -1,30 +0,0 @@ -package service; - -/** - * this interface contains various operations. - */ -public interface SupplierService { - - /** - * this method is used to invoke the Repository method addSupplier - * which will hit the databases. - * - */ - int addSupplier(int supplierId, String supplierName, - String supplierAddress, int quantityOrder, int orderId, - double amount); - /** - * this method is used to invoke the Repository method removeSupplier - * which will hit the databases. - * - */ - int removeSupplier(int supplierId); - - /** - * this method is used to invoke the Repository method addSupplier - * which will hit the databases. - * - */ - int updateSupplier(int supplierId,String supplierName); - -} diff --git a/9SuperMarketJavaConfig/src/main/java/service/SupplierServiceImpl.java b/9SuperMarketJavaConfig/src/main/java/service/SupplierServiceImpl.java deleted file mode 100644 index 1ea11f11..00000000 --- a/9SuperMarketJavaConfig/src/main/java/service/SupplierServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import repository.SupplierDAO; - -/** - * this class implementing methods of its parent interface - */ - -@Service("supplierService") -public class SupplierServiceImpl implements SupplierService { - - /** - * @param supplierDAO - * this will be used to access DAO methods - */ - @Autowired - private SupplierDAO supplierDAO; - - /** - * @param supplierDAO - */ - - @Override - public int addSupplier(final int supplierId, final String supplierName, final String supplierAddress, - final int quantityOrder, final int orderId, final double amount) { - - // SupplierDAO supplierDAO = null; - final int addData = supplierDAO.addSupplier(supplierId, supplierName, supplierAddress, quantityOrder, orderId, - amount); - return addData; - - } - - @Override - public int removeSupplier(final int supplierId) { - // final SupplierDAO supplierDAO = null; - final int removeData = supplierDAO.removeSupplier(supplierId); - return removeData; - } - - @Override - public int updateSupplier(final int supplierId, final String supplierName) { - final SupplierDAO supplierDAO = null; - int removeData = supplierDAO.updateSupplier(supplierId, supplierName); - return removeData; - } - -} diff --git a/9SuperMarketJavaConfig/src/main/resources/applicationContext.xml b/9SuperMarketJavaConfig/src/main/resources/applicationContext.xml deleted file mode 100644 index 70653781..00000000 --- a/9SuperMarketJavaConfig/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/src/main/resources/database.properties b/9SuperMarketJavaConfig/src/main/resources/database.properties deleted file mode 100644 index 9c1f900e..00000000 --- a/9SuperMarketJavaConfig/src/main/resources/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=com.mysql.jdbc.Driver -url=jdbc:mysql://localhost:3306/mydb1 -dbuser=root -dbpassword=root \ No newline at end of file diff --git a/9SuperMarketJavaConfig/src/test/java/com/training/groceryApp/AppTest.java b/9SuperMarketJavaConfig/src/test/java/com/training/groceryApp/AppTest.java deleted file mode 100644 index 6d9a363e..00000000 --- a/9SuperMarketJavaConfig/src/test/java/com/training/groceryApp/AppTest.java +++ /dev/null @@ -1,444 +0,0 @@ -package com.training.groceryApp; - -import static org.hamcrest.CoreMatchers.hasItems; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import controller.AppJavaConfig; -import model.Customer; - -import model.Goods; -import model.Retailer; -import model.Supplier; -import repository.CustomerDAOImpl; -import repository.GoodsDAOImpl; -import service.CustomerService; -import service.CustomerServiceImpl; -import service.GoodsServiceImpl; -import service.RetailerService; -import service.RetailerServiceImpl; -import service.SupplierService; -import service.SupplierServiceImpl; - -/** - * Unit test for simple Application. - */ -public class AppTest { - - CustomerDAOImpl testAddCustomer; - GoodsDAOImpl testGoods; - - final ApplicationContext context = new AnnotationConfigApplicationContext(AppJavaConfig.class); - - final GoodsServiceImpl goodsService = context.getBean("goodsService", GoodsServiceImpl.class); - final CustomerService customerService = context.getBean("customerService", CustomerServiceImpl.class); - final SupplierService supplierService = context.getBean("supplierService", SupplierServiceImpl.class); - final RetailerService retailerService = context.getBean("retailerService", RetailerServiceImpl.class); - - // Testing Addcustomer method - - @Test - public void addCustomerToDAtabase() { - final long id = 0; - - final Customer customer = new Customer(11, "mukund", "melbern", "credit"); // - assertNotEquals("Invalid id", id, customer.getCustomerId()); // - - long dummy = 1; - final long value = customerService.addCustomer(customer); - - assertEquals("", dummy, value); - - } - - @Test - public void addCustomerToDAtabase1() { - final String name = null; - final Customer customer = new Customer(19, "mukund", "melbern", "credit"); // - - assertNotEquals("Invalid name", name, customer.getCustomerName()); - } - - @Test - public void addCustomerToDAtabase2() { - final String address = null; - final Customer customer = new Customer(19, "mukund", "melbern", "credit"); // - - assertNotEquals("Invalid name", address, customer.getCustomerName()); - } - - @Test - public void addCustomerToDAtabase3() { - final String payment = null; - final Customer customer = new Customer(19, "mukund", "melbern", "credit"); - assertNotEquals("Invalid name", payment, customer.getCustomerName()); - } - - // Junit for deleting a customer - - @Test - public void deleteCustomer() { - long dummy = 1; - final long value = customerService.removeCusotmer(102); - assertEquals("", dummy, value); - } - - // Junit for updating Name of customer - - @Test - public void updateCustomer() { - - // customer.setPaymentMode("credit"); - final long value = customerService.updateCustomer(2, "Ramesh"); - assertEquals("", 1, value); - } - - // Junit for adding a goodIntoDB - - @Test - public void addGoods() { - Goods goods = new Goods(1002, "kitkat", 5, 12.00); - long value = goodsService.addGoods(goods); - assertEquals("", 1002, value); - } - - // Junit for remove a good IntoDB - @Test - public void removeGoods() { - long value = goodsService.removeGoods(1001); - - assertEquals(1, value); - } - - // Junit for updating a goodIntoDB - @Test - public void updateGoods() { - long value = goodsService.updateGoods(1, "apple"); - - assertEquals("", 1, value); - } - - @Test - public void viewCustomer() { - - final List list = retailerService.viewCustomer(2); - assertThat(list, - hasItems((new Customer(5, "rohit", "mumbai", "credit")), new Customer(3, "sona", "chennai", "credit"))); - - } - - @Test - public void viewSupplier() { - final List list = retailerService.viewSupplier(1); - assertThat(list, hasItems((new Supplier(103, "Rahul", "nagpur", 20, 112, 20)), - (new Supplier(101, "kiran", "Newyork", 20, 112, 40)))); - } - - @Test - public void viewGoods() { - final List list = retailerService.viewGoods(); - assertThat(list, hasItems(new Goods(1002, "kitkat", 12, 40))); - } - - // Checking Retailer Entity for null values - @Test - public void checkForNull() { - final String retailerName = null; - final String retailerAddress = null; - - final Retailer retailer = new Retailer("Spectre Litt", "NY"); - assertNotEquals("Enter valid Name", retailerName, retailer.getRetailerName()); - - // assertNotEquals("Enter valid address", retailerAddress, - // retailer.getRetailerAddres()); - } - - public void checkForNullAddress() { - // final String retailerName = null; - final String retailerAddress = null; - - final Retailer retailer = new Retailer("Spectre Litt", "NY"); - // assertNotEquals("Enter valid Name", retailerName, - // retailer.getRetailerName()); - - assertNotEquals("Enter valid address", retailerAddress, retailer.getRetailerAddres()); - } - - // Checking Customer Entity for null values - @Test - public void checkForNullCustomer() { - - final String customerId = null; - - final String paymentMode = null; - - final Customer customer = new Customer(1, "rama", "wardhaa", "debitcard"); - assertNotEquals("Enter valid id", customerId, customer.getCustomerId()); - - assertNotEquals("Enter valid paymentMode", paymentMode, customer.getPaymentMode()); - } - - @Test - public void checkCustName() { - final String customerName = null; - final Customer customer = new Customer(1, "rama", "wardhaa", "debitcard"); - assertNotEquals("Enter valid name", customerName, customer.getCustomerName()); - } - - @Test - public void checkCustAddress() { - final String customerAddress = null; - final Customer customer = new Customer(1, "rama", "wardhaa", "debitcard"); - assertNotEquals("Enter valid address", customerAddress, customer.getCustomerAddress()); - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierId() { - - final int supplierId = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid id", supplierId, supplier.getSupplierId()); - - } - - public void checkForNullSupplierName() { - - final String supplierName = null; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - System.out.println("supplier:" + supplier); - // assertNotEquals("Enter valid id", supplierId, supplier.getSupplierId()); - assertNotEquals("Enter valid name", supplierName, supplier.getSupplierName()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierquantityOrder() { - - final int quantityOrder = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid quantity", quantityOrder, supplier.getQuantityOrder()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierAddress() { - - final String supplierAddress = null; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid address", supplierAddress, supplier.getSupplierAddress()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierOrderID() { - - final int orderId = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid Id", orderId, supplier.getOrderId()); - - } - - // Checking Supplier Entity for null values - @Test - public void checkForNullSupplierAmount() { - - final double amount = 0; - - Supplier supplier = new Supplier(1, "Jessica", "10th Street", 2, 1, 1990.00); - // System.out.println("supplier:" + supplier); - assertNotEquals("Enter valid amount", amount, supplier.getAmount()); - - } - - @Test - public void checkforCustomerOneArg() { - - final String name = null; - - final Customer customer = new Customer("johan"); - assertNotEquals("Enter valid id", name, customer.getCustomerId()); - - // System.out.println("supplier:" + supplier); - - - } - - - @Test - public void checkforsupplierid() - { - long supplierId=0; - Supplier supplier=new Supplier(706,"raman","andheri",10,25,2000); - assertNotEquals("Invalid id",supplierId,supplier.getSupplierId()); - } - - @Test - public void checkforsuppliername() - { - String supplierName=null; - Supplier supplier=new Supplier(706,"raman","andheri",10,25,2000); - assertNotEquals("Invalid name",supplierName,supplier.getSupplierName()); - } - @Test - public void checkforsupplieraddress() - { - String supplierAddress=null; - Supplier supplier=new Supplier(706,"raman","andheri",10,25,2000); - assertNotEquals("Invalid address",supplierAddress,supplier.getSupplierAddress()); - } - - @Test - public void checkforquantityOrder() - { - long quantityOrder=0;; - Supplier supplier=new Supplier(706,"raman","andheri",10,25,2000); - assertNotEquals("Invalid order quantity",quantityOrder,supplier.getQuantityOrder()); - } - @Test - public void checkfororderId() - { - long orderId=0; - Supplier supplier=new Supplier(706,"raman","andheri",10,25,2000); - assertNotEquals("Invalid order id",orderId,supplier.getOrderId()); - } - - @Test - public void checkforamount() - { - float amount=0; - Supplier supplier=new Supplier(706,"raman","andheri",10,25,2000); - assertNotEquals("Invalid amount",amount,supplier.getAmount()); - } - - - - - - - - - - - @Test - public void testSetRetailerName() { - Retailer rname = new Retailer(); - rname.setRetailerName("Thanos"); - assertTrue(rname.getRetailerName() == "Thanos"); - } - - - - @Test - public void testSetRetailerAddress() { - Retailer raddress = new Retailer(); - raddress.setRetailerName("Knowwhere"); - assertTrue(raddress.getRetailerAddres() == "Knowwhere"); - } - - @Test - public void testGetAddress(){ - Retailer rname = new Retailer(); - rname.setRetailerAddres("wardhaa"); - assertTrue(rname.getRetailerAddres() == "wardhaa"); - } - - - - @Test - public void testGetName(){ - Retailer rname = new Retailer(); - rname.setRetailerName("gamora"); - assertTrue(rname.getRetailerName() == "gamora"); - } - - - - - @Test - public void testSetGoodsId() { - final Goods goods = new Goods(); - goods.setGoodsId(8); - assertTrue(goods.getGoodsId() == 8); - } - - - - @Test - public void testSetGoodsName() { - final Goods goods = new Goods(); - goods.setGoodsName("Thanos"); - assertTrue(goods.getGoodsName() == "Thanos"); - } - - - - @Test - public void testsetGoodsQuantity() { - final Goods goods = new Goods(); - goods.setGoodsQuantity(5); - assertTrue(goods.getGoodsQuantity() == 5); - } - - - - @Test - public void testsetGoodsPrice() { - final Goods goods = new Goods(); - goods.setGoodsPrice(552); - assertTrue(goods.getGoodsPrice() == 552); - } - - - - @Test - public void testGetId() { - final Goods goods = new Goods(); - goods.setGoodsId(1); - assertTrue(goods.getGoodsId() == 1); - } - - @Test - public void testGetGoodsName() { - final Goods goods = new Goods(); - goods.setGoodsName("ironman"); - assertTrue(goods.getGoodsName() == "ironman"); - } - - - @Test - public void testGetQuantity() { - final Goods goods = new Goods(); - goods.setGoodsQuantity(8); - assertTrue(goods.getGoodsQuantity() == 8); - } - - - @Test - public void testGetPrice() { - final Goods goods = new Goods(); - goods.setGoodsPrice(8); - assertTrue(goods.getGoodsPrice() == 8); - } - -} diff --git a/9SuperMarketJavaConfig/target/classes/META-INF/MANIFEST.MF b/9SuperMarketJavaConfig/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index c8c47a73..00000000 --- a/9SuperMarketJavaConfig/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: Ram -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/9SuperMarketJavaConfig/target/classes/META-INF/maven/com.training/groceryApp/pom.properties b/9SuperMarketJavaConfig/target/classes/META-INF/maven/com.training/groceryApp/pom.properties deleted file mode 100644 index d03f0f7f..00000000 --- a/9SuperMarketJavaConfig/target/classes/META-INF/maven/com.training/groceryApp/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Sat May 05 13:26:20 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.training -m2e.projectName=SuperMarketJavaConfig -m2e.projectLocation=E\:\\JavaTraining-Capg\\SuperMarketJavaConfig -artifactId=groceryApp diff --git a/9SuperMarketJavaConfig/target/classes/META-INF/maven/com.training/groceryApp/pom.xml b/9SuperMarketJavaConfig/target/classes/META-INF/maven/com.training/groceryApp/pom.xml deleted file mode 100644 index 5ee67adb..00000000 --- a/9SuperMarketJavaConfig/target/classes/META-INF/maven/com.training/groceryApp/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - 4.0.0 - - com.training - groceryApp - 0.0.1-SNAPSHOT - - groceryApp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - org.springframework - spring-context - 5.0.5.RELEASE - - - - mysql - mysql-connector-java - 5.1.38 - - - jstl - jstl - 1.2 - - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.springframework - spring-jdbc - 5.0.5.RELEASE - - - - org.springframework - spring-tx - 5.0.5.RELEASE - - - - junit - junit - 4.11 - test - - - - - - - - - maven-clean-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.7.0 - - - maven-surefire-plugin - 2.20.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/9SuperMarketJavaConfig/target/classes/MainServlet/DemoServlet.class b/9SuperMarketJavaConfig/target/classes/MainServlet/DemoServlet.class deleted file mode 100644 index c5ae59b8..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/MainServlet/DemoServlet.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/applicationContext.xml b/9SuperMarketJavaConfig/target/classes/applicationContext.xml deleted file mode 100644 index 70653781..00000000 --- a/9SuperMarketJavaConfig/target/classes/applicationContext.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/9SuperMarketJavaConfig/target/classes/controller/AppJavaConfig.class b/9SuperMarketJavaConfig/target/classes/controller/AppJavaConfig.class deleted file mode 100644 index ef16c1b5..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/controller/AppJavaConfig.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/controller/GroceryMain.class b/9SuperMarketJavaConfig/target/classes/controller/GroceryMain.class deleted file mode 100644 index cb770c1f..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/controller/GroceryMain.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/database.properties b/9SuperMarketJavaConfig/target/classes/database.properties deleted file mode 100644 index 9c1f900e..00000000 --- a/9SuperMarketJavaConfig/target/classes/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=com.mysql.jdbc.Driver -url=jdbc:mysql://localhost:3306/mydb1 -dbuser=root -dbpassword=root \ No newline at end of file diff --git a/9SuperMarketJavaConfig/target/classes/model/Customer.class b/9SuperMarketJavaConfig/target/classes/model/Customer.class deleted file mode 100644 index 22916dc7..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/model/Customer.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/model/Goods.class b/9SuperMarketJavaConfig/target/classes/model/Goods.class deleted file mode 100644 index 61a9f50f..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/model/Goods.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/model/Retailer.class b/9SuperMarketJavaConfig/target/classes/model/Retailer.class deleted file mode 100644 index 211a6b65..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/model/Retailer.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/model/Supplier.class b/9SuperMarketJavaConfig/target/classes/model/Supplier.class deleted file mode 100644 index 3d32ef48..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/model/Supplier.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/CustomerDAO.class b/9SuperMarketJavaConfig/target/classes/repository/CustomerDAO.class deleted file mode 100644 index dea0d980..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/CustomerDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/CustomerDAOImpl.class b/9SuperMarketJavaConfig/target/classes/repository/CustomerDAOImpl.class deleted file mode 100644 index e5c97de8..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/CustomerDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/GoodsDAO.class b/9SuperMarketJavaConfig/target/classes/repository/GoodsDAO.class deleted file mode 100644 index d9848dd9..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/GoodsDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/GoodsDAOImpl.class b/9SuperMarketJavaConfig/target/classes/repository/GoodsDAOImpl.class deleted file mode 100644 index 04ee97f8..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/GoodsDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAO.class b/9SuperMarketJavaConfig/target/classes/repository/RetailerDAO.class deleted file mode 100644 index 19e875a9..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$1.class b/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$1.class deleted file mode 100644 index a4ce2e81..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$1.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$2.class b/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$2.class deleted file mode 100644 index b2770003..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$2.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$3.class b/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$3.class deleted file mode 100644 index 1829fec0..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl$3.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl.class b/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl.class deleted file mode 100644 index c945433c..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/RetailerDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/SupplierDAO.class b/9SuperMarketJavaConfig/target/classes/repository/SupplierDAO.class deleted file mode 100644 index 8890dc82..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/SupplierDAO.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/repository/SupplierDAOImpl.class b/9SuperMarketJavaConfig/target/classes/repository/SupplierDAOImpl.class deleted file mode 100644 index fe2f4dae..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/repository/SupplierDAOImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/CustomerService.class b/9SuperMarketJavaConfig/target/classes/service/CustomerService.class deleted file mode 100644 index ab30bb32..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/CustomerService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/CustomerServiceImpl.class b/9SuperMarketJavaConfig/target/classes/service/CustomerServiceImpl.class deleted file mode 100644 index d40e4e97..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/CustomerServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/GoodsSeriveImpl.class b/9SuperMarketJavaConfig/target/classes/service/GoodsSeriveImpl.class deleted file mode 100644 index 712bf619..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/GoodsSeriveImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/GoodsService.class b/9SuperMarketJavaConfig/target/classes/service/GoodsService.class deleted file mode 100644 index 5216a5d2..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/GoodsService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/GoodsServiceImpl.class b/9SuperMarketJavaConfig/target/classes/service/GoodsServiceImpl.class deleted file mode 100644 index 4fbad9ef..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/GoodsServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/RetailerService.class b/9SuperMarketJavaConfig/target/classes/service/RetailerService.class deleted file mode 100644 index f93c5931..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/RetailerService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/RetailerServiceImpl.class b/9SuperMarketJavaConfig/target/classes/service/RetailerServiceImpl.class deleted file mode 100644 index 171a5c11..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/RetailerServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/SupplierService.class b/9SuperMarketJavaConfig/target/classes/service/SupplierService.class deleted file mode 100644 index 26e0ece2..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/SupplierService.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/classes/service/SupplierServiceImpl.class b/9SuperMarketJavaConfig/target/classes/service/SupplierServiceImpl.class deleted file mode 100644 index 9ea7a5b9..00000000 Binary files a/9SuperMarketJavaConfig/target/classes/service/SupplierServiceImpl.class and /dev/null differ diff --git a/9SuperMarketJavaConfig/target/test-classes/com/training/groceryApp/AppTest.class b/9SuperMarketJavaConfig/target/test-classes/com/training/groceryApp/AppTest.class deleted file mode 100644 index e2c7ce61..00000000 Binary files a/9SuperMarketJavaConfig/target/test-classes/com/training/groceryApp/AppTest.class and /dev/null differ diff --git a/EurekaServerUsingConfigerver/17BankInCapg/.eclipse-pmd b/EurekaServerUsingConfigerver/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/17BankInCapg/.gitignore b/EurekaServerUsingConfigerver/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingConfigerver/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingConfigerver/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingConfigerver/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingConfigerver/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingConfigerver/17BankInCapg/mvnw b/EurekaServerUsingConfigerver/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingConfigerver/17BankInCapg/mvnw.cmd b/EurekaServerUsingConfigerver/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingConfigerver/17BankInCapg/pom.xml b/EurekaServerUsingConfigerver/17BankInCapg/pom.xml deleted file mode 100644 index 69238d4e..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BankInApp - 0.0.1-SNAPSHOT - jar - - BankInApp - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 8.0.11 - runtime - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-config-client - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - org.springframework.cloud - spring-cloud-starter-feign - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java deleted file mode 100644 index 5b08f95f..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; - -@SpringBootApplication -@EnableEurekaClient -@EnableFeignClients -public class BankApplicationMain { - - public static void main(String[] args) { - SpringApplication.run(BankApplicationMain.class, args); - } - - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index e0d9d2c7..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - System.out.println(">>>>>>>>>>>>>>>>>>>"+cust); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/ATM.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 419e5435..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "atm_id") - private Long aTMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return aTMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - this.aTMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + aTMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - aTMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Account.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 4188d6a0..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index 74936323..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.model; - -import java.sql.Timestamp; -import java.util.Date; - -public class AuditLog { - - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Date eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Bank.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index 495ed86d..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Customer.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index 8b08ed43..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.bank.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index 66e7bd96..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c3c75f02..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Account; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - - - Optional findBydenomination(BigDecimal myValue); - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index 68015678..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - - Optional findByaTMId(Long aTMId); - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index 927e0bee..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - - - - Optional findByaccountId(Long accountId); - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 68dc6ea5..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.ATM; -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - - - Optional findBybankId(Long bankId); -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index 7e470336..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneBycustomerName(String CustomerName); - - Optional findBycustomerId(Long customerId); -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 8ae3342d..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - - - Optional findBydenomination(BigDecimal myValue); - - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index 9a71ec7c..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - - - - Optional findBydenomination(BigDecimal denomination); - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index 28627986..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - //method needs to be change - final Optional atm = atmRepo.findByaTMId(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findByaTMId(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index 232f9c26..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findByaccountId(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index ed877efb..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - - //changes made to findById - Optional deno=atmdenoRepository.findBydenomination(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findByaTMId(atmId).get(); - //changes made to findById - BankDenomination bank=bankDeno.findBydenomination(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index 0301a571..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/*package com.bank.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - @Autowired - RestTemplate restTemplate; - - @Bean - @LoadBalanced - RestTemplate restTemplate() { - return new RestTemplate(); - } - - // generate audit log - public AuditLog generateAudit(final AuditLog audit) { - - final String uri = "http://mongo-client/createAudit"; - System.out.println("audit obnject " + audit); - final AuditLog audii = restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - - } - - - * @Autowired private DiscoveryClient discoveryClient; - * - * - * public AuditLog generateAudit(AuditLog auditData) { List - * instance=discoveryClient.getInstances("MONGO-CLIENT"); ServiceInstance - * serviceInstance=instance.get(0); RestTemplate restTemplate = new - * RestTemplate(); - * - * String url =serviceInstance.getUri().toString(); url=url+"/create"; AuditLog - * audit = auditData; System.out.println(audit);; AuditLog resultOfOperation = - * restTemplate.postForObject(url, audit, AuditLog.class); return - * resultOfOperation; } - - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index a77ef1af..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - //chnages to be made after downgrading spring boot version - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index ae1f2fe6..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // changes made in repo - final Optional bank = bankRepository.findBybankId(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index b38547f7..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.service; - - - -import java.util.Calendar; -import java.util.Date; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService, Cloneable { - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - /*@Autowired - AuditServiceImpl auditService;*/ - @Autowired - IFeignClient fclient; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Calendar cal=Calendar.getInstance(); - Date time=cal.getTime(); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - //AuditLog ob = auditService.generateAudit(audit); - - AuditLog ob = fclient.create(audit); - - - return cust; - } else { - LOGGER.info("Customer not present as Id not present"); - throw new ManagedException("customer data not updated"); - } - - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java deleted file mode 100644 index 8f3f7c06..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.bank.service; - -import org.springframework.cloud.netflix.feign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import com.bank.model.AuditLog; - -/** - * @author trainee - * - */ -@FeignClient("mongo-client") -public interface IFeignClient { - - @PostMapping(path = "/auditLog") - AuditLog create(final AuditLog audit); - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index bc21cee6..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - //changes to be made after version chnage - if(!refRepo.findBydenomination(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/resources/application.properties b/EurekaServerUsingConfigerver/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index 18741218..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,16 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.application.name=application -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -#spring.cloud.config.server.git.uri=https://github.com/ramdafale/bank-config-server -#spring.datasource.username=root -#spring.datasource.password=root -#spring.jpa.hibernate.ddl-auto=update -#spring.jpa.show-sql=true - -#Mongo -#eureka.client.service-url.defaultZone=http://localhost:8762/eureka -#eureka.client.service-url.defaultZone=https://github.com/ramdafale/bank-config-server - - - - diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/main/resources/bootstrap.properties b/EurekaServerUsingConfigerver/17BankInCapg/src/main/resources/bootstrap.properties deleted file mode 100644 index 5055004a..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/main/resources/bootstrap.properties +++ /dev/null @@ -1,2 +0,0 @@ - -spring.cloud.config.uri=http://localhost:8888 \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/EurekaServerUsingConfigerver/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index c0e05706..00000000 --- a/EurekaServerUsingConfigerver/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -/*package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -}*/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/.classpath b/EurekaServerUsingConfigerver/employee-zuul-service/.classpath deleted file mode 100644 index 9fc2de7b..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/.classpath +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/.project b/EurekaServerUsingConfigerver/employee-zuul-service/.project deleted file mode 100644 index ea9f7ca0..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - zuul-service1 - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.eclipse.jdt.core.prefs b/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 13b3428a..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not 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.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.eclipse.m2e.core.prefs b/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.springframework.ide.eclipse.prefs b/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index a12794d6..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/pom.xml b/EurekaServerUsingConfigerver/employee-zuul-service/pom.xml deleted file mode 100644 index fda87fc6..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - com.javainuse - zuul-service1 - 0.0.1-SNAPSHOT - jar - - SpringBootHelloWorld - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.cloud - spring-cloud-starter-zuul - - - - org.springframework.cloud - spring-cloud-starter-eureka - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Camden.SR6 - pom - import - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/SpringBootHelloWorldApplication.java b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/SpringBootHelloWorldApplication.java deleted file mode 100644 index 5e3b8f9b..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/SpringBootHelloWorldApplication.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.javainuse; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; -import org.springframework.context.annotation.Bean; - -import com.javainuse.filter.ErrorFilter; -import com.javainuse.filter.PostFilter; -import com.javainuse.filter.PreFilter; -import com.javainuse.filter.RouteFilter; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableZuulProxy -public class SpringBootHelloWorldApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringBootHelloWorldApplication.class, args); - } - - @Bean - public PreFilter preFilter() { - return new PreFilter(); - } - - @Bean - public PostFilter postFilter() { - return new PostFilter(); - } - - @Bean - public ErrorFilter errorFilter() { - return new ErrorFilter(); - } - - @Bean - public RouteFilter routeFilter() { - return new RouteFilter(); - } -} \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/ErrorFilter.java b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/ErrorFilter.java deleted file mode 100644 index afd94384..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/ErrorFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.javainuse.filter; - -import com.netflix.zuul.ZuulFilter; - -public class ErrorFilter extends ZuulFilter { - - @Override - public String filterType() { - return "error"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - System.out.println("Using Route Filter"); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/PostFilter.java b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/PostFilter.java deleted file mode 100644 index f796421b..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/PostFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.javainuse.filter; - -import com.netflix.zuul.ZuulFilter; - -public class PostFilter extends ZuulFilter { - - @Override - public String filterType() { - return "post"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - System.out.println("Using Post Filter"); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/PreFilter.java b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/PreFilter.java deleted file mode 100644 index 234a7880..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/PreFilter.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.javainuse.filter; - -import javax.servlet.http.HttpServletRequest; - -import com.netflix.zuul.ZuulFilter; -import com.netflix.zuul.context.RequestContext; - -public class PreFilter extends ZuulFilter { - - @Override - public String filterType() { - return "pre"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - RequestContext ctx = RequestContext.getCurrentContext(); - HttpServletRequest request = ctx.getRequest(); - - System.out.println( - "Request Method : " + request.getMethod() + " Request URL : " + request.getRequestURL().toString()); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/RouteFilter.java b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/RouteFilter.java deleted file mode 100644 index a10114eb..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/java/com/javainuse/filter/RouteFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.javainuse.filter; - -import com.netflix.zuul.ZuulFilter; - -public class RouteFilter extends ZuulFilter { - - @Override - public String filterType() { - return "route"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - System.out.println("Using Route Filter"); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/resources/application.properties b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/resources/application.properties deleted file mode 100644 index 11864399..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -#zuul.routes.producer.url=http://localhost:8082 -#zuul.routes.auditLog.service-id=mongo-client - - -#zuul.routes.auditLog.url=http://localhost:8082 - - -zuul.routes.auditLog.serviceId :mongo-client - -eureka.client.serviceUrl.defaultZone=http://localhost:8762/eureka -server.port=8079 \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/resources/bootstrap.properties b/EurekaServerUsingConfigerver/employee-zuul-service/src/main/resources/bootstrap.properties deleted file mode 100644 index 0d4a877e..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/src/main/resources/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-zuul-service \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/MANIFEST.MF b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index 5c0fc63d..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Implementation-Title: SpringBootHelloWorld -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: trainee -Implementation-Vendor-Id: com.javainuse -Build-Jdk: 1.8.0_171 -Implementation-URL: http://projects.spring.io/spring-boot/zuul-service - 1/ -Created-By: Maven Integration for Eclipse -Implementation-Vendor: Pivotal Software, Inc. - diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/zuul-service1/pom.properties b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/zuul-service1/pom.properties deleted file mode 100644 index 22cef4c5..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/zuul-service1/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Wed May 30 13:07:36 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.javainuse -m2e.projectName=zuul-service1 -m2e.projectLocation=D\:\\training\\employee-zuul-service -artifactId=zuul-service1 diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/zuul-service1/pom.xml b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/zuul-service1/pom.xml deleted file mode 100644 index fda87fc6..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/zuul-service1/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - com.javainuse - zuul-service1 - 0.0.1-SNAPSHOT - jar - - SpringBootHelloWorld - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.cloud - spring-cloud-starter-zuul - - - - org.springframework.cloud - spring-cloud-starter-eureka - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Camden.SR6 - pom - import - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/application.properties b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/application.properties deleted file mode 100644 index 11864399..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -#zuul.routes.producer.url=http://localhost:8082 -#zuul.routes.auditLog.service-id=mongo-client - - -#zuul.routes.auditLog.url=http://localhost:8082 - - -zuul.routes.auditLog.serviceId :mongo-client - -eureka.client.serviceUrl.defaultZone=http://localhost:8762/eureka -server.port=8079 \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/bootstrap.properties b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/bootstrap.properties deleted file mode 100644 index 0d4a877e..00000000 --- a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-zuul-service \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/SpringBootHelloWorldApplication.class b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/SpringBootHelloWorldApplication.class deleted file mode 100644 index 1c93ae2c..00000000 Binary files a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/SpringBootHelloWorldApplication.class and /dev/null differ diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/ErrorFilter.class b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/ErrorFilter.class deleted file mode 100644 index aef35f87..00000000 Binary files a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/ErrorFilter.class and /dev/null differ diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/PostFilter.class b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/PostFilter.class deleted file mode 100644 index cb402b03..00000000 Binary files a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/PostFilter.class and /dev/null differ diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/PreFilter.class b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/PreFilter.class deleted file mode 100644 index 46714441..00000000 Binary files a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/PreFilter.class and /dev/null differ diff --git a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/RouteFilter.class b/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/RouteFilter.class deleted file mode 100644 index faef8217..00000000 Binary files a/EurekaServerUsingConfigerver/employee-zuul-service/target/classes/com/javainuse/filter/RouteFilter.class and /dev/null differ diff --git a/EurekaServerUsingConfigerver/eurekaserver/.gitignore b/EurekaServerUsingConfigerver/eurekaserver/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/eurekaserver/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingConfigerver/eurekaserver/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingConfigerver/eurekaserver/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingConfigerver/eurekaserver/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingConfigerver/eurekaserver/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingConfigerver/eurekaserver/mvnw b/EurekaServerUsingConfigerver/eurekaserver/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingConfigerver/eurekaserver/mvnw.cmd b/EurekaServerUsingConfigerver/eurekaserver/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingConfigerver/eurekaserver/pom.xml b/EurekaServerUsingConfigerver/eurekaserver/pom.xml deleted file mode 100644 index 7d38d405..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - 4.0.0 - - com.github.rawsanj - eureka-server - 0.0.1-SNAPSHOT - jar - - eureka-server - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java b/EurekaServerUsingConfigerver/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java deleted file mode 100644 index 1b2a6ba0..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.eurekaserver; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; - -@SpringBootApplication -@EnableEurekaServer -public class EurekaserverApplication { - - public static void main(String[] args) { - SpringApplication.run(EurekaserverApplication.class, args); - } -} diff --git a/EurekaServerUsingConfigerver/eurekaserver/src/main/resources/application.properties b/EurekaServerUsingConfigerver/eurekaserver/src/main/resources/application.properties deleted file mode 100644 index a4548d51..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/src/main/resources/application.properties +++ /dev/null @@ -1,8 +0,0 @@ -server.port=8762 - - -spring.application.name=EurekaSErver - - - -#eureka.client.serviceUrl.defaultZone= http://localhost:8762/eureka \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java b/EurekaServerUsingConfigerver/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java deleted file mode 100644 index a20f6a0f..00000000 --- a/EurekaServerUsingConfigerver/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.eurekaserver; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class EurekaserverApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/.gitignore b/EurekaServerUsingConfigerver/mongodbClient2/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/mongodbClient2/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingConfigerver/mongodbClient2/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingConfigerver/mongodbClient2/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingConfigerver/mongodbClient2/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingConfigerver/mongodbClient2/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingConfigerver/mongodbClient2/bootstrap.properties b/EurekaServerUsingConfigerver/mongodbClient2/bootstrap.properties deleted file mode 100644 index a2136c3d..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/bootstrap.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.application.name=mongo-service -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8082 -spring.cloud.config.uri=http://localhost:8888 \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/mongodbClient2/mvnw b/EurekaServerUsingConfigerver/mongodbClient2/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingConfigerver/mongodbClient2/mvnw.cmd b/EurekaServerUsingConfigerver/mongodbClient2/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingConfigerver/mongodbClient2/pom.xml b/EurekaServerUsingConfigerver/mongodbClient2/pom.xml deleted file mode 100644 index 5ae6d0ab..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - - com.mongoDb - mongodbExample - 0.0.1-SNAPSHOT - jar - - mongodbExample - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - org.projectlombok - lombok - 1.16.20 - provided - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java deleted file mode 100644 index 134b6501..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -@SpringBootApplication -@EnableEurekaClient -public class MongoMain { - - public static void main(String[] args) { - SpringApplication.run(MongoMain.class, args); - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java deleted file mode 100644 index a8303759..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.mongo.db.controller; - -import java.util.List; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.service.IAuditService; -import com.mongo.db.vo.updateAuditRequest; - -/** - * @author trainee - * - */ -//@RequestMapping("/audit") -@RestController -public class AuditController { - - @Autowired - private IAuditService auditService; -/** - * - * @param audit - * @return - */ - @PostMapping - public ResponseEntitycreate(@RequestBody final AuditLog audit) - { - try { - auditService.createAudit(audit); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException exep) { - return new ResponseEntity(exep.getMessage(),HttpStatus.OK); - } - } - /** - * - * @param eventName - * @return - */ - @GetMapping("/{eventName}") - public ResponseEntitygetAudit(@PathVariable @NotNull final String eventName) - { - - try { - List list=auditService.getDetails(eventName); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @return - */ - @GetMapping - public ResponseEntitygetAllAudit() - { - - try { - List list=auditService.findall(); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param update - * @return - */ - @PutMapping - public ResponseEntityupdateAudit(@RequestBody final updateAuditRequest update) - { - - try { - AuditLog audit=auditService.update(update.getEventId(), update.getEventType()); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param eventId - * @return - */ - @DeleteMapping("{eventId}") - public ResponseEntitydeleteAudit(@PathVariable final UUID eventId) - { - - try { - - String audit=auditService.deleteAudit(eventId); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java deleted file mode 100644 index 1b55caac..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.mongo.db.document; - -import java.util.Date; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -public class AuditLog { - - @Id - @NotNull - private UUID eventID=UUID.randomUUID(); - @NotNull - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * - * @return the eventID - */ - public UUID getEventID() { - return eventID; - } - /** - * @param eventID the eventID to set - */ - public void setEventID(UUID eventID) { - this.eventID = eventID; - } - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /** - * @param eventID - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(UUID eventID, String eventName, String eventType, Date eventDate, String userId, - Object oldValue, Object newValue) { - super(); - this.eventID = eventID; - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventID=" + eventID + ", eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" - + eventDate + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - - - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java deleted file mode 100644 index 6479eb26..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mongo.db.document; - -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java deleted file mode 100644 index c61912ac..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db.exception; - -public class AuditException extends Exception{ - String msg; - - /** - * @param msg - */ - public AuditException(String msg) { - super(); - this.msg = msg; - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java deleted file mode 100644 index b7d4db13..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mongo.db.repo; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.mongo.db.document.AuditLog; - -/** - * @author trainee - * - */ -public interface AuditMongoRepository extends MongoRepository{ - - /** - * @param eventName - * @return - */ - List findByEventName(String eventName); - /** - * @param eventType - * @return - */ - AuditLog findByEventType(String eventType); - - - Optional findByeventID(UUID eventID); -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java deleted file mode 100644 index cd8286f6..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; - -@Service("auditService") -public class AuditServiceImpl implements IAuditService{ - - @Autowired - private AuditMongoRepository auditRepo; - @Override - public AuditLog createAudit(AuditLog audit)throws AuditException { - AuditLog audi= auditRepo.save(audit); - if(audi!=null) - { - return audi; - } - else - { - throw new AuditException("audit not added"); - } - } - - - - @Override - public String deleteAudit(UUID id) throws AuditException { - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - {AuditLog aud=audit.get(); - auditRepo.delete(aud);; - return "deleted"; - } - else - { - throw new AuditException("not deleted"); - } - } - - @Override - public AuditLog update(UUID id,String eventType) throws AuditException { - //changes made after downgrading application - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - { - AuditLog auditLog=audit.get(); - auditLog.setEventType(eventType); - AuditLog auu=auditRepo.save(auditLog); - return auu; - } - else - { - throw new AuditException("id not found!!!!"); - } - } - - - - @Override - public List getDetails(String eventName) throws AuditException { - // TODO Auto-generated method stub - List list=auditRepo.findByEventName(eventName); - if(list.isEmpty()) - { - throw new AuditException("List is empty"); - } - else - { - return list; - } - - } - - - - @Override - public List findall() throws AuditException { - // TODO Auto-generated method stub - return auditRepo.findAll(); - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java deleted file mode 100644 index db121ae5..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.UUID; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; - -public interface IAuditService { - - /** - * @method createAudit - * @param audit - * @return AuditLog object - * @throws AuditException - */ - AuditLog createAudit(AuditLog audit) throws AuditException; - /** - * @method getDetails - * @param eventName - * @return List - * @throws AuditException - */ - List getDetails(String eventName) throws AuditException; - /** - * @method deleteaudit - * @param id - * @return String - * @throws AuditException - */ - String deleteAudit(UUID id) throws AuditException; - /** - * @method update - * @param id - * @param eventType - * @return AuditLog - * @throws AuditException - */ - AuditLog update(UUID id,String eventType) throws AuditException; - /** - * @method findall - * @return List - * @throws AuditException - */ - List findall() throws AuditException; - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java b/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java deleted file mode 100644 index ac2a51a1..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mongo.db.vo; - -import java.util.UUID; - -public class updateAuditRequest { - - private UUID eventId; - private String eventType; - /** - * @return the eventId - */ - public UUID getEventId() { - return eventId; - } - /** - * @param eventId the eventId to set - */ - public void setEventId(UUID eventId) { - this.eventId = eventId; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - -} diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/main/resources/application.properties b/EurekaServerUsingConfigerver/mongodbClient2/src/main/resources/application.properties deleted file mode 100644 index 8c2930b7..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/main/resources/application.properties +++ /dev/null @@ -1,19 +0,0 @@ -#Mongo -#spring.data.mongodb.host=localhost -#spring.data.mongodb.port=27017 -#spring.data.mongodb.database=mongodb -#server.port=8082 - -#Register with eureka -eureka.client.service-url.defaultZone=http://localhost:8762/eureka - - - -#eureka.client.service-url.defaultZone=https://github.com/ramdafale/bank-config-server - - - - -spring.application.name=mongo-client - - diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java b/EurekaServerUsingConfigerver/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java deleted file mode 100644 index 86f4145b..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.document.BaseEntity; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; -import com.mongo.db.service.AuditServiceImpl; -import com.mongo.db.service.IAuditService; - -@RunWith(MockitoJUnitRunner.class) -public class MongoTest { - - @Mock - private AuditMongoRepository auditRepo; - - - @InjectMocks IAuditService auditServcie=new AuditServiceImpl(); - Date date=new Date(); - UUID id; - Timestamp time; - BaseEntity base1; - BaseEntity bsae2; - AuditLog audit; - AuditLog audit1; - AuditLog audit2; - @Before - public void init() - { - date=new Date(); - id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - time=new Timestamp(date.getTime()); - base1=new BaseEntity("1"); - bsae2=new BaseEntity("2"); - audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - audit1 =new AuditLog(UUID.fromString("38400000-8cf0-11cd-b23e-10b96e4ef00d"),"createnew","creation",time,"3",base1,bsae2); - } - @Test - public void auditcreateTest()throws AuditException - { Date date=new Date(); - UUID id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - Timestamp time=new Timestamp(date.getTime()); - BaseEntity base1=new BaseEntity("1"); - BaseEntity bsae2=new BaseEntity("2"); - AuditLog audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - Mockito.when(auditRepo.save(audit)).thenReturn(audit); - AuditLog audi; - - audi = auditServcie.createAudit(audit); - assertEquals("created",audi,audit); - } - @Test(expected=AuditException.class) - public void falsecreateTest() throws AuditException - { - AuditLog audit1=null; - Mockito.when(auditRepo.save(audit1)).thenReturn(audit1); - AuditLog audi; - audi = auditServcie.createAudit(audit1); - } - -@Test -public void auditgetDetails()throws AuditException -{ - - - List list=new ArrayList(); - - list.add(audit); - list.add(audit1); - Mockito.when(auditRepo.findByEventName("create")).thenReturn(list); - List newList=auditServcie.getDetails("create"); - assertEquals(list, newList); - -} -@Test(expected=AuditException.class) -public void auditgetDetailsfalse()throws AuditException -{ - - - List list=new ArrayList<>(); - Mockito.when(auditRepo.findByEventName("mongo")).thenReturn(list); - List newList=auditServcie.getDetails("mongo"); - - -} - -@Test -public void auditupdatetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - assertEquals(auditt,newAudit); -} - -@Test(expected=AuditException.class) -public void auditupdatefalsecase() throws AuditException -{ - Optional opt=Optional.empty(); - when(auditRepo.findById(id)).thenReturn(opt); - //AuditLog auditt=opt.get(); - //when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - -} - -@Test -public void auditdeletetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - - String newAudit=auditServcie.deleteAudit(id); - - assertEquals("deleted",newAudit); -} - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java b/EurekaServerUsingConfigerver/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java deleted file mode 100644 index 05b8eaef..00000000 --- a/EurekaServerUsingConfigerver/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mongoDb.mongodbExample; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class MongodbExampleApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.gitignore b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/mvnw b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/mvnw.cmd b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/pom.xml b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/pom.xml deleted file mode 100644 index c3bff8ef..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - 4.0.0 - - com.example - spring-cloud-config-server-new - 0.0.1-SNAPSHOT - jar - - spring-cloud-config-server-new - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.cloud - spring-cloud-config-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/main/java/com/example/demo/SpringCloudConfigServerNewApplication.java b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/main/java/com/example/demo/SpringCloudConfigServerNewApplication.java deleted file mode 100644 index 720b1380..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/main/java/com/example/demo/SpringCloudConfigServerNewApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.config.server.EnableConfigServer; - -@SpringBootApplication -@EnableConfigServer - -public class SpringCloudConfigServerNewApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringCloudConfigServerNewApplication.class, args); - } -} diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/main/resources/application.properties b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/main/resources/application.properties deleted file mode 100644 index 1b4d780b..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -server.port= 8888 - -#registration with eureka -spring.cloud.config.server.git.uri=https://github.com/ramdafale/bank-config-server -#spring.application.name=application.properties diff --git a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/test/java/com/example/demo/SpringCloudConfigServerNewApplicationTests.java b/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/test/java/com/example/demo/SpringCloudConfigServerNewApplicationTests.java deleted file mode 100644 index f3a395b4..00000000 --- a/EurekaServerUsingConfigerver/spring-cloud-config-server-new/src/test/java/com/example/demo/SpringCloudConfigServerNewApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.demo; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SpringCloudConfigServerNewApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/.eclipse-pmd b/EurekaServerUsingFeignClient/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/17BankInCapg/.gitignore b/EurekaServerUsingFeignClient/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingFeignClient/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingFeignClient/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingFeignClient/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingFeignClient/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingFeignClient/17BankInCapg/mvnw b/EurekaServerUsingFeignClient/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingFeignClient/17BankInCapg/mvnw.cmd b/EurekaServerUsingFeignClient/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingFeignClient/17BankInCapg/pom.xml b/EurekaServerUsingFeignClient/17BankInCapg/pom.xml deleted file mode 100644 index 1d6136d7..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BankInApp - 0.0.1-SNAPSHOT - jar - - BankInApp - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 8.0.11 - runtime - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - org.springframework.cloud - spring-cloud-starter-feign - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java deleted file mode 100644 index 85a1507a..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; -import org.springframework.web.bind.annotation.RequestMapping; - -@SpringBootApplication -@EnableEurekaClient -@EnableFeignClients -public class BankApplicationMain { - - - - - - - - public static void main(String[] args) { - SpringApplication.run(BankApplicationMain.class, args); - } - - - - - - - /* @RequestMapping("/greeting") - public String greeting() { - return "Hello from EurekaClient bank application!"; - }*/ -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index e0d9d2c7..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - System.out.println(">>>>>>>>>>>>>>>>>>>"+cust); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/ATM.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 419e5435..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "atm_id") - private Long aTMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return aTMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - this.aTMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + aTMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - aTMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Account.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 4188d6a0..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index 74936323..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.model; - -import java.sql.Timestamp; -import java.util.Date; - -public class AuditLog { - - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Date eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Bank.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index 495ed86d..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Customer.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index 8b08ed43..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.bank.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index 66e7bd96..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c3c75f02..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Account; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - - - Optional findBydenomination(BigDecimal myValue); - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index 68015678..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - - Optional findByaTMId(Long aTMId); - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index 927e0bee..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - - - - Optional findByaccountId(Long accountId); - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 68dc6ea5..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.ATM; -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - - - Optional findBybankId(Long bankId); -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index 7e470336..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneBycustomerName(String CustomerName); - - Optional findBycustomerId(Long customerId); -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 8ae3342d..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - - - Optional findBydenomination(BigDecimal myValue); - - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index 9a71ec7c..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - - - - Optional findBydenomination(BigDecimal denomination); - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index 28627986..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - //method needs to be change - final Optional atm = atmRepo.findByaTMId(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findByaTMId(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index 232f9c26..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findByaccountId(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index ed877efb..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - - //changes made to findById - Optional deno=atmdenoRepository.findBydenomination(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findByaTMId(atmId).get(); - //changes made to findById - BankDenomination bank=bankDeno.findBydenomination(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index 0301a571..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/*package com.bank.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - @Autowired - RestTemplate restTemplate; - - @Bean - @LoadBalanced - RestTemplate restTemplate() { - return new RestTemplate(); - } - - // generate audit log - public AuditLog generateAudit(final AuditLog audit) { - - final String uri = "http://mongo-client/createAudit"; - System.out.println("audit obnject " + audit); - final AuditLog audii = restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - - } - - - * @Autowired private DiscoveryClient discoveryClient; - * - * - * public AuditLog generateAudit(AuditLog auditData) { List - * instance=discoveryClient.getInstances("MONGO-CLIENT"); ServiceInstance - * serviceInstance=instance.get(0); RestTemplate restTemplate = new - * RestTemplate(); - * - * String url =serviceInstance.getUri().toString(); url=url+"/create"; AuditLog - * audit = auditData; System.out.println(audit);; AuditLog resultOfOperation = - * restTemplate.postForObject(url, audit, AuditLog.class); return - * resultOfOperation; } - - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index a77ef1af..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - //chnages to be made after downgrading spring boot version - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index ae1f2fe6..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // changes made in repo - final Optional bank = bankRepository.findBybankId(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index b38547f7..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.service; - - - -import java.util.Calendar; -import java.util.Date; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService, Cloneable { - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - /*@Autowired - AuditServiceImpl auditService;*/ - @Autowired - IFeignClient fclient; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Calendar cal=Calendar.getInstance(); - Date time=cal.getTime(); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - //AuditLog ob = auditService.generateAudit(audit); - - AuditLog ob = fclient.create(audit); - - - return cust; - } else { - LOGGER.info("Customer not present as Id not present"); - throw new ManagedException("customer data not updated"); - } - - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java deleted file mode 100644 index 98f45584..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.bank.service; - -import org.springframework.cloud.netflix.feign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import com.bank.model.AuditLog; - -/** - * @author trainee - * - */ -@FeignClient("mongo-client") -public interface IFeignClient { - - @PostMapping(path = "createAudit") - AuditLog create(final AuditLog audit); - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index bc21cee6..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - //changes to be made after version chnage - if(!refRepo.findBydenomination(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/resources/application.properties b/EurekaServerUsingFeignClient/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index b8e2a66e..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true - -#Mongo -eureka.client.service-url.defaultZone=http://localhost:8762/eureka - - - - diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/main/resources/bootstrap.properties b/EurekaServerUsingFeignClient/17BankInCapg/src/main/resources/bootstrap.properties deleted file mode 100644 index 39ea1a91..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/main/resources/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-client \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/EurekaServerUsingFeignClient/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index c0e05706..00000000 --- a/EurekaServerUsingFeignClient/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -/*package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -}*/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/eurekaserver/.gitignore b/EurekaServerUsingFeignClient/eurekaserver/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/eurekaserver/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingFeignClient/eurekaserver/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingFeignClient/eurekaserver/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingFeignClient/eurekaserver/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingFeignClient/eurekaserver/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingFeignClient/eurekaserver/mvnw b/EurekaServerUsingFeignClient/eurekaserver/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingFeignClient/eurekaserver/mvnw.cmd b/EurekaServerUsingFeignClient/eurekaserver/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingFeignClient/eurekaserver/pom.xml b/EurekaServerUsingFeignClient/eurekaserver/pom.xml deleted file mode 100644 index 7d38d405..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - 4.0.0 - - com.github.rawsanj - eureka-server - 0.0.1-SNAPSHOT - jar - - eureka-server - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java b/EurekaServerUsingFeignClient/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java deleted file mode 100644 index 1b2a6ba0..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.eurekaserver; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; - -@SpringBootApplication -@EnableEurekaServer -public class EurekaserverApplication { - - public static void main(String[] args) { - SpringApplication.run(EurekaserverApplication.class, args); - } -} diff --git a/EurekaServerUsingFeignClient/eurekaserver/src/main/resources/application.properties b/EurekaServerUsingFeignClient/eurekaserver/src/main/resources/application.properties deleted file mode 100644 index 90efd1c1..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -server.port=8762 - - - - - -spring.application.name=application-service - -eureka.client.register-with-eureka=false -eureka.client.fetch-registry=false -eureka.client.serviceUrl.defaultZone= http://localhost:8762/eureka \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java b/EurekaServerUsingFeignClient/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java deleted file mode 100644 index a20f6a0f..00000000 --- a/EurekaServerUsingFeignClient/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.eurekaserver; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class EurekaserverApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/.gitignore b/EurekaServerUsingFeignClient/mongodbClient2/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/mongodbClient2/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingFeignClient/mongodbClient2/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingFeignClient/mongodbClient2/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingFeignClient/mongodbClient2/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingFeignClient/mongodbClient2/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingFeignClient/mongodbClient2/mvnw b/EurekaServerUsingFeignClient/mongodbClient2/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingFeignClient/mongodbClient2/mvnw.cmd b/EurekaServerUsingFeignClient/mongodbClient2/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingFeignClient/mongodbClient2/pom.xml b/EurekaServerUsingFeignClient/mongodbClient2/pom.xml deleted file mode 100644 index 5ae6d0ab..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - - com.mongoDb - mongodbExample - 0.0.1-SNAPSHOT - jar - - mongodbExample - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - org.projectlombok - lombok - 1.16.20 - provided - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java deleted file mode 100644 index 134b6501..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -@SpringBootApplication -@EnableEurekaClient -public class MongoMain { - - public static void main(String[] args) { - SpringApplication.run(MongoMain.class, args); - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java deleted file mode 100644 index a8303759..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.mongo.db.controller; - -import java.util.List; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.service.IAuditService; -import com.mongo.db.vo.updateAuditRequest; - -/** - * @author trainee - * - */ -//@RequestMapping("/audit") -@RestController -public class AuditController { - - @Autowired - private IAuditService auditService; -/** - * - * @param audit - * @return - */ - @PostMapping - public ResponseEntitycreate(@RequestBody final AuditLog audit) - { - try { - auditService.createAudit(audit); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException exep) { - return new ResponseEntity(exep.getMessage(),HttpStatus.OK); - } - } - /** - * - * @param eventName - * @return - */ - @GetMapping("/{eventName}") - public ResponseEntitygetAudit(@PathVariable @NotNull final String eventName) - { - - try { - List list=auditService.getDetails(eventName); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @return - */ - @GetMapping - public ResponseEntitygetAllAudit() - { - - try { - List list=auditService.findall(); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param update - * @return - */ - @PutMapping - public ResponseEntityupdateAudit(@RequestBody final updateAuditRequest update) - { - - try { - AuditLog audit=auditService.update(update.getEventId(), update.getEventType()); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param eventId - * @return - */ - @DeleteMapping("{eventId}") - public ResponseEntitydeleteAudit(@PathVariable final UUID eventId) - { - - try { - - String audit=auditService.deleteAudit(eventId); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java deleted file mode 100644 index 1b55caac..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.mongo.db.document; - -import java.util.Date; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -public class AuditLog { - - @Id - @NotNull - private UUID eventID=UUID.randomUUID(); - @NotNull - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * - * @return the eventID - */ - public UUID getEventID() { - return eventID; - } - /** - * @param eventID the eventID to set - */ - public void setEventID(UUID eventID) { - this.eventID = eventID; - } - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /** - * @param eventID - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(UUID eventID, String eventName, String eventType, Date eventDate, String userId, - Object oldValue, Object newValue) { - super(); - this.eventID = eventID; - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventID=" + eventID + ", eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" - + eventDate + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - - - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java deleted file mode 100644 index 6479eb26..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mongo.db.document; - -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java deleted file mode 100644 index c61912ac..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db.exception; - -public class AuditException extends Exception{ - String msg; - - /** - * @param msg - */ - public AuditException(String msg) { - super(); - this.msg = msg; - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java deleted file mode 100644 index b7d4db13..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mongo.db.repo; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.mongo.db.document.AuditLog; - -/** - * @author trainee - * - */ -public interface AuditMongoRepository extends MongoRepository{ - - /** - * @param eventName - * @return - */ - List findByEventName(String eventName); - /** - * @param eventType - * @return - */ - AuditLog findByEventType(String eventType); - - - Optional findByeventID(UUID eventID); -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java deleted file mode 100644 index cd8286f6..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; - -@Service("auditService") -public class AuditServiceImpl implements IAuditService{ - - @Autowired - private AuditMongoRepository auditRepo; - @Override - public AuditLog createAudit(AuditLog audit)throws AuditException { - AuditLog audi= auditRepo.save(audit); - if(audi!=null) - { - return audi; - } - else - { - throw new AuditException("audit not added"); - } - } - - - - @Override - public String deleteAudit(UUID id) throws AuditException { - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - {AuditLog aud=audit.get(); - auditRepo.delete(aud);; - return "deleted"; - } - else - { - throw new AuditException("not deleted"); - } - } - - @Override - public AuditLog update(UUID id,String eventType) throws AuditException { - //changes made after downgrading application - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - { - AuditLog auditLog=audit.get(); - auditLog.setEventType(eventType); - AuditLog auu=auditRepo.save(auditLog); - return auu; - } - else - { - throw new AuditException("id not found!!!!"); - } - } - - - - @Override - public List getDetails(String eventName) throws AuditException { - // TODO Auto-generated method stub - List list=auditRepo.findByEventName(eventName); - if(list.isEmpty()) - { - throw new AuditException("List is empty"); - } - else - { - return list; - } - - } - - - - @Override - public List findall() throws AuditException { - // TODO Auto-generated method stub - return auditRepo.findAll(); - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java deleted file mode 100644 index db121ae5..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.UUID; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; - -public interface IAuditService { - - /** - * @method createAudit - * @param audit - * @return AuditLog object - * @throws AuditException - */ - AuditLog createAudit(AuditLog audit) throws AuditException; - /** - * @method getDetails - * @param eventName - * @return List - * @throws AuditException - */ - List getDetails(String eventName) throws AuditException; - /** - * @method deleteaudit - * @param id - * @return String - * @throws AuditException - */ - String deleteAudit(UUID id) throws AuditException; - /** - * @method update - * @param id - * @param eventType - * @return AuditLog - * @throws AuditException - */ - AuditLog update(UUID id,String eventType) throws AuditException; - /** - * @method findall - * @return List - * @throws AuditException - */ - List findall() throws AuditException; - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java b/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java deleted file mode 100644 index ac2a51a1..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mongo.db.vo; - -import java.util.UUID; - -public class updateAuditRequest { - - private UUID eventId; - private String eventType; - /** - * @return the eventId - */ - public UUID getEventId() { - return eventId; - } - /** - * @param eventId the eventId to set - */ - public void setEventId(UUID eventId) { - this.eventId = eventId; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - -} diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/main/resources/application.properties b/EurekaServerUsingFeignClient/mongodbClient2/src/main/resources/application.properties deleted file mode 100644 index a6723236..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/main/resources/application.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Mongo -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8082 -#Mongo -eureka.client.service-url.defaultZone=http://din16002842:9090/eureka -spring.application.name=mongo-client - - -#appproperty client-spring.application.name=mongo-service - diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java b/EurekaServerUsingFeignClient/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java deleted file mode 100644 index 86f4145b..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.document.BaseEntity; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; -import com.mongo.db.service.AuditServiceImpl; -import com.mongo.db.service.IAuditService; - -@RunWith(MockitoJUnitRunner.class) -public class MongoTest { - - @Mock - private AuditMongoRepository auditRepo; - - - @InjectMocks IAuditService auditServcie=new AuditServiceImpl(); - Date date=new Date(); - UUID id; - Timestamp time; - BaseEntity base1; - BaseEntity bsae2; - AuditLog audit; - AuditLog audit1; - AuditLog audit2; - @Before - public void init() - { - date=new Date(); - id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - time=new Timestamp(date.getTime()); - base1=new BaseEntity("1"); - bsae2=new BaseEntity("2"); - audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - audit1 =new AuditLog(UUID.fromString("38400000-8cf0-11cd-b23e-10b96e4ef00d"),"createnew","creation",time,"3",base1,bsae2); - } - @Test - public void auditcreateTest()throws AuditException - { Date date=new Date(); - UUID id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - Timestamp time=new Timestamp(date.getTime()); - BaseEntity base1=new BaseEntity("1"); - BaseEntity bsae2=new BaseEntity("2"); - AuditLog audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - Mockito.when(auditRepo.save(audit)).thenReturn(audit); - AuditLog audi; - - audi = auditServcie.createAudit(audit); - assertEquals("created",audi,audit); - } - @Test(expected=AuditException.class) - public void falsecreateTest() throws AuditException - { - AuditLog audit1=null; - Mockito.when(auditRepo.save(audit1)).thenReturn(audit1); - AuditLog audi; - audi = auditServcie.createAudit(audit1); - } - -@Test -public void auditgetDetails()throws AuditException -{ - - - List list=new ArrayList(); - - list.add(audit); - list.add(audit1); - Mockito.when(auditRepo.findByEventName("create")).thenReturn(list); - List newList=auditServcie.getDetails("create"); - assertEquals(list, newList); - -} -@Test(expected=AuditException.class) -public void auditgetDetailsfalse()throws AuditException -{ - - - List list=new ArrayList<>(); - Mockito.when(auditRepo.findByEventName("mongo")).thenReturn(list); - List newList=auditServcie.getDetails("mongo"); - - -} - -@Test -public void auditupdatetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - assertEquals(auditt,newAudit); -} - -@Test(expected=AuditException.class) -public void auditupdatefalsecase() throws AuditException -{ - Optional opt=Optional.empty(); - when(auditRepo.findById(id)).thenReturn(opt); - //AuditLog auditt=opt.get(); - //when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - -} - -@Test -public void auditdeletetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - - String newAudit=auditServcie.deleteAudit(id); - - assertEquals("deleted",newAudit); -} - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClient/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java b/EurekaServerUsingFeignClient/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java deleted file mode 100644 index 05b8eaef..00000000 --- a/EurekaServerUsingFeignClient/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mongoDb.mongodbExample; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class MongodbExampleApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.eclipse-pmd b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.gitignore b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/mvnw b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/mvnw.cmd b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/pom.xml b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/pom.xml deleted file mode 100644 index 1d6136d7..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BankInApp - 0.0.1-SNAPSHOT - jar - - BankInApp - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 8.0.11 - runtime - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - org.springframework.cloud - spring-cloud-starter-feign - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java deleted file mode 100644 index 85a1507a..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; -import org.springframework.web.bind.annotation.RequestMapping; - -@SpringBootApplication -@EnableEurekaClient -@EnableFeignClients -public class BankApplicationMain { - - - - - - - - public static void main(String[] args) { - SpringApplication.run(BankApplicationMain.class, args); - } - - - - - - - /* @RequestMapping("/greeting") - public String greeting() { - return "Hello from EurekaClient bank application!"; - }*/ -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index e0d9d2c7..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - System.out.println(">>>>>>>>>>>>>>>>>>>"+cust); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/ATM.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 419e5435..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "atm_id") - private Long aTMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return aTMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - this.aTMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + aTMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - aTMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Account.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 4188d6a0..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index 74936323..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.model; - -import java.sql.Timestamp; -import java.util.Date; - -public class AuditLog { - - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Date eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Bank.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index 495ed86d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Customer.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index 8b08ed43..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.bank.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index 66e7bd96..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c3c75f02..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Account; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - - - Optional findBydenomination(BigDecimal myValue); - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index 68015678..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - - Optional findByaTMId(Long aTMId); - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index 927e0bee..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - - - - Optional findByaccountId(Long accountId); - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 68dc6ea5..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.ATM; -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - - - Optional findBybankId(Long bankId); -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index 7e470336..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneBycustomerName(String CustomerName); - - Optional findBycustomerId(Long customerId); -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 8ae3342d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - - - Optional findBydenomination(BigDecimal myValue); - - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index 9a71ec7c..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - - - - Optional findBydenomination(BigDecimal denomination); - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index 28627986..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - //method needs to be change - final Optional atm = atmRepo.findByaTMId(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findByaTMId(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index 232f9c26..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findByaccountId(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index ed877efb..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - - //changes made to findById - Optional deno=atmdenoRepository.findBydenomination(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findByaTMId(atmId).get(); - //changes made to findById - BankDenomination bank=bankDeno.findBydenomination(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index 0301a571..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/*package com.bank.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - @Autowired - RestTemplate restTemplate; - - @Bean - @LoadBalanced - RestTemplate restTemplate() { - return new RestTemplate(); - } - - // generate audit log - public AuditLog generateAudit(final AuditLog audit) { - - final String uri = "http://mongo-client/createAudit"; - System.out.println("audit obnject " + audit); - final AuditLog audii = restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - - } - - - * @Autowired private DiscoveryClient discoveryClient; - * - * - * public AuditLog generateAudit(AuditLog auditData) { List - * instance=discoveryClient.getInstances("MONGO-CLIENT"); ServiceInstance - * serviceInstance=instance.get(0); RestTemplate restTemplate = new - * RestTemplate(); - * - * String url =serviceInstance.getUri().toString(); url=url+"/create"; AuditLog - * audit = auditData; System.out.println(audit);; AuditLog resultOfOperation = - * restTemplate.postForObject(url, audit, AuditLog.class); return - * resultOfOperation; } - - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index a77ef1af..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - //chnages to be made after downgrading spring boot version - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index ae1f2fe6..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // changes made in repo - final Optional bank = bankRepository.findBybankId(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index b38547f7..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.service; - - - -import java.util.Calendar; -import java.util.Date; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService, Cloneable { - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - /*@Autowired - AuditServiceImpl auditService;*/ - @Autowired - IFeignClient fclient; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Calendar cal=Calendar.getInstance(); - Date time=cal.getTime(); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - //AuditLog ob = auditService.generateAudit(audit); - - AuditLog ob = fclient.create(audit); - - - return cust; - } else { - LOGGER.info("Customer not present as Id not present"); - throw new ManagedException("customer data not updated"); - } - - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java deleted file mode 100644 index ba06a96d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IFeignClient.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.bank.service; - -import org.springframework.cloud.netflix.feign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import com.bank.model.AuditLog; - -/** - * @author trainee - * - */ -@FeignClient("bank-zuul-service") -public interface IFeignClient { - - @PostMapping(path = "/auditLog") - AuditLog create(final AuditLog audit); - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index bc21cee6..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - //changes to be made after version chnage - if(!refRepo.findBydenomination(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/resources/application.properties b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index 10d6c4cb..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,14 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true - -#Mongo -eureka.client.service-url.defaultZone=http://localhost:8762/eureka - - - - - diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/resources/bootstrap.properties b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/resources/bootstrap.properties deleted file mode 100644 index 39ea1a91..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/main/resources/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-client \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index c0e05706..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -/*package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -}*/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.classpath b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.classpath deleted file mode 100644 index 9fc2de7b..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.classpath +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.project b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.project deleted file mode 100644 index 4b7efff7..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - zuul-service - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.eclipse.jdt.core.prefs b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 13b3428a..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not 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.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.eclipse.m2e.core.prefs b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.springframework.ide.eclipse.prefs b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index a12794d6..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/pom.xml b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/pom.xml deleted file mode 100644 index 509de3ff..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - com.javainuse - employee-zuul-service - 0.0.1-SNAPSHOT - jar - - SpringBootHelloWorld - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.cloud - spring-cloud-starter-zuul - - - - org.springframework.cloud - spring-cloud-starter-eureka - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Camden.SR6 - pom - import - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/SpringBootHelloWorldApplication.java b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/SpringBootHelloWorldApplication.java deleted file mode 100644 index 5e3b8f9b..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/SpringBootHelloWorldApplication.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.javainuse; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; -import org.springframework.context.annotation.Bean; - -import com.javainuse.filter.ErrorFilter; -import com.javainuse.filter.PostFilter; -import com.javainuse.filter.PreFilter; -import com.javainuse.filter.RouteFilter; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableZuulProxy -public class SpringBootHelloWorldApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringBootHelloWorldApplication.class, args); - } - - @Bean - public PreFilter preFilter() { - return new PreFilter(); - } - - @Bean - public PostFilter postFilter() { - return new PostFilter(); - } - - @Bean - public ErrorFilter errorFilter() { - return new ErrorFilter(); - } - - @Bean - public RouteFilter routeFilter() { - return new RouteFilter(); - } -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/ErrorFilter.java b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/ErrorFilter.java deleted file mode 100644 index afd94384..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/ErrorFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.javainuse.filter; - -import com.netflix.zuul.ZuulFilter; - -public class ErrorFilter extends ZuulFilter { - - @Override - public String filterType() { - return "error"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - System.out.println("Using Route Filter"); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/PostFilter.java b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/PostFilter.java deleted file mode 100644 index f796421b..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/PostFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.javainuse.filter; - -import com.netflix.zuul.ZuulFilter; - -public class PostFilter extends ZuulFilter { - - @Override - public String filterType() { - return "post"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - System.out.println("Using Post Filter"); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/PreFilter.java b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/PreFilter.java deleted file mode 100644 index 234a7880..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/PreFilter.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.javainuse.filter; - -import javax.servlet.http.HttpServletRequest; - -import com.netflix.zuul.ZuulFilter; -import com.netflix.zuul.context.RequestContext; - -public class PreFilter extends ZuulFilter { - - @Override - public String filterType() { - return "pre"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - RequestContext ctx = RequestContext.getCurrentContext(); - HttpServletRequest request = ctx.getRequest(); - - System.out.println( - "Request Method : " + request.getMethod() + " Request URL : " + request.getRequestURL().toString()); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/RouteFilter.java b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/RouteFilter.java deleted file mode 100644 index a10114eb..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/java/com/javainuse/filter/RouteFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.javainuse.filter; - -import com.netflix.zuul.ZuulFilter; - -public class RouteFilter extends ZuulFilter { - - @Override - public String filterType() { - return "route"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - return true; - } - - @Override - public Object run() { - System.out.println("Using Route Filter"); - - return null; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/resources/application.properties b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/resources/application.properties deleted file mode 100644 index 11864399..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -#zuul.routes.producer.url=http://localhost:8082 -#zuul.routes.auditLog.service-id=mongo-client - - -#zuul.routes.auditLog.url=http://localhost:8082 - - -zuul.routes.auditLog.serviceId :mongo-client - -eureka.client.serviceUrl.defaultZone=http://localhost:8762/eureka -server.port=8079 \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/resources/bootstrap.properties b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/resources/bootstrap.properties deleted file mode 100644 index 0d4a877e..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/src/main/resources/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-zuul-service \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/MANIFEST.MF b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index 356f13ab..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Implementation-Title: SpringBootHelloWorld -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: trainee -Implementation-Vendor-Id: com.javainuse -Build-Jdk: 1.8.0_171 -Implementation-URL: http://projects.spring.io/spring-boot/employee-zuu - l-service/ -Created-By: Maven Integration for Eclipse -Implementation-Vendor: Pivotal Software, Inc. - diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/employee-zuul-service/pom.properties b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/employee-zuul-service/pom.properties deleted file mode 100644 index 8b93bada..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/employee-zuul-service/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Tue May 29 14:50:55 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.javainuse -m2e.projectName=zuul-service -m2e.projectLocation=D\:\\training\\employee-zuul-service -artifactId=employee-zuul-service diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/employee-zuul-service/pom.xml b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/employee-zuul-service/pom.xml deleted file mode 100644 index 509de3ff..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/META-INF/maven/com.javainuse/employee-zuul-service/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - com.javainuse - employee-zuul-service - 0.0.1-SNAPSHOT - jar - - SpringBootHelloWorld - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.cloud - spring-cloud-starter-zuul - - - - org.springframework.cloud - spring-cloud-starter-eureka - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - Camden.SR6 - pom - import - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/application.properties b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/application.properties deleted file mode 100644 index 11864399..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -#zuul.routes.producer.url=http://localhost:8082 -#zuul.routes.auditLog.service-id=mongo-client - - -#zuul.routes.auditLog.url=http://localhost:8082 - - -zuul.routes.auditLog.serviceId :mongo-client - -eureka.client.serviceUrl.defaultZone=http://localhost:8762/eureka -server.port=8079 \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/bootstrap.properties b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/bootstrap.properties deleted file mode 100644 index 0d4a877e..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-zuul-service \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/SpringBootHelloWorldApplication.class b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/SpringBootHelloWorldApplication.class deleted file mode 100644 index 1c93ae2c..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/SpringBootHelloWorldApplication.class and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/ErrorFilter.class b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/ErrorFilter.class deleted file mode 100644 index aef35f87..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/ErrorFilter.class and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/PostFilter.class b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/PostFilter.class deleted file mode 100644 index cb402b03..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/PostFilter.class and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/PreFilter.class b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/PreFilter.class deleted file mode 100644 index 46714441..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/PreFilter.class and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/RouteFilter.class b/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/RouteFilter.class deleted file mode 100644 index faef8217..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/employee-zuul-service/target/classes/com/javainuse/filter/RouteFilter.class and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.gitignore b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/mvnw b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/mvnw.cmd b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/pom.xml b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/pom.xml deleted file mode 100644 index 7d38d405..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - 4.0.0 - - com.github.rawsanj - eureka-server - 0.0.1-SNAPSHOT - jar - - eureka-server - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java deleted file mode 100644 index 1b2a6ba0..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.eurekaserver; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; - -@SpringBootApplication -@EnableEurekaServer -public class EurekaserverApplication { - - public static void main(String[] args) { - SpringApplication.run(EurekaserverApplication.class, args); - } -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/main/resources/application.properties b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/main/resources/application.properties deleted file mode 100644 index 90efd1c1..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -server.port=8762 - - - - - -spring.application.name=application-service - -eureka.client.register-with-eureka=false -eureka.client.fetch-registry=false -eureka.client.serviceUrl.defaultZone= http://localhost:8762/eureka \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java b/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java deleted file mode 100644 index a20f6a0f..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.eurekaserver; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class EurekaserverApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.gitignore b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/mvnw b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/mvnw.cmd b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/pom.xml b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/pom.xml deleted file mode 100644 index 5ae6d0ab..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - - com.mongoDb - mongodbExample - 0.0.1-SNAPSHOT - jar - - mongodbExample - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - org.projectlombok - lombok - 1.16.20 - provided - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java deleted file mode 100644 index 134b6501..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -@SpringBootApplication -@EnableEurekaClient -public class MongoMain { - - public static void main(String[] args) { - SpringApplication.run(MongoMain.class, args); - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java deleted file mode 100644 index a8303759..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.mongo.db.controller; - -import java.util.List; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.service.IAuditService; -import com.mongo.db.vo.updateAuditRequest; - -/** - * @author trainee - * - */ -//@RequestMapping("/audit") -@RestController -public class AuditController { - - @Autowired - private IAuditService auditService; -/** - * - * @param audit - * @return - */ - @PostMapping - public ResponseEntitycreate(@RequestBody final AuditLog audit) - { - try { - auditService.createAudit(audit); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException exep) { - return new ResponseEntity(exep.getMessage(),HttpStatus.OK); - } - } - /** - * - * @param eventName - * @return - */ - @GetMapping("/{eventName}") - public ResponseEntitygetAudit(@PathVariable @NotNull final String eventName) - { - - try { - List list=auditService.getDetails(eventName); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @return - */ - @GetMapping - public ResponseEntitygetAllAudit() - { - - try { - List list=auditService.findall(); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param update - * @return - */ - @PutMapping - public ResponseEntityupdateAudit(@RequestBody final updateAuditRequest update) - { - - try { - AuditLog audit=auditService.update(update.getEventId(), update.getEventType()); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param eventId - * @return - */ - @DeleteMapping("{eventId}") - public ResponseEntitydeleteAudit(@PathVariable final UUID eventId) - { - - try { - - String audit=auditService.deleteAudit(eventId); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java deleted file mode 100644 index 1b55caac..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.mongo.db.document; - -import java.util.Date; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -public class AuditLog { - - @Id - @NotNull - private UUID eventID=UUID.randomUUID(); - @NotNull - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * - * @return the eventID - */ - public UUID getEventID() { - return eventID; - } - /** - * @param eventID the eventID to set - */ - public void setEventID(UUID eventID) { - this.eventID = eventID; - } - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /** - * @param eventID - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(UUID eventID, String eventName, String eventType, Date eventDate, String userId, - Object oldValue, Object newValue) { - super(); - this.eventID = eventID; - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventID=" + eventID + ", eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" - + eventDate + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - - - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java deleted file mode 100644 index 6479eb26..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mongo.db.document; - -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java deleted file mode 100644 index c61912ac..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db.exception; - -public class AuditException extends Exception{ - String msg; - - /** - * @param msg - */ - public AuditException(String msg) { - super(); - this.msg = msg; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java deleted file mode 100644 index b7d4db13..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mongo.db.repo; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.mongo.db.document.AuditLog; - -/** - * @author trainee - * - */ -public interface AuditMongoRepository extends MongoRepository{ - - /** - * @param eventName - * @return - */ - List findByEventName(String eventName); - /** - * @param eventType - * @return - */ - AuditLog findByEventType(String eventType); - - - Optional findByeventID(UUID eventID); -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java deleted file mode 100644 index cd8286f6..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; - -@Service("auditService") -public class AuditServiceImpl implements IAuditService{ - - @Autowired - private AuditMongoRepository auditRepo; - @Override - public AuditLog createAudit(AuditLog audit)throws AuditException { - AuditLog audi= auditRepo.save(audit); - if(audi!=null) - { - return audi; - } - else - { - throw new AuditException("audit not added"); - } - } - - - - @Override - public String deleteAudit(UUID id) throws AuditException { - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - {AuditLog aud=audit.get(); - auditRepo.delete(aud);; - return "deleted"; - } - else - { - throw new AuditException("not deleted"); - } - } - - @Override - public AuditLog update(UUID id,String eventType) throws AuditException { - //changes made after downgrading application - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - { - AuditLog auditLog=audit.get(); - auditLog.setEventType(eventType); - AuditLog auu=auditRepo.save(auditLog); - return auu; - } - else - { - throw new AuditException("id not found!!!!"); - } - } - - - - @Override - public List getDetails(String eventName) throws AuditException { - // TODO Auto-generated method stub - List list=auditRepo.findByEventName(eventName); - if(list.isEmpty()) - { - throw new AuditException("List is empty"); - } - else - { - return list; - } - - } - - - - @Override - public List findall() throws AuditException { - // TODO Auto-generated method stub - return auditRepo.findAll(); - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java deleted file mode 100644 index db121ae5..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.UUID; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; - -public interface IAuditService { - - /** - * @method createAudit - * @param audit - * @return AuditLog object - * @throws AuditException - */ - AuditLog createAudit(AuditLog audit) throws AuditException; - /** - * @method getDetails - * @param eventName - * @return List - * @throws AuditException - */ - List getDetails(String eventName) throws AuditException; - /** - * @method deleteaudit - * @param id - * @return String - * @throws AuditException - */ - String deleteAudit(UUID id) throws AuditException; - /** - * @method update - * @param id - * @param eventType - * @return AuditLog - * @throws AuditException - */ - AuditLog update(UUID id,String eventType) throws AuditException; - /** - * @method findall - * @return List - * @throws AuditException - */ - List findall() throws AuditException; - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java deleted file mode 100644 index ac2a51a1..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mongo.db.vo; - -import java.util.UUID; - -public class updateAuditRequest { - - private UUID eventId; - private String eventType; - /** - * @return the eventId - */ - public UUID getEventId() { - return eventId; - } - /** - * @param eventId the eventId to set - */ - public void setEventId(UUID eventId) { - this.eventId = eventId; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - -} diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/resources/application.properties b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/resources/application.properties deleted file mode 100644 index 96948b95..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/main/resources/application.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Mongo -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8082 -#Mongo -eureka.client.service-url.defaultZone=http://localhost:8762/eureka -spring.application.name=mongo-client - - -#appproperty client-spring.application.name=mongo-service - diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java deleted file mode 100644 index 86f4145b..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.document.BaseEntity; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; -import com.mongo.db.service.AuditServiceImpl; -import com.mongo.db.service.IAuditService; - -@RunWith(MockitoJUnitRunner.class) -public class MongoTest { - - @Mock - private AuditMongoRepository auditRepo; - - - @InjectMocks IAuditService auditServcie=new AuditServiceImpl(); - Date date=new Date(); - UUID id; - Timestamp time; - BaseEntity base1; - BaseEntity bsae2; - AuditLog audit; - AuditLog audit1; - AuditLog audit2; - @Before - public void init() - { - date=new Date(); - id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - time=new Timestamp(date.getTime()); - base1=new BaseEntity("1"); - bsae2=new BaseEntity("2"); - audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - audit1 =new AuditLog(UUID.fromString("38400000-8cf0-11cd-b23e-10b96e4ef00d"),"createnew","creation",time,"3",base1,bsae2); - } - @Test - public void auditcreateTest()throws AuditException - { Date date=new Date(); - UUID id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - Timestamp time=new Timestamp(date.getTime()); - BaseEntity base1=new BaseEntity("1"); - BaseEntity bsae2=new BaseEntity("2"); - AuditLog audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - Mockito.when(auditRepo.save(audit)).thenReturn(audit); - AuditLog audi; - - audi = auditServcie.createAudit(audit); - assertEquals("created",audi,audit); - } - @Test(expected=AuditException.class) - public void falsecreateTest() throws AuditException - { - AuditLog audit1=null; - Mockito.when(auditRepo.save(audit1)).thenReturn(audit1); - AuditLog audi; - audi = auditServcie.createAudit(audit1); - } - -@Test -public void auditgetDetails()throws AuditException -{ - - - List list=new ArrayList(); - - list.add(audit); - list.add(audit1); - Mockito.when(auditRepo.findByEventName("create")).thenReturn(list); - List newList=auditServcie.getDetails("create"); - assertEquals(list, newList); - -} -@Test(expected=AuditException.class) -public void auditgetDetailsfalse()throws AuditException -{ - - - List list=new ArrayList<>(); - Mockito.when(auditRepo.findByEventName("mongo")).thenReturn(list); - List newList=auditServcie.getDetails("mongo"); - - -} - -@Test -public void auditupdatetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - assertEquals(auditt,newAudit); -} - -@Test(expected=AuditException.class) -public void auditupdatefalsecase() throws AuditException -{ - Optional opt=Optional.empty(); - when(auditRepo.findById(id)).thenReturn(opt); - //AuditLog auditt=opt.get(); - //when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - -} - -@Test -public void auditdeletetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - - String newAudit=auditServcie.deleteAudit(id); - - assertEquals("deleted",newAudit); -} - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java b/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java deleted file mode 100644 index 05b8eaef..00000000 --- a/EurekaServerUsingFeignClientAndZuulServer/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mongoDb.mongodbExample; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class MongodbExampleApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/.eclipse-pmd b/EurekaServerUsingRestTemplate/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/.gitignore b/EurekaServerUsingRestTemplate/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingRestTemplate/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingRestTemplate/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingRestTemplate/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/mvnw b/EurekaServerUsingRestTemplate/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/mvnw.cmd b/EurekaServerUsingRestTemplate/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/pom.xml b/EurekaServerUsingRestTemplate/17BankInCapg/pom.xml deleted file mode 100644 index b84a2e34..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BankInApp - 0.0.1-SNAPSHOT - jar - - BankInApp - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 8.0.11 - runtime - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - org.springframework.cloud - spring-cloud-starter-feign - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java deleted file mode 100644 index 0dd944cc..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/BankApplicationMain.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.web.bind.annotation.RequestMapping; - -@SpringBootApplication -@EnableEurekaClient -public class BankApplicationMain { - - - - - - - - public static void main(String[] args) { - SpringApplication.run(BankApplicationMain.class, args); - } - - - - - - - /* @RequestMapping("/greeting") - public String greeting() { - return "Hello from EurekaClient bank application!"; - }*/ -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index e0d9d2c7..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - System.out.println(">>>>>>>>>>>>>>>>>>>"+cust); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/ATM.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 419e5435..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "atm_id") - private Long aTMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return aTMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - this.aTMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + aTMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - aTMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Account.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 4188d6a0..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index 74936323..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.model; - -import java.sql.Timestamp; -import java.util.Date; - -public class AuditLog { - - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Date eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Bank.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index 495ed86d..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Customer.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index 8b08ed43..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.bank.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.AUTO/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index 66e7bd96..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c3c75f02..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Account; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - - - Optional findBydenomination(BigDecimal myValue); - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index 68015678..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - - Optional findByaTMId(Long aTMId); - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index 927e0bee..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - - - - Optional findByaccountId(Long accountId); - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 68dc6ea5..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.ATM; -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - - - Optional findBybankId(Long bankId); -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index 7e470336..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneBycustomerName(String CustomerName); - - Optional findBycustomerId(Long customerId); -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 8ae3342d..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - - - Optional findBydenomination(BigDecimal myValue); - - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index 9a71ec7c..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - - - - Optional findBydenomination(BigDecimal denomination); - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index 28627986..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - //method needs to be change - final Optional atm = atmRepo.findByaTMId(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findByaTMId(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index 232f9c26..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findByaccountId(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findByaccountId(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index ed877efb..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - - //changes made to findById - Optional deno=atmdenoRepository.findBydenomination(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findByaTMId(atmId).get(); - //changes made to findById - BankDenomination bank=bankDeno.findBydenomination(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index e52db0cb..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cloud.client.loadbalancer.LoadBalanced; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - @Autowired - RestTemplate restTemplate; - - @Bean - @LoadBalanced - RestTemplate restTemplate() { - return new RestTemplate(); - } - - // generate audit log - public AuditLog generateAudit(final AuditLog audit) { - - final String uri = "http://mongo-client/createAudit"; - System.out.println("audit obnject " + audit); - final AuditLog audii = restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - - } - - /* - * @Autowired private DiscoveryClient discoveryClient; - * - * - * public AuditLog generateAudit(AuditLog auditData) { List - * instance=discoveryClient.getInstances("MONGO-CLIENT"); ServiceInstance - * serviceInstance=instance.get(0); RestTemplate restTemplate = new - * RestTemplate(); - * - * String url =serviceInstance.getUri().toString(); url=url+"/create"; AuditLog - * audit = auditData; System.out.println(audit);; AuditLog resultOfOperation = - * restTemplate.postForObject(url, audit, AuditLog.class); return - * resultOfOperation; } - */ - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index a77ef1af..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - //chnages to be made after downgrading spring boot version - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findBydenomination(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index ae1f2fe6..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // changes made in repo - final Optional bank = bankRepository.findBybankId(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index 7d184810..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.service; - - - -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Date; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -public class CustomerServiceImpl implements ICustomerService, Cloneable { - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - @Autowired - AuditServiceImpl auditService; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - - final Customer customer = customerRepository.findBycustomerId(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Calendar cal=Calendar.getInstance(); - Date time=cal.getTime(); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - AuditLog ob = auditService.generateAudit(audit); - return cust; - } else { - LOGGER.info("Customer not present as Id not present"); - throw new ManagedException("customer data not updated"); - } - - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index bc21cee6..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - //changes to be made after version chnage - if(!refRepo.findBydenomination(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/resources/application.properties b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index b8e2a66e..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true - -#Mongo -eureka.client.service-url.defaultZone=http://localhost:8762/eureka - - - - diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/resources/bootstrap.properties b/EurekaServerUsingRestTemplate/17BankInCapg/src/main/resources/bootstrap.properties deleted file mode 100644 index 39ea1a91..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/main/resources/bootstrap.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=bank-client \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/EurekaServerUsingRestTemplate/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index c0e05706..00000000 --- a/EurekaServerUsingRestTemplate/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -/*package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -}*/ \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/eurekaserver/.gitignore b/EurekaServerUsingRestTemplate/eurekaserver/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/eurekaserver/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingRestTemplate/eurekaserver/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingRestTemplate/eurekaserver/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingRestTemplate/eurekaserver/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingRestTemplate/eurekaserver/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingRestTemplate/eurekaserver/mvnw b/EurekaServerUsingRestTemplate/eurekaserver/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingRestTemplate/eurekaserver/mvnw.cmd b/EurekaServerUsingRestTemplate/eurekaserver/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingRestTemplate/eurekaserver/pom.xml b/EurekaServerUsingRestTemplate/eurekaserver/pom.xml deleted file mode 100644 index 7d38d405..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - 4.0.0 - - com.github.rawsanj - eureka-server - 0.0.1-SNAPSHOT - jar - - eureka-server - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java b/EurekaServerUsingRestTemplate/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java deleted file mode 100644 index 1b2a6ba0..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/src/main/java/com/example/eurekaserver/EurekaserverApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.eurekaserver; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; - -@SpringBootApplication -@EnableEurekaServer -public class EurekaserverApplication { - - public static void main(String[] args) { - SpringApplication.run(EurekaserverApplication.class, args); - } -} diff --git a/EurekaServerUsingRestTemplate/eurekaserver/src/main/resources/application.properties b/EurekaServerUsingRestTemplate/eurekaserver/src/main/resources/application.properties deleted file mode 100644 index 90efd1c1..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -server.port=8762 - - - - - -spring.application.name=application-service - -eureka.client.register-with-eureka=false -eureka.client.fetch-registry=false -eureka.client.serviceUrl.defaultZone= http://localhost:8762/eureka \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java b/EurekaServerUsingRestTemplate/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java deleted file mode 100644 index a20f6a0f..00000000 --- a/EurekaServerUsingRestTemplate/eurekaserver/src/test/java/com/example/eurekaserver/EurekaserverApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.eurekaserver; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class EurekaserverApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/.gitignore b/EurekaServerUsingRestTemplate/mongodbClient2/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/.mvn/wrapper/maven-wrapper.jar b/EurekaServerUsingRestTemplate/mongodbClient2/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/EurekaServerUsingRestTemplate/mongodbClient2/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/.mvn/wrapper/maven-wrapper.properties b/EurekaServerUsingRestTemplate/mongodbClient2/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/mvnw b/EurekaServerUsingRestTemplate/mongodbClient2/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/mvnw.cmd b/EurekaServerUsingRestTemplate/mongodbClient2/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/pom.xml b/EurekaServerUsingRestTemplate/mongodbClient2/pom.xml deleted file mode 100644 index 5ae6d0ab..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - - com.mongoDb - mongodbExample - 0.0.1-SNAPSHOT - jar - - mongodbExample - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - org.projectlombok - lombok - 1.16.20 - provided - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java deleted file mode 100644 index 134b6501..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -@SpringBootApplication -@EnableEurekaClient -public class MongoMain { - - public static void main(String[] args) { - SpringApplication.run(MongoMain.class, args); - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java deleted file mode 100644 index a8303759..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.mongo.db.controller; - -import java.util.List; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.service.IAuditService; -import com.mongo.db.vo.updateAuditRequest; - -/** - * @author trainee - * - */ -//@RequestMapping("/audit") -@RestController -public class AuditController { - - @Autowired - private IAuditService auditService; -/** - * - * @param audit - * @return - */ - @PostMapping - public ResponseEntitycreate(@RequestBody final AuditLog audit) - { - try { - auditService.createAudit(audit); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException exep) { - return new ResponseEntity(exep.getMessage(),HttpStatus.OK); - } - } - /** - * - * @param eventName - * @return - */ - @GetMapping("/{eventName}") - public ResponseEntitygetAudit(@PathVariable @NotNull final String eventName) - { - - try { - List list=auditService.getDetails(eventName); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @return - */ - @GetMapping - public ResponseEntitygetAllAudit() - { - - try { - List list=auditService.findall(); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param update - * @return - */ - @PutMapping - public ResponseEntityupdateAudit(@RequestBody final updateAuditRequest update) - { - - try { - AuditLog audit=auditService.update(update.getEventId(), update.getEventType()); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param eventId - * @return - */ - @DeleteMapping("{eventId}") - public ResponseEntitydeleteAudit(@PathVariable final UUID eventId) - { - - try { - - String audit=auditService.deleteAudit(eventId); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java deleted file mode 100644 index 1b55caac..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.mongo.db.document; - -import java.util.Date; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -public class AuditLog { - - @Id - @NotNull - private UUID eventID=UUID.randomUUID(); - @NotNull - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * - * @return the eventID - */ - public UUID getEventID() { - return eventID; - } - /** - * @param eventID the eventID to set - */ - public void setEventID(UUID eventID) { - this.eventID = eventID; - } - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /** - * @param eventID - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(UUID eventID, String eventName, String eventType, Date eventDate, String userId, - Object oldValue, Object newValue) { - super(); - this.eventID = eventID; - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventID=" + eventID + ", eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" - + eventDate + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - - - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java deleted file mode 100644 index 6479eb26..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mongo.db.document; - -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java deleted file mode 100644 index c61912ac..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db.exception; - -public class AuditException extends Exception{ - String msg; - - /** - * @param msg - */ - public AuditException(String msg) { - super(); - this.msg = msg; - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java deleted file mode 100644 index b7d4db13..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mongo.db.repo; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.mongo.db.document.AuditLog; - -/** - * @author trainee - * - */ -public interface AuditMongoRepository extends MongoRepository{ - - /** - * @param eventName - * @return - */ - List findByEventName(String eventName); - /** - * @param eventType - * @return - */ - AuditLog findByEventType(String eventType); - - - Optional findByeventID(UUID eventID); -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java deleted file mode 100644 index cd8286f6..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; - -@Service("auditService") -public class AuditServiceImpl implements IAuditService{ - - @Autowired - private AuditMongoRepository auditRepo; - @Override - public AuditLog createAudit(AuditLog audit)throws AuditException { - AuditLog audi= auditRepo.save(audit); - if(audi!=null) - { - return audi; - } - else - { - throw new AuditException("audit not added"); - } - } - - - - @Override - public String deleteAudit(UUID id) throws AuditException { - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - {AuditLog aud=audit.get(); - auditRepo.delete(aud);; - return "deleted"; - } - else - { - throw new AuditException("not deleted"); - } - } - - @Override - public AuditLog update(UUID id,String eventType) throws AuditException { - //changes made after downgrading application - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - { - AuditLog auditLog=audit.get(); - auditLog.setEventType(eventType); - AuditLog auu=auditRepo.save(auditLog); - return auu; - } - else - { - throw new AuditException("id not found!!!!"); - } - } - - - - @Override - public List getDetails(String eventName) throws AuditException { - // TODO Auto-generated method stub - List list=auditRepo.findByEventName(eventName); - if(list.isEmpty()) - { - throw new AuditException("List is empty"); - } - else - { - return list; - } - - } - - - - @Override - public List findall() throws AuditException { - // TODO Auto-generated method stub - return auditRepo.findAll(); - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java deleted file mode 100644 index db121ae5..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.UUID; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; - -public interface IAuditService { - - /** - * @method createAudit - * @param audit - * @return AuditLog object - * @throws AuditException - */ - AuditLog createAudit(AuditLog audit) throws AuditException; - /** - * @method getDetails - * @param eventName - * @return List - * @throws AuditException - */ - List getDetails(String eventName) throws AuditException; - /** - * @method deleteaudit - * @param id - * @return String - * @throws AuditException - */ - String deleteAudit(UUID id) throws AuditException; - /** - * @method update - * @param id - * @param eventType - * @return AuditLog - * @throws AuditException - */ - AuditLog update(UUID id,String eventType) throws AuditException; - /** - * @method findall - * @return List - * @throws AuditException - */ - List findall() throws AuditException; - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java deleted file mode 100644 index ac2a51a1..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mongo.db.vo; - -import java.util.UUID; - -public class updateAuditRequest { - - private UUID eventId; - private String eventType; - /** - * @return the eventId - */ - public UUID getEventId() { - return eventId; - } - /** - * @param eventId the eventId to set - */ - public void setEventId(UUID eventId) { - this.eventId = eventId; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - -} diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/resources/application.properties b/EurekaServerUsingRestTemplate/mongodbClient2/src/main/resources/application.properties deleted file mode 100644 index 96948b95..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/main/resources/application.properties +++ /dev/null @@ -1,12 +0,0 @@ -#Mongo -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8082 -#Mongo -eureka.client.service-url.defaultZone=http://localhost:8762/eureka -spring.application.name=mongo-client - - -#appproperty client-spring.application.name=mongo-service - diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java deleted file mode 100644 index 86f4145b..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.document.BaseEntity; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; -import com.mongo.db.service.AuditServiceImpl; -import com.mongo.db.service.IAuditService; - -@RunWith(MockitoJUnitRunner.class) -public class MongoTest { - - @Mock - private AuditMongoRepository auditRepo; - - - @InjectMocks IAuditService auditServcie=new AuditServiceImpl(); - Date date=new Date(); - UUID id; - Timestamp time; - BaseEntity base1; - BaseEntity bsae2; - AuditLog audit; - AuditLog audit1; - AuditLog audit2; - @Before - public void init() - { - date=new Date(); - id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - time=new Timestamp(date.getTime()); - base1=new BaseEntity("1"); - bsae2=new BaseEntity("2"); - audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - audit1 =new AuditLog(UUID.fromString("38400000-8cf0-11cd-b23e-10b96e4ef00d"),"createnew","creation",time,"3",base1,bsae2); - } - @Test - public void auditcreateTest()throws AuditException - { Date date=new Date(); - UUID id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - Timestamp time=new Timestamp(date.getTime()); - BaseEntity base1=new BaseEntity("1"); - BaseEntity bsae2=new BaseEntity("2"); - AuditLog audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - Mockito.when(auditRepo.save(audit)).thenReturn(audit); - AuditLog audi; - - audi = auditServcie.createAudit(audit); - assertEquals("created",audi,audit); - } - @Test(expected=AuditException.class) - public void falsecreateTest() throws AuditException - { - AuditLog audit1=null; - Mockito.when(auditRepo.save(audit1)).thenReturn(audit1); - AuditLog audi; - audi = auditServcie.createAudit(audit1); - } - -@Test -public void auditgetDetails()throws AuditException -{ - - - List list=new ArrayList(); - - list.add(audit); - list.add(audit1); - Mockito.when(auditRepo.findByEventName("create")).thenReturn(list); - List newList=auditServcie.getDetails("create"); - assertEquals(list, newList); - -} -@Test(expected=AuditException.class) -public void auditgetDetailsfalse()throws AuditException -{ - - - List list=new ArrayList<>(); - Mockito.when(auditRepo.findByEventName("mongo")).thenReturn(list); - List newList=auditServcie.getDetails("mongo"); - - -} - -@Test -public void auditupdatetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - assertEquals(auditt,newAudit); -} - -@Test(expected=AuditException.class) -public void auditupdatefalsecase() throws AuditException -{ - Optional opt=Optional.empty(); - when(auditRepo.findById(id)).thenReturn(opt); - //AuditLog auditt=opt.get(); - //when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - -} - -@Test -public void auditdeletetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - - String newAudit=auditServcie.deleteAudit(id); - - assertEquals("deleted",newAudit); -} - -} -*/ \ No newline at end of file diff --git a/EurekaServerUsingRestTemplate/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java b/EurekaServerUsingRestTemplate/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java deleted file mode 100644 index 05b8eaef..00000000 --- a/EurekaServerUsingRestTemplate/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mongoDb.mongodbExample; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class MongodbExampleApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/MyDatabase for SuperMarket Project/.gitignore b/MyDatabase for SuperMarket Project/.gitignore deleted file mode 100644 index 5c5b6eaf..00000000 --- a/MyDatabase for SuperMarket Project/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.classpath -.project -/bin/* -.setting/* diff --git a/MyDatabase for SuperMarket Project/MydatabaseQueries.txt b/MyDatabase for SuperMarket Project/MydatabaseQueries.txt deleted file mode 100644 index 0c560094..00000000 --- a/MyDatabase for SuperMarket Project/MydatabaseQueries.txt +++ /dev/null @@ -1,47 +0,0 @@ -create database mydb; - - -CREATE TABLE Customer ( - customerId int primary key auto_increment, - customerName varchar(255), - customerAddress varchar(255), - paymentMode varchar(20) -); - - - - - - - - - - -CREATE TABLE `mydb1`.`goods` ( - `goodsId` INT NOT NULL AUTO_INCREMENT, - `goodsName` VARCHAR(45) NOT NULL, - `goodsQuantity` VARCHAR(45) NOT NULL, - `goodsPrice` VARCHAR(45) NOT NULL, - PRIMARY KEY (`goodsId`)); - - - - - - - -CREATE TABLE `mydb1`.`supplier` ( - `supplierId` INT NOT NULL AUTO_INCREMENT, - `supplierName` VARCHAR(45) NOT NULL, - `supplierAddress` VARCHAR(45) NOT NULL, - `quantityOrder` INT NOT NULL, - `orderId` INT NOT NULL, - `amount` DOUBLE NOT NULL, - PRIMARY KEY (`supplierId`)); - - - -CREATE TABLE `mydb1`.`retailer` ( - `retailerName` VARCHAR(25) NOT NULL, - `retailerAddress` VARCHAR(45) NOT NULL, - PRIMARY KEY (`retailerName`)); diff --git a/MyDatabase for SuperMarket Project/retailShopDB.mwb b/MyDatabase for SuperMarket Project/retailShopDB.mwb deleted file mode 100644 index f663073c..00000000 Binary files a/MyDatabase for SuperMarket Project/retailShopDB.mwb and /dev/null differ diff --git a/MyDatabase for SuperMarket Project/retailShopDB.mwb.bak b/MyDatabase for SuperMarket Project/retailShopDB.mwb.bak deleted file mode 100644 index 0a194377..00000000 Binary files a/MyDatabase for SuperMarket Project/retailShopDB.mwb.bak and /dev/null differ diff --git a/PPTs/JUnit and Mockito Training v1.0 (1).pptx b/PPTs/JUnit and Mockito Training v1.0 (1).pptx deleted file mode 100644 index 93361bee..00000000 Binary files a/PPTs/JUnit and Mockito Training v1.0 (1).pptx and /dev/null differ diff --git a/PPTs/SerializationPPT1452018.pptx b/PPTs/SerializationPPT1452018.pptx deleted file mode 100644 index 596291d9..00000000 Binary files a/PPTs/SerializationPPT1452018.pptx and /dev/null differ diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.eclipse-pmd b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.gitignore b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/mvnw b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/mvnw.cmd b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/pom.xml b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/pom.xml deleted file mode 100644 index 53737639..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BANKAPPLICATION - 0.0.1-SNAPSHOT - jar - - transactionInBank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 5.1.38 - runtime - - - - - org.springframework.boot - spring-boot-starter-amqp - - - - com.h2database - h2 - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/BankApplication.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/BankApplication.java deleted file mode 100644 index b092dee6..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/BankApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class BankApplication { - - public static void main(String[] args) { - SpringApplication.run(BankApplication.class, args); - } -} - diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index 5d97e9fb..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/ATM.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 40851219..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "atm_id") - private Long ATMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + ATMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - ATMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Account.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 35799591..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index aa42fa26..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.bank.model; - -import java.sql.Timestamp; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - - -/*@JsonIgnoreProperties(ignoreUnknown = true)*/ -public class AuditLog { - - private String eventName; - private String eventType; - private Timestamp eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Timestamp getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Timestamp eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - - } - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Timestamp eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Bank.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index d52ebb26..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.IDENTITY /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Customer.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index 8ca484b5..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.bank.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.IDENTITY/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index c958e83c..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - @SequenceGenerator(name = "transaction_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "transaction_seq") - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c08f97c5..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATMDenomination; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index bb53cc1c..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index c5754c5c..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 15a792ac..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index e603c132..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneByCustomerName(String CustomerName); -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 5711e5c3..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index ad5053dc..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index edeef456..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - // TODO Auto-generated method stub - final Optional atm = atmRepo.findById(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findById(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index b3dbada0..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findById(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findById(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findById(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index 4839f4fa..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - Optional deno=atmdenoRepository.findById(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findById(atmId).get(); - BankDenomination bank=bankDeno.findById(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AuditRegistrationSource.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AuditRegistrationSource.java deleted file mode 100644 index f8d9d16f..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AuditRegistrationSource.java +++ /dev/null @@ -1,15 +0,0 @@ -/*package com.bank.service; - -import org.springframework.cloud.stream.annotation.Output; -import org.springframework.messaging.MessageChannel; - -public interface AuditRegistrationSource { - - - - @Output("auditRegistrationChannel") - MessageChannel auditRegistration(); - - -} -*/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index 1c583f50..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.service; - -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - //generate audit log - public AuditLog generateAudit(final AuditLog audit) - { - final RestTemplate restTemplate=new RestTemplate(); - final String uri="http://localhost:8082/audit"; - System.out.println("audit obnject " + audit); - final AuditLog audii=restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - } -} - \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index 1d2acb94..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - Optional deno = denominationRepo.findById(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findById(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index bb1f1c50..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // TODO Auto-generated method stub - final Optional bank = bankRepository.findById(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index 937aa246..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.bank.service; - -import java.sql.Timestamp; - - -import java.time.LocalDateTime; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -/*import org.springframework.cloud.stream.annotation.EnableBinding;*/ -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; -import com.configrabbit.RabbitConfig; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -@Component -/*@EnableBinding(AuditRegistrationSource.class)*/ -public class CustomerServiceImpl implements ICustomerService, Cloneable { - - - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - @Autowired - AuditServiceImpl auditService; - - @Autowired - RabbitTemplate template; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findById(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - // TODO Auto-generated method stub - final Customer customer = customerRepository.findById(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Timestamp time = Timestamp.valueOf(LocalDateTime.now()); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - //AuditLog ob = auditService.generateAudit(audit); - - - System.out.println("hii"); - - //template.convertAndSend(RabbitConfig.ROUTING_KEY,audit.toString()); - template.convertAndSend(RabbitConfig.ROUTING_KEY,"message from producer"); - //System.out.println("Is Listner called::"+rabbitTemplate.isReturnListener()); - - - - return cust; - } else { - LOGGER.info("No customer is updated as id not exist"); - throw new ManagedException("no customer is updated"); - } - - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index 8a4a66f1..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - if(!refRepo.findById(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/configrabbit/RabbitConfig.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/configrabbit/RabbitConfig.java deleted file mode 100644 index 7a0370c7..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/java/com/configrabbit/RabbitConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.configrabbit; - -import org.springframework.amqp.core.TopicExchange; -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.Queue; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - - -@Configuration -public class RabbitConfig { - //exchange will send the message through ROUTING_KEY to queue - public static final String ROUTING_KEY="sfg-message-queue"; - - //queue will recieve the message and make it durable - @Bean - Queue queue() - { - return new Queue(ROUTING_KEY, true); - } - - @Bean - TopicExchange exchange() - { - return new TopicExchange("spring-boot-exchange"); - - } - - @Bean - Binding binding(Queue queue, TopicExchange exchange) - { - return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY); - - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/resources/application.properties b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index 3d86cd80..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true - -spring.rabbitmq.host = 127.0.0.1 -spring.rabbitmq.port = 5672 -spring.rabbitmq.username=guest -spring.rabbitmq.password=guest \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index 15bba781..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -} \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.gitignore b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.mvn/wrapper/maven-wrapper.jar b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.mvn/wrapper/maven-wrapper.properties b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/bootstrap.properties b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/bootstrap.properties deleted file mode 100644 index a2136c3d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/bootstrap.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.application.name=mongo-service -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8082 -spring.cloud.config.uri=http://localhost:8888 \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/mvnw b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/mvnw.cmd b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/pom.xml b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/pom.xml deleted file mode 100644 index 68500f50..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 4.0.0 - - com.mongoDb - mongodbExample - 0.0.1-SNAPSHOT - jar - - mongodbExample - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-amqp - - - - org.projectlombok - lombok - 1.16.20 - provided - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java deleted file mode 100644 index 82ac709d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.mongo.db; - -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.MessageListener; -import org.springframework.amqp.core.Queue; -import org.springframework.amqp.core.TopicExchange; -import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; -import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; - -import com.mongo.db.rcvlistner.MsgListener; - -@SpringBootApplication -public class MongoMain { - public final static String MESSAGE_QUEUE = "sfg-message-queue"; - - @Bean - Queue queue() { - return new Queue(MESSAGE_QUEUE, false); - } - - @Bean - TopicExchange exchange() { - return new TopicExchange("spring-boot-exchange"); - } - - @Bean - Binding binding(Queue queue, TopicExchange exchange) { - return BindingBuilder.bind(queue).to(exchange).with(MESSAGE_QUEUE); - } - - @Bean - SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, - MessageListenerAdapter listenerAdapter) { - SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); - container.setConnectionFactory(connectionFactory); - container.setQueueNames(MESSAGE_QUEUE); - container.setMessageListener(listenerAdapter); - return container; - } - - @Bean - MessageListenerAdapter listenerAdapter(MsgListener receiver) { - return new MessageListenerAdapter(receiver, "receiveMessage"); - } - public static void main(String[] args) { - SpringApplication.run(MongoMain.class, args); - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java deleted file mode 100644 index a8303759..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.mongo.db.controller; - -import java.util.List; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.service.IAuditService; -import com.mongo.db.vo.updateAuditRequest; - -/** - * @author trainee - * - */ -//@RequestMapping("/audit") -@RestController -public class AuditController { - - @Autowired - private IAuditService auditService; -/** - * - * @param audit - * @return - */ - @PostMapping - public ResponseEntitycreate(@RequestBody final AuditLog audit) - { - try { - auditService.createAudit(audit); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException exep) { - return new ResponseEntity(exep.getMessage(),HttpStatus.OK); - } - } - /** - * - * @param eventName - * @return - */ - @GetMapping("/{eventName}") - public ResponseEntitygetAudit(@PathVariable @NotNull final String eventName) - { - - try { - List list=auditService.getDetails(eventName); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @return - */ - @GetMapping - public ResponseEntitygetAllAudit() - { - - try { - List list=auditService.findall(); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param update - * @return - */ - @PutMapping - public ResponseEntityupdateAudit(@RequestBody final updateAuditRequest update) - { - - try { - AuditLog audit=auditService.update(update.getEventId(), update.getEventType()); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param eventId - * @return - */ - @DeleteMapping("{eventId}") - public ResponseEntitydeleteAudit(@PathVariable final UUID eventId) - { - - try { - - String audit=auditService.deleteAudit(eventId); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java deleted file mode 100644 index 1b55caac..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.mongo.db.document; - -import java.util.Date; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -public class AuditLog { - - @Id - @NotNull - private UUID eventID=UUID.randomUUID(); - @NotNull - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * - * @return the eventID - */ - public UUID getEventID() { - return eventID; - } - /** - * @param eventID the eventID to set - */ - public void setEventID(UUID eventID) { - this.eventID = eventID; - } - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /** - * @param eventID - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(UUID eventID, String eventName, String eventType, Date eventDate, String userId, - Object oldValue, Object newValue) { - super(); - this.eventID = eventID; - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventID=" + eventID + ", eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" - + eventDate + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - - - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java deleted file mode 100644 index 6479eb26..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mongo.db.document; - -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java deleted file mode 100644 index c61912ac..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db.exception; - -public class AuditException extends Exception{ - String msg; - - /** - * @param msg - */ - public AuditException(String msg) { - super(); - this.msg = msg; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/rcvlistner/MsgListener.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/rcvlistner/MsgListener.java deleted file mode 100644 index effe32b8..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/rcvlistner/MsgListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.mongo.db.rcvlistner; - -import org.springframework.stereotype.Component; - -import com.mongo.db.document.AuditLog; - - - - - - - -@Component -public class MsgListener { - - /*@Autowired - AuditMongoRepository amd; - */ - public void receiveMessage(String message) { - System.out.println("Received <" + message + ">"); - // AuditLog auditNew = new AuditLog(message.getEventID(), message.getEventName(), message.getEventType(),message.getEventDate(),message.getUserId(), message.getOldValue(), message.getNewValue()); - //amd.save(auditNew); - } -} \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java deleted file mode 100644 index b7d4db13..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mongo.db.repo; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.mongo.db.document.AuditLog; - -/** - * @author trainee - * - */ -public interface AuditMongoRepository extends MongoRepository{ - - /** - * @param eventName - * @return - */ - List findByEventName(String eventName); - /** - * @param eventType - * @return - */ - AuditLog findByEventType(String eventType); - - - Optional findByeventID(UUID eventID); -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java deleted file mode 100644 index cd8286f6..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; - -@Service("auditService") -public class AuditServiceImpl implements IAuditService{ - - @Autowired - private AuditMongoRepository auditRepo; - @Override - public AuditLog createAudit(AuditLog audit)throws AuditException { - AuditLog audi= auditRepo.save(audit); - if(audi!=null) - { - return audi; - } - else - { - throw new AuditException("audit not added"); - } - } - - - - @Override - public String deleteAudit(UUID id) throws AuditException { - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - {AuditLog aud=audit.get(); - auditRepo.delete(aud);; - return "deleted"; - } - else - { - throw new AuditException("not deleted"); - } - } - - @Override - public AuditLog update(UUID id,String eventType) throws AuditException { - //changes made after downgrading application - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - { - AuditLog auditLog=audit.get(); - auditLog.setEventType(eventType); - AuditLog auu=auditRepo.save(auditLog); - return auu; - } - else - { - throw new AuditException("id not found!!!!"); - } - } - - - - @Override - public List getDetails(String eventName) throws AuditException { - // TODO Auto-generated method stub - List list=auditRepo.findByEventName(eventName); - if(list.isEmpty()) - { - throw new AuditException("List is empty"); - } - else - { - return list; - } - - } - - - - @Override - public List findall() throws AuditException { - // TODO Auto-generated method stub - return auditRepo.findAll(); - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java deleted file mode 100644 index db121ae5..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.UUID; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; - -public interface IAuditService { - - /** - * @method createAudit - * @param audit - * @return AuditLog object - * @throws AuditException - */ - AuditLog createAudit(AuditLog audit) throws AuditException; - /** - * @method getDetails - * @param eventName - * @return List - * @throws AuditException - */ - List getDetails(String eventName) throws AuditException; - /** - * @method deleteaudit - * @param id - * @return String - * @throws AuditException - */ - String deleteAudit(UUID id) throws AuditException; - /** - * @method update - * @param id - * @param eventType - * @return AuditLog - * @throws AuditException - */ - AuditLog update(UUID id,String eventType) throws AuditException; - /** - * @method findall - * @return List - * @throws AuditException - */ - List findall() throws AuditException; - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java deleted file mode 100644 index ac2a51a1..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mongo.db.vo; - -import java.util.UUID; - -public class updateAuditRequest { - - private UUID eventId; - private String eventType; - /** - * @return the eventId - */ - public UUID getEventId() { - return eventId; - } - /** - * @param eventId the eventId to set - */ - public void setEventId(UUID eventId) { - this.eventId = eventId; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - -} diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/resources/application.properties b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/resources/application.properties deleted file mode 100644 index 9d3e4e0d..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/main/resources/application.properties +++ /dev/null @@ -1,15 +0,0 @@ -#Mongo -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8022 - -#Register with eureka -#eureka.client.service-url.defaultZone=http://localhost:8762/eureka - - - -#eureka.client.service-url.defaultZone=https://github.com/ramdafale/bank-config-server -#spring.application.name=mongo-client - - diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java deleted file mode 100644 index 86f4145b..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.document.BaseEntity; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; -import com.mongo.db.service.AuditServiceImpl; -import com.mongo.db.service.IAuditService; - -@RunWith(MockitoJUnitRunner.class) -public class MongoTest { - - @Mock - private AuditMongoRepository auditRepo; - - - @InjectMocks IAuditService auditServcie=new AuditServiceImpl(); - Date date=new Date(); - UUID id; - Timestamp time; - BaseEntity base1; - BaseEntity bsae2; - AuditLog audit; - AuditLog audit1; - AuditLog audit2; - @Before - public void init() - { - date=new Date(); - id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - time=new Timestamp(date.getTime()); - base1=new BaseEntity("1"); - bsae2=new BaseEntity("2"); - audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - audit1 =new AuditLog(UUID.fromString("38400000-8cf0-11cd-b23e-10b96e4ef00d"),"createnew","creation",time,"3",base1,bsae2); - } - @Test - public void auditcreateTest()throws AuditException - { Date date=new Date(); - UUID id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - Timestamp time=new Timestamp(date.getTime()); - BaseEntity base1=new BaseEntity("1"); - BaseEntity bsae2=new BaseEntity("2"); - AuditLog audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - Mockito.when(auditRepo.save(audit)).thenReturn(audit); - AuditLog audi; - - audi = auditServcie.createAudit(audit); - assertEquals("created",audi,audit); - } - @Test(expected=AuditException.class) - public void falsecreateTest() throws AuditException - { - AuditLog audit1=null; - Mockito.when(auditRepo.save(audit1)).thenReturn(audit1); - AuditLog audi; - audi = auditServcie.createAudit(audit1); - } - -@Test -public void auditgetDetails()throws AuditException -{ - - - List list=new ArrayList(); - - list.add(audit); - list.add(audit1); - Mockito.when(auditRepo.findByEventName("create")).thenReturn(list); - List newList=auditServcie.getDetails("create"); - assertEquals(list, newList); - -} -@Test(expected=AuditException.class) -public void auditgetDetailsfalse()throws AuditException -{ - - - List list=new ArrayList<>(); - Mockito.when(auditRepo.findByEventName("mongo")).thenReturn(list); - List newList=auditServcie.getDetails("mongo"); - - -} - -@Test -public void auditupdatetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - assertEquals(auditt,newAudit); -} - -@Test(expected=AuditException.class) -public void auditupdatefalsecase() throws AuditException -{ - Optional opt=Optional.empty(); - when(auditRepo.findById(id)).thenReturn(opt); - //AuditLog auditt=opt.get(); - //when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - -} - -@Test -public void auditdeletetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - - String newAudit=auditServcie.deleteAudit(id); - - assertEquals("deleted",newAudit); -} - -} -*/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java b/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java deleted file mode 100644 index 160469e0..00000000 --- a/Rabbit MQ demo with object/RabbitDemoStringBankAudit/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java +++ /dev/null @@ -1,17 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class MongodbExampleApplicationTests { - - @Test - public void contextLoads() { - } - -} -*/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.eclipse-pmd b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.eclipse-pmd deleted file mode 100644 index 3b4f2d8a..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.gitignore b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.mvn/wrapper/maven-wrapper.jar b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.mvn/wrapper/maven-wrapper.properties b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/mvnw b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/mvnw.cmd b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/pom.xml b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/pom.xml deleted file mode 100644 index 5dfe4c87..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - 4.0.0 - - com.bankApplication - BANKAPPLICATION - 0.0.1-SNAPSHOT - jar - - transactionInBank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - commons-lang - commons-lang - 2.6 - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - mysql - mysql-connector-java - 5.1.38 - runtime - - - - - org.springframework.boot - spring-boot-starter-amqp - - - - com.h2database - h2 - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/BankApplication.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/BankApplication.java deleted file mode 100644 index b092dee6..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/BankApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class BankApplication { - - public static void main(String[] args) { - SpringApplication.run(BankApplication.class, args); - } -} - diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java deleted file mode 100644 index f65ebb09..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/Exception/ManagedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.bank.Exception; - -public class ManagedException extends Exception { - public ManagedException(String msg) { - - - - super(msg); - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/ATMController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/ATMController.java deleted file mode 100644 index 06ec2031..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/ATMController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.ATMReq; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Bank; -import com.bank.service.IATMService; -import com.bank.service.IBankService; - -//To call Restful services -@RestController -public class ATMController { - - // Injecting properties of IATMService to use its methods - @Autowired - private IATMService atmService; - // Injecting properties of IBankService to use its methods in current class - @Autowired - private IBankService bankService; - - /* - * description : this method will return a atm instance - */ - @PostMapping("/atmCreate") - public ResponseEntity createATM(@RequestBody final ATMReq atm) { - - ATM atm1 = null; - try { - final Optional bank = bankService.getBankDetailsByID(atm.getBankId()); - ATM atm2 = atm.getAtm(); - atm2.setBankId(bank.get().getBankId()); - atm1 = atmService.createATM(atm2); - return new ResponseEntity(atm1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Atm not created", HttpStatus.OK); - } - - } - /* - * description : this method will return a - * String message if money successfully added from bank - */ - - @PostMapping("/addMoneyInAtm") - public ResponseEntity addMoneyToATM(@RequestBody final AddMoneyReq atm) { - - try { - final String str = atmService.addMoneyFromBank(atm); - return new ResponseEntity(str, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money to atm not deposited succesfully!!!", HttpStatus.OK); - } - - } - - /* - * description : this method will return - * String if amount is successfully withdraw - */ - @PostMapping("/withdrawAtm") - public ResponseEntity withdrawFromAtm(@RequestBody final WithrawMoneyReq atm) { - - try { - final Long id = atmService.withrawMoney(atm); - return new ResponseEntity(id, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("money from atm not withdrawn", HttpStatus.OK); - } - - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/AccountController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/AccountController.java deleted file mode 100644 index 54cb1386..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/AccountController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountRequest; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IAccountService; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -// To call RestFull services -@RestController -public class AccountController { - - // Injecting properties of IAccountService to use its methods - @Autowired - private IAccountService accountService; - // Injecting properties of ICustomerService to use its methods - @Autowired - private ICustomerService customerService; - // Injecting properties of IBankService to use its methods - @Autowired - private IBankService bankService; - - /* - * description : this method will return a created account and will give - * response in response entity. - */ - @PostMapping("/accountCreate") - public ResponseEntity createAccount(@RequestBody final AccountRequest accountRe) { - Account response = null; - Optional bank; - try { - bank = bankService.getBankDetailsByID(accountRe.getBankId()); - - if (bank.isPresent()) { - Customer cust; - try { - cust = customerService.getCustomerDetails(accountRe.getCustomerId()); - - final Account acc = accountRe.getAccount(); - acc.setBank(bank.get()); - acc.setCustomer(cust); - try { - response = accountService.createAccount(acc); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Account not created", HttpStatus.OK); - } - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bank not present", HttpStatus.OK); - } - } - - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity("id not found", HttpStatus.OK); - } - - } - - /* - * method : getAccount return type : responseEntitiy description : this method - * will return a created account of a given input id - */ - - @GetMapping("/accountDetails/{id}") - public ResponseEntity getAccount(@PathVariable Long id) { - Account acc; - try { - acc = accountService.getAccountDetails(id); - return new ResponseEntity(acc, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("account of given id not found", HttpStatus.OK); - } - - } - - /* - * description : this method will return a success String if money is deposited - * mapping : post - */ - - @PostMapping("/accountDeposit") - public ResponseEntity depositAccount(@RequestBody final AccountTransaction account) { - try { - Long custId = accountService.depositMoney(account); - return new ResponseEntity(custId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - - /* - * description : this method will return a string if amount is withdraw - */ - - @PostMapping("/accountwithdraw") - public ResponseEntity withdrawAccount(@RequestBody final AccountTransaction account) { - try { - Long customerId = accountService.withdrawlMoney(account); - return new ResponseEntity(customerId, HttpStatus.OK); - - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Money Deposited Successfully", HttpStatus.OK); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/BankController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/BankController.java deleted file mode 100644 index d3ef5333..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.service.IBankService; - -@RestController -@RequestMapping("/bank") -public class BankController { - - @Autowired - private IBankService bankService; - - - /* - * description : this method will return a bank instance - */ - @PostMapping("/bankCreate") - public ResponseEntity createBank(@RequestBody final Bank bank) { - - Bank bank1; - try { - bank1 = bankService.createBank(bank); - return new ResponseEntity(bank1, HttpStatus.CREATED); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("Bank not Added ", HttpStatus.OK); - } - - } - - /* - * description : this method will return a list of banks - */ - @GetMapping("/getBankDetails") - public ResponseEntity getBankDetails() { - List list; - try { - list = bankService.getBankDetails(); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("bankDetailsnotfound", HttpStatus.OK); - } - - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java deleted file mode 100644 index 5d97e9fb..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/CustomerController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.bank.controller; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.service.IBankService; -import com.bank.service.ICustomerService; - -@RestController -@RequestMapping("/customer") -public class CustomerController { - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - - - /** - * @return the customerService - */ - public ICustomerService getCustomerService() { - return customerService; - } - - /** - * @param customerService the customerService to set - */ - public void setCustomerService(ICustomerService customerService) { - this.customerService = customerService; - } - - /** - * @return the bankService - */ - public IBankService getBankService() { - return bankService; - } - - /** - * @param bankService the bankService to set - */ - public void setBankService(IBankService bankService) { - this.bankService = bankService; - } - - /* description : this method will return a - * created customer - */ - @PostMapping("/customerCreate") - public ResponseEntity createCustomer(@RequestBody final CreateCustomerRequest createCustomerRequest) { - Customer response = null; - Optional bank; - - try { - bank = bankService.getBankDetailsByID(createCustomerRequest.getBankID()); - - if (bank.isPresent()) { - final Customer cust = createCustomerRequest.getCustomer(); - cust.setBank(bank.get()); - - try { - response = customerService.createCustomer(cust); - } catch (ManagedException e) { - e.getMessage(); - return new ResponseEntity("faild to create customer", HttpStatus.OK); - } - } - return new ResponseEntity(response, HttpStatus.CREATED); - } catch (ManagedException e1) { - String message = e1.getMessage(); - return new ResponseEntity("unable to fetch bank details by id", HttpStatus.OK); - } - - } - - /* description : this method will return a created customer of - * specified id - */ - @GetMapping("/getCustomerDetails/{id}") - public ResponseEntity getCustomer(@PathVariable final Long id) { - final Customer cust; - try { - cust = customerService.getCustomerDetails(id); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("id not found for customer to get details", HttpStatus.OK); - } - } - - @PutMapping("/{id}/{name}/{userId}") - public ResponseEntity updateCustomer(@PathVariable final Long id,@PathVariable final String name,@PathVariable final String userId) throws CloneNotSupportedException { - final Customer cust; - try { - cust = customerService.updateCustomer(id, name, userId); - return new ResponseEntity(cust, HttpStatus.OK); - } catch (ManagedException e) { - e.getMessage(); - - return new ResponseEntity("unable to update data", HttpStatus.OK); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java deleted file mode 100644 index f0257c35..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/DenominationController.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.CreateDenominationRequest; -import com.bank.service.IAtmDenoService; -import com.bank.service.IBankDenominationService; -import com.bank.service.IRefServcie; - -@RestController -public class DenominationController { - - @Autowired - private IRefServcie refService; - - @Autowired - private IBankDenominationService bankDenominations; - @Autowired - private IAtmDenoService atmDenominationService; - - - - // this will add denominations to bank and atm - @PostMapping("/addDenominations") - public void addDenomination(@RequestBody CreateDenominationRequest createDenomination) - { - - try { - refService.createDenomination(createDenomination.getList()); - } catch (ManagedException e1) { - - e1.printStackTrace(); - } - try { - bankDenominations.bankDenominationCreate(createDenomination.getList(),createDenomination.getBankId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - atmDenominationService.atmDenominationCreate(createDenomination.getList(), createDenomination.getAtmId()); - } catch (ManagedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java deleted file mode 100644 index 6c017c2e..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/controller/TransactionController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.bank.controller; - -import java.util.List; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.bank.Exception.ManagedException; -import com.bank.dto.TransactionReq; -import com.bank.model.Transaction; -import com.bank.service.ITransactionService; - -@RestController -public class TransactionController { - @Autowired - private ITransactionService transactionService; - - - - // this will return all the statements of account id - @GetMapping("/transactionDetails/{accountId}") - public ResponseEntity retriveTrans(@PathVariable final Long accountId) { - - List list; - try { - list = transactionService.generateTransactionReport( accountId); - return new ResponseEntity>(list, HttpStatus.OK); - } catch (ManagedException e) { - String message = e.getMessage(); - return new ResponseEntity(message, HttpStatus.OK); - } - } - - //this will create statements instance which will be used to tract transactions made by user - - @PostMapping("/transactionCreate") - public ResponseEntity createTransaction(@RequestBody final TransactionReq trans) { - - final Transaction transact =trans.getTransaction(); - final Transaction newtrans; - try { - newtrans = transactionService.createTransaction(transact); - return new ResponseEntity(newtrans, HttpStatus.CREATED); - } catch (ManagedException e) { - // TODO Auto-generated catch block - String msg=e.getMessage(); - return new ResponseEntity(msg, HttpStatus.OK); - } - - - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java deleted file mode 100644 index d71f2792..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/ATMReq.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.bank.dto; - -import com.bank.model.ATM; - -public class ATMReq { - private Long bankId; - private ATM atm; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - /** - * @param atm the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } -public ATMReq() { - // TODO Auto-generated constructor stub -} -/** - * @param bankId - * @param atm - */ -public ATMReq(Long bankId, ATM atm) { - this.bankId = bankId; - this.atm = atm; -} - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java deleted file mode 100644 index 065159fa..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AccountRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Account; - -public class AccountRequest { - - private long bankId; - private long customerId; - private Account account; - /** - * @return the bankId - */ - public long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - /** - * @return the account - */ - public Account getAccount() { - return account; - } - /** - * @param account the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountRequest [bankId=" + bankId + ", customerId=" + customerId + ", account=" + account + "]"; - } - - - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java deleted file mode 100644 index bf9f1528..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AccountTransaction.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AccountTransaction { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this. accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java deleted file mode 100644 index 7557450d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/AddMoneyReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class AddMoneyReq { - - private Long atmId; - private Long bankId; - private BigDecimal amount; - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java deleted file mode 100644 index 70ea8de2..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/CreateCustomerRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Customer; - -public class CreateCustomerRequest { - - private Customer customer; - private Long bankID; - - /** - * @return the bankID - */ - public Long getBankID() { - return bankID; - } - /** - * @param bankID the bankID to set - */ - public void setBankID(Long bankID) { - this.bankID = bankID; - } - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - /** - * @param customer the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - /** - * @param customer - * @param bankID - */ - public CreateCustomerRequest(Customer customer, Long bankID) { - super(); - this.customer = customer; - this.bankID = bankID; - } -public CreateCustomerRequest() { - // TODO Auto-generated constructor stub -} -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java deleted file mode 100644 index 50c0153d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/CreateDenominationRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; -import java.util.List; - -public class CreateDenominationRequest { - - private List list; - private Long bankId; - private Long atmId; - /** - * @return the list - */ - public List getList() { - return list; - } - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java deleted file mode 100644 index 427128d3..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/TransactionReq.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.bank.dto; - -import com.bank.model.Transaction; - -public class TransactionReq { - - private Long customerId; - private Long accountId; - private Transaction transaction; - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the transaction - */ - public Transaction getTransaction() { - return transaction; - } - /** - * @param transaction the transaction to set - */ - public void setTransaction(Transaction transaction) { - this.transaction = transaction; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java deleted file mode 100644 index c5af5af7..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/dto/WithrawMoneyReq.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.bank.dto; - -import java.math.BigDecimal; - -public class WithrawMoneyReq { - private Long accountId; - private BigDecimal amount; - private Long atmId; - private Long customerId; - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - /** - * @param customerId the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/ATM.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/ATM.java deleted file mode 100644 index 40851219..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/ATM.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "atm_info") -@Entity -public class ATM extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "atm_id") - private Long ATMId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "id") - private Long bankId; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(final Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - public ATM() { - // TODO Auto-generated constructor stub - } - - - @Override - public String toString() { - return "ATM [ATMId=" + ATMId + ", amount=" + amount + ", bankId=" + bankId + "]"; - } - - /** - * @param aTMId - * @param amount - * @param bankId - */ - public ATM(Long aTMId, BigDecimal amount, Long bankId) { - ATMId = aTMId; - this.amount = amount; - this.bankId = bankId; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java deleted file mode 100644 index d7d7e633..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/ATMDenomination.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Ref_ATM_Denm") -@Entity -public class ATMDenomination extends BaseEntity { - @Column(name = "atm_id") - private Long ATMId; - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noofdenomination") - private int noofDenomination; - - /** - * @return the aTMId - */ - public Long getATMId() { - return ATMId; - } - - /** - * @param aTMId - * the aTMId to set - */ - public void setATMId(Long aTMId) { - ATMId = aTMId; - } - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noofDenomination - */ - public int getNoofDenomination() { - return noofDenomination; - } - - /** - * @param noofDenomination - * the noofDenomination to set - */ - public void setNoofDenomination(int noofDenomination) { - this.noofDenomination = noofDenomination; - } - - public ATMDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param aTMId - * @param denomination - * @param noofDenomination - */ - public ATMDenomination(Long aTMId, BigDecimal denomination, int noofDenomination) { - ATMId = aTMId; - this.denomination = denomination; - this.noofDenomination = noofDenomination; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Account.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Account.java deleted file mode 100644 index 35799591..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Account.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Table(name = "account_details") -@Entity -public class Account extends BaseEntity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "account_id") - private Long accountId; - @Column(name = "amount") - private BigDecimal amount; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(final Customer customer) { - this.customer = customer; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(final Long accountId) { - this.accountId = accountId; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - - public Account() { - - } - - @Override - public String toString() { - return "Account [accountId=" + accountId + ", amount=" + amount + ", customer=" + customer + ", bank=" + bank - + "]"; - } - - /** - * @param accountId - * @param amount - * @param customer - * @param bank - */ - public Account(Long accountId, BigDecimal amount, Customer customer, Bank bank) { - this.accountId = accountId; - this.amount = amount; - this.customer = customer; - this.bank = bank; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/AuditLog.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/AuditLog.java deleted file mode 100644 index 0b3ec89a..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/AuditLog.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.bank.model; - -import java.io.Serializable; -import java.sql.Timestamp; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - - -/*@JsonIgnoreProperties(ignoreUnknown = true)*/ -public class AuditLog implements Serializable { - - private String eventName; - private String eventType; - private Timestamp eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Timestamp getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Timestamp eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - - } - @Override - public String toString() { - return "AuditLog [eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" + eventDate - + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - /** - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(String eventName, String eventType,Timestamp eventDate, String userId, Object oldValue, - Object newValue) { - super(); - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Bank.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Bank.java deleted file mode 100644 index 90569a44..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Bank.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.bank.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * author Ram Dafale - */ - -@Table(name = "bank_details") -@Entity -public class Bank extends BaseEntity implements Serializable { - - @Id - // @SequenceGenerator(name = "bank_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.IDENTITY /* , generator = "bank_seq" */) - @Column(name = "id") - private Long bankId; - - @Column(name = "amount") - private BigDecimal amount; - @OneToMany - @JoinColumn(name = "id", referencedColumnName = "id") - List atmList = new ArrayList(); - - public Bank() { - } - - /** - * method name : getBankId() return type : Long decription : it we get all bank - * id - */ - public Long getBankId() { - return bankId; - } - - /** - * method name : setBankId(final Long bankId) method description : it will set - * the bank id - */ - public void setBankId(final Long bankId) { - this.bankId = bankId; - } - - /** - * method name : getAmount method description : it will get the total bank - * amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * method name : setAmount method parameters : BigDecimal method description : - * it will set bank amount - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } - - /** - * @param bankId - * @param amount - */ - public Bank(Long bankId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.amount = amount; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java deleted file mode 100644 index a1a09385..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/BankDenomination.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Table(name = "Bank_Denm") -@Entity -public class BankDenomination extends BaseEntity { - - @Id - @Column(name = "denomination") - private BigDecimal denomination; - @Column(name = "noOfDenomination") - private int noOfDenomination; - @Column(name = "bank_id") - private Long bankId; - - - - /** - * @return the bankId - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @param denomination - * the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } - - /** - * @return the noOfDenomination - */ - public int getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(int noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - public BankDenomination() { - // TODO Auto-generated constructor stub - } - - /** - * @param bankId - * @param denomination - * @param noOfDenomination - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination) { - - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - - @Override - public String toString() { - return "BankDenomination [denomination=" + denomination + ", noOfDenomination=" + noOfDenomination + ", bankId=" - + bankId + "]"; - } - - /** - * @param denomination - * @param noOfDenomination - * @param bankId - */ - public BankDenomination(BigDecimal denomination, int noOfDenomination, Long bankId) { - super(); - this.denomination = denomination; - this.noOfDenomination = noOfDenomination; - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((denomination == null) ? 0 : denomination.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BankDenomination other = (BankDenomination) obj; - if (denomination == null) { - if (other.denomination != null) - return false; - } else if (!denomination.equals(other.denomination)) - return false; - return true; - } - -} \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java deleted file mode 100644 index 2b313054..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/BaseEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.bank.model; - -import javax.persistence.MappedSuperclass; - -@MappedSuperclass -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId - * the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Customer.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Customer.java deleted file mode 100644 index eb3c1bda..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Customer.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.bank.model; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -/** - * author Ram - */ -@Table(name = "customer_details") -@Entity -public class Customer extends BaseEntity implements Cloneable,Serializable { - - @Id - //@SequenceGenerator(name = "customer_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.IDENTITY/*, generator = "customer_seq"*/) - @Column(name = "id") - private Long customerId; - @Column(name = "customer_name") - private String customerName; - @Column(name = "pin") - private Long pin; - - // relational mapping of bank to customer - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - public Customer() { - // TODO Auto-generated constructor stub - } - - /** - * method name : getCustomerId method returnTypr : Long method description : to - * get customer id - */ - public Long getCustomerId() { - return customerId; - } - - /** - * method name : setCustomerId method parameter : Long method description : it - * will set customerId - */ - public void setCustomerId(final Long customerId) { - this.customerId = customerId; - } - - /** - * method Name : getCustomerName method return type : String method description - * : it will get he customer name - */ - public String getCustomerName() { - return customerName; - } - - /** - * method name : setCustomerName method parameter : String method description : - * it will set customerName - */ - public void setCustomerName(final String customerName) { - this.customerName = customerName; - } - - /** - * method Name : getPin method return type : Long method description : it will - * get he pin - */ - public Long getPin() { - return pin; - } - - /** - * method name : setPin method parameter : Long method description : it will set - * pin - */ - public void setPin(final Long pin) { - this.pin = pin; - } - - /** - * method name : setBank method parameter : Bank method description : it will - * set Bank - */ - public void setBank(final Bank bank) { - this.bank = bank; - } - - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", pin=" + pin + ", bank=" - + bank + "]"; - } - - /** - * @param customerId - * @param customerName - * @param pin - */ - public Customer(Long customerId, String customerName, Long pin) { - super(); - this.customerId = customerId; - this.customerName = customerName; - this.pin = pin; - } - - public Customer(String string, long l) { - - } - @Override - public Customer clone()throws CloneNotSupportedException{ - return (Customer)super.clone(); - } - public Customer( String customerName) { - super(); - - this.customerName = customerName; - - } - - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/RefMoney.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/RefMoney.java deleted file mode 100644 index 3d5d6d26..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/RefMoney.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -@Table(name="ref_money") -@Entity -public class RefMoney extends BaseEntity { - @Id - private BigDecimal denomination; - - /** - * @return the denomination - */ - public BigDecimal getDenomination() { - return denomination; - } - - /** - * @param denomination the denomination to set - */ - public void setDenomination(BigDecimal denomination) { - this.denomination = denomination; - } -public RefMoney() { - // TODO Auto-generated constructor stub -} -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Transaction.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Transaction.java deleted file mode 100644 index c958e83c..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/model/Transaction.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.bank.model; - -import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; - -import org.springframework.stereotype.Component; - -@Table(name = "transaction_details") -@Entity -@Component -public class Transaction extends BaseEntity{ - @Id - @SequenceGenerator(name = "transaction_seq", initialValue = 1, allocationSize = 1) - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "transaction_seq") - @Column(name = "transaction_id") - private Long transactionId; - @Column(name = "amount") - private BigDecimal amount; - @Column(name = "transaction_type") - private String transactionType; - - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - @ManyToOne(targetEntity = Account.class) - private Account account; - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(final Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customerId - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(final BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(final String transactionType) { - this.transactionType = transactionType; - } - - public Transaction() { - // TODO Auto-generated constructor stub - } - - /** - * @param customerId - * @param accountId - * @param amount - * @param transactionType - */ - public Transaction(BigDecimal amount, String transactionType) { - super(); - /* - * this.customerId = customerId; this.accountId = accountId; - */ - this.amount = amount; - this.transactionType = transactionType; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java deleted file mode 100644 index c08f97c5..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/ATMDenoRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATMDenomination; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMDenoRepository extends JpaRepository { - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java deleted file mode 100644 index bb53cc1c..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/ATMRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.ATM; -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface ATMRepository extends JpaRepository{ - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java deleted file mode 100644 index c5754c5c..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/AccountRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.Account; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface AccountRepository extends JpaRepository{ - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java deleted file mode 100644 index 15a792ac..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/BankRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import org.springframework.stereotype.Repository; - -import com.bank.model.Bank; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -@Repository -public interface BankRepository extends JpaRepository { - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java deleted file mode 100644 index e603c132..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/CustomerRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Customer; -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface CustomerRepository extends JpaRepository { - - Optional findOneByCustomerName(String CustomerName); -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java deleted file mode 100644 index 5711e5c3..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/DenominationRepository.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.BankDenomination; - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface DenominationRepository extends JpaRepository{ - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java deleted file mode 100644 index ad5053dc..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/RefMoneyRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.bank.repository; - -import java.math.BigDecimal; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.bank.model.RefMoney; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface RefMoneyRepository extends JpaRepository { - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java deleted file mode 100644 index ed3ce906..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/repository/TransactionRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import com.bank.model.Account; -import com.bank.model.Transaction; - - -/** - * @author ram - * this interface provide various methods of JPAREPOSITORY - * to deal with operations - * - */ -public interface TransactionRepository extends JpaRepository{ - - - /* - * this query will find trasanction where account id is associated - */ - @Query(value="select * from transaction_details where account_account_id=?1",nativeQuery=true) - List findAllByAccountId(Long accountId); - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java deleted file mode 100644 index edeef456..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("atmService") -public class ATMServiceImpl implements IATMService { - - final Logger LOGGER = LoggerFactory.getLogger(ATMServiceImpl.class); - -//injectiong all required properties - @Autowired - private ATMRepository atmRepo; - @Autowired - private IBankService bankService; - @Autowired - private IAccountService accountService; - @Autowired - private ICustomerService customerService; - @Autowired - private TransactionRepository trans; - @Autowired - private IAtmDenoService atmDeno; - - - //will create new instance for atm - @Override - public ATM createATM(final ATM atm) throws ManagedException { - // TODO Auto-generated method stub - final ATM atm1 = atmRepo.save(atm); - if (atm1 != null) { - LOGGER.info("atm is added"); - return atm1; - } else { - LOGGER.error("no atm is added"); - throw new ManagedException("No such atm is created!!"); - } - } - - // will add money from bank to atm - @Transactional - @Override - public String addMoneyFromBank(final AddMoneyReq atmreq) throws ManagedException { - // TODO Auto-generated method stub - final Optional atm = atmRepo.findById(atmreq.getAtmId()); - if (atm.isPresent()) { - ATM atm1 = atm.get(); - final Long bankID = atmreq.getBankId(); - final Long bankId = atm1.getBankId(); - if (bankID.equals(bankId)) { - final BigDecimal amount = atmreq.getAmount(); - final Optional bankopt=bankService.getBankDetailsByID(atmreq.getBankId()); - final Bank bank=bankopt.get(); - BigDecimal bankAmount = bank.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(bankAmount) == -1) { - BigDecimal atmAmount = atm1.getAmount(); - atmAmount = atmAmount.add(amount); - atm1.setAmount(atmAmount); - bankAmount = bankAmount.subtract(amount); - bank.setAmount(bankAmount); - bankService.createBank(bank); - atmRepo.save(atm1); - atmDeno.atmDenominationDeposit(atmreq.getAmount(), atmreq.getAtmId()); - LOGGER.info("amount is added to your account"); - return "amount added"; - - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less than you want"); - } - } - else - { - LOGGER.error("amount is negative"); - throw new ManagedException("amount connot be negative"); - } - - } - else - { - LOGGER.error("no bank id exist"); - throw new ManagedException("no such bank id exist"); - } - } - else - { - LOGGER.error("no atm id exist"); - throw new ManagedException("no such atm id exist"); - } - - } - - // will withdraws monet atm - - @Transactional - @Override - public Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException { - final Optional atm = atmRepo.findById(withdraw.getAtmId()); - if (atm.isPresent()) { - final ATM atm1 = atm.get(); - BigDecimal amount = atm1.getAmount(); - if (amount.compareTo(BigDecimal.ZERO) > 0) { - if (amount.compareTo(withdraw.getAmount()) == 1) { - final Account account =accountService.getAccountDetails(withdraw.getAccountId()); - BigDecimal accountAmount = account.getAmount(); - if (accountAmount.compareTo(withdraw.getAmount()) == 1) { - amount = amount.subtract(withdraw.getAmount()); - atm1.setAmount(amount); - accountAmount = accountAmount.subtract(withdraw.getAmount()); - account.setAmount(accountAmount); - accountService.createAccount(account); - atmRepo.save(atm1); - Transaction transaction = new Transaction(); - transaction.setAccount(account); - transaction.setAmount(account.getAmount()); - final Customer customer = customerService.getCustomerDetails(withdraw.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.save(transaction); - LOGGER.info("amount is deducted"); - return withdraw.getAccountId(); - } - else - { LOGGER.error("low balance"); - throw new ManagedException("your account balance is less thsn amount you want to withdraw"); - } - } - else - { LOGGER.error("atm amount is less"); - throw new ManagedException("atm does not have this much of amount"); - } - } - else - { LOGGER.error("-ve amount not possible "); - throw new ManagedException("negative amount cannot possible"); - } - } - else - { LOGGER.error("no atm id exist"); - throw new ManagedException("no such id of atm exist"); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java deleted file mode 100644 index b3dbada0..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.model.Transaction; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.repository.TransactionRepository; - -@Service("accountService") -public class AccountServiceImpl implements IAccountService { - final Logger LOGGER = LoggerFactory.getLogger(AccountServiceImpl.class); - @Autowired - private AccountRepository accountRepository; - @Autowired - private ITransactionService trans; - @Autowired - private ICustomerService customerService; - @Autowired - private IBankService bankService; - @Autowired - private IBankDenominationService bankDenoService; - private BigDecimal balance; - - - // this will create account instance for customer - @Override - public Account createAccount(final Account account) throws ManagedException { - final Account acc = accountRepository.save(account); - if (acc != null) { - LOGGER.info("account created"); - return acc; - } else { - LOGGER.error("no account is created"); - throw new ManagedException("No account is created"); - } - } - //this will credit money to account - @Transactional - @Override - public Long depositMoney(final AccountTransaction account) throws ManagedException { - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - final Optional acc1 = accountRepository.findById(account.getAccountId()); - if (acc1.isPresent()) { - - final Account acc = acc1.get(); - balance = acc.getAmount(); - balance = balance.add(account.getAmount()); - acc.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - bankDenoService.bankDenominationDeposit(account.getAmount(),account.getBankId()); - - }else - { LOGGER.error("no bank id present"); - throw new ManagedException("no bank is present of given id"); - } - Transaction transaction = new Transaction(); - transaction.setAccount(acc); - transaction.setAmount(acc.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - transaction.setCustomer(customer); - transaction.setTransactionType("credit"); - trans.createTransaction(transaction); - LOGGER.info("AMOUNT IS ADDED"); - return account.getCustomerId(); - } else { - LOGGER.error("no amount is deposited"); - throw new ManagedException("zero amount deposited"); - } - } - else - { - LOGGER.error("-ve amount is not possible"); - throw new ManagedException("negative amount is not possible"); - } - } - - //this will debit money from account - @Transactional - @Override - public Long withdrawlMoney(final AccountTransaction account) throws ManagedException { - // TODO Auto-generated method stub - if (account.getAmount().compareTo(BigDecimal.ZERO) > 0) { - Optional acc1 = accountRepository.findById(account.getAccountId()); - if (acc1.isPresent()) { - final Account account1 = acc1.get(); ; - balance = account1.getAmount(); - balance = balance.subtract(account.getAmount()); - account1.setAmount(balance); - final Optional bank = bankService.getBankDetailsByID(account.getBankId()); - if (bank.isPresent()) { - bankDenoService.bankDenominationWithdraw(account.getAmount(), account.getBankId()); - final Bank bank1 = bank.get(); - bank1.setAmount(balance); - bankService.createBank(bank1); - - Transaction transaction=new Transaction(); - transaction.setAccount(account1); - transaction.setAmount(account1.getAmount()); - final Customer customer = customerService.getCustomerDetails(account.getCustomerId()); - if(customer!=null) - { - transaction.setCustomer(customer); - transaction.setTransactionType("debit"); - trans.createTransaction(transaction); - LOGGER.info("amount is deducted"); - return account.getCustomerId(); - } - else - { LOGGER.error("no customer exist"); - throw new ManagedException("No customer of such occunct exsit"); - } - }else - {LOGGER.error("no account exist"); - throw new ManagedException("No such account exist"); - } - - } else { - LOGGER.error("not enough amount to withdraw"); - throw new ManagedException("No amount withdraw"); - } - } - else - { - LOGGER.error("-ve value is not posssible"); - throw new ManagedException("negative amount is not possible"); - } - } - - - //It will give account details of perticular Id - @Override - public Account getAccountDetails(final Long id) throws ManagedException { - // TODO Auto-generated method stub - Account account = accountRepository.findById(id).get(); - if (account != null) { - LOGGER.info("account retrived"); - return account; - } else { - LOGGER.error("no such id exist"); - throw new ManagedException("no such element found"); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java deleted file mode 100644 index 4839f4fa..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AtmDenoServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.ATM; -import com.bank.model.ATMDenomination; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.ATMDenoRepository; -import com.bank.repository.ATMRepository; -import com.bank.repository.DenominationRepository; - -@Service -public class AtmDenoServiceImpl implements IAtmDenoService{ - - - @Autowired - private IRefServcie refService; - - @Autowired - private DenominationHelper denominationHelper; - - @Autowired - private ATMDenoRepository atmdenoRepository; - @Autowired - private ATMRepository atmRepo; - @Autowired - private DenominationRepository bankDeno; - @Autowired - IBankService bankService; - - - // this will create denominations for atm - @Override - public void atmDenominationCreate(List list, Long atmId) throws ManagedException { - - for(BigDecimal denom: list ) - { - final ATMDenomination first = new ATMDenomination(atmId,new BigDecimal(denom.intValue()), 0); - atmdenoRepository.save(first); - - } - } - - //this method provide logic (when you add money to atm ) for denominations adjustments - @Override - public void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException { - // TODO Auto-generated method stub - - List newList=refService.returnAll(); - - List list = new ArrayList<>(); - for(RefMoney deno:newList) - { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - ATMDenomination atmDeno=new ATMDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count=pair.getValue(); - System.out.println("key value"+myValue); - Optional deno=atmdenoRepository.findById(myValue); - ATMDenomination denomination=deno.get(); - System.out.println("denomination"+denomination); - System.out.println("count value"+count); - ATM atm=atmRepo.findById(atmId).get(); - BankDenomination bank=bankDeno.findById(myValue).get(); - int newNum=bank.getNoOfDenomination()-count; - bank.setNoOfDenomination(newNum); - bankDeno.save(bank); - denomination.setATMId(atmId); - denomination.setNoofDenomination(denomination.getNoofDenomination()+count); - - atmdenoRepository.save(denomination); - } - } - } - - - - diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AuditRegistrationSource.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AuditRegistrationSource.java deleted file mode 100644 index f8d9d16f..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AuditRegistrationSource.java +++ /dev/null @@ -1,15 +0,0 @@ -/*package com.bank.service; - -import org.springframework.cloud.stream.annotation.Output; -import org.springframework.messaging.MessageChannel; - -public interface AuditRegistrationSource { - - - - @Output("auditRegistrationChannel") - MessageChannel auditRegistration(); - - -} -*/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java deleted file mode 100644 index 1c583f50..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/AuditServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.bank.service; - -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.bank.model.AuditLog; - -@Service -public class AuditServiceImpl { - - //generate audit log - public AuditLog generateAudit(final AuditLog audit) - { - final RestTemplate restTemplate=new RestTemplate(); - final String uri="http://localhost:8082/audit"; - System.out.println("audit obnject " + audit); - final AuditLog audii=restTemplate.postForObject(uri, audit, AuditLog.class); - return audii; - } -} - \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index 1d2acb94..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.model.BankDenomination; -import com.bank.model.RefMoney; -import com.bank.repository.DenominationRepository; - -@Service -public class BankDenominationServiceImpl implements IBankDenominationService { - @Autowired - private DenominationRepository denominationRepo; - @Autowired - private IBankService bankServcie; - @Autowired - private DenominationHelper denominationHelper; - @Autowired - private IRefServcie refService; - - - //create denomination for bank - @Override - public void bankDenominationCreate(List list, Long bankId) throws ManagedException { - - // to get values from database - for (BigDecimal denom : list) { - final BankDenomination first = new BankDenomination(new BigDecimal(denom.intValue()), 0, bankId); - denominationRepo.save(first); - - } - - } - - - //this will provide logic: when you withdraws money denominations will get adjusted accordingly - - @Override - public void bankDenominationWithdraw(BigDecimal amount, Long bankId) throws ManagedException { - List newList = refService.returnAll(); - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getcountDenomination(amount, list); - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - System.out.println("key value" + myValue); - Optional deno = denominationRepo.findById(myValue); - BankDenomination denomination = deno.get(); - System.out.println("denomination" + denomination); - System.out.println("count value" + count); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() - count); - denominationRepo.save(denomination); - - } - - } - - @Override - public void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException { - - List newList = refService.returnAll(); - - List list = new ArrayList<>(); - for (RefMoney deno : newList) { - list.add(deno.getDenomination()); - } - Map denomValues = denominationHelper.getDenominatioValues(amount, list); - - BankDenomination bankDeno = new BankDenomination(); - - long i = 0; - Iterator> it = denomValues.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pair = it.next(); - BigDecimal myValue = pair.getKey(); - Integer count = pair.getValue(); - - Optional deno = denominationRepo.findById(myValue); - BankDenomination denomination = deno.get(); - Bank bank = bankServcie.getBankDetailsByID(bankId).get(); - denomination.setBankId(bankId); - denomination.setNoOfDenomination(denomination.getNoOfDenomination() + count); - denominationRepo.save(denomination); - } - - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java deleted file mode 100644 index bb1f1c50..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; -import com.bank.repository.BankRepository; - -@Service("bankService") -public class BankServiceImpl implements IBankService { - - final Logger LOGGER = LoggerFactory.getLogger(BankServiceImpl.class); - @Autowired - private BankRepository bankRepository; - @Autowired - private IBankDenominationService bankDenoService; - - - // create new bank instance - @Override - public Bank createBank(final Bank bank) throws ManagedException { - final Bank bank1 = bankRepository.save(bank); - if (bank1 != null) { - - return bank1; - } else { - LOGGER.error("No bank is added"); - throw new ManagedException("No Bank is Added"); - } - } - - - @Override - public List getBankDetails() throws ManagedException { - final List list = bankRepository.findAll(); - if (list.isEmpty()) { - LOGGER.error("No banks found"); - throw new ManagedException("No bank found"); - } else { - return list; - } - } - - @Override - public Optional getBankDetailsByID(final long ID) throws ManagedException { - // TODO Auto-generated method stub - final Optional bank = bankRepository.findById(ID); - if (bank.isPresent()) { - return bank; - } else { - LOGGER.error("no bank of such id exist"); - throw new ManagedException("No such bank found"); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java deleted file mode 100644 index f692e909..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.bank.service; - -import java.io.IOException; -import java.sql.Timestamp; -import java.time.LocalDateTime; - -import org.apache.commons.lang.SerializationUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -/*import org.springframework.cloud.stream.annotation.EnableBinding;*/ -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.AuditLog; -import com.bank.model.Customer; -import com.bank.repository.CustomerRepository; -import com.configrabbit.RabbitConfig; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -enum EventName { - CUSTOMER, ACCOUNT, ATM, BANK -} - -enum EventType { - CREATED, UPDATED -} - -@Service("customerService") -@Component -/* @EnableBinding(AuditRegistrationSource.class) */ -public class CustomerServiceImpl implements ICustomerService, Cloneable { - - final static Logger LOGGER = LoggerFactory.getLogger(CustomerServiceImpl.class); - @Autowired - private CustomerRepository customerRepository; - @Autowired - AuditServiceImpl auditService; - - @Autowired - RabbitTemplate template; - - @Override - public Customer createCustomer(final Customer customer) throws ManagedException { - final Customer custom = customerRepository.save(customer); - if (custom != null) { - return custom; - } else { - LOGGER.error("No customer is added"); - throw new ManagedException("no customer is created"); - } - } - - @Override - public Customer getCustomerDetails(final Long id) throws ManagedException { - - final Customer customer = customerRepository.findById(id).get(); - if (customer != null) { - return customer; - } else { - LOGGER.info("No customer of given id is exist"); - throw new ManagedException("no customer of such id exist"); - } - - } - - public static String fromJavaToJson(AuditLog audit) - throws JsonGenerationException, JsonMappingException, IOException { - ObjectMapper jsonMapper = new ObjectMapper(); - return jsonMapper.writeValueAsString(audit); - } - - @Override - public Customer updateCustomer(final Long id, final String name, final String userId) - throws ManagedException, CloneNotSupportedException { - // TODO Auto-generated method stub - final Customer customer = customerRepository.findById(id).get(); - - Customer oldcustmer = customer.clone(); - - if (customer != null) { - customer.setCustomerName(name); - customer.setUserId(userId); - Customer cust = customerRepository.save(customer); - Timestamp time = Timestamp.valueOf(LocalDateTime.now()); - AuditLog audit = new AuditLog(EventName.CUSTOMER.toString(), EventType.UPDATED.toString(), time, - cust.getUserId(), oldcustmer, cust); - - // AuditLog ob = auditService.generateAudit(audit); - - System.out.println("hii"); - String rabbitSendData = null; - try { - rabbitSendData = CustomerServiceImpl.fromJavaToJson(audit); - } catch (JsonGenerationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - template.convertAndSend(RabbitConfig.ROUTING_KEY, rabbitSendData); - return cust; - } else { - LOGGER.info("No customer is updated as id not exist"); - throw new ManagedException("no customer is updated"); - } - - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java deleted file mode 100644 index 8621dc3d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/DenominationHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -@Component -public class DenominationHelper { - - public Map getDenominatioValues(final BigDecimal amount , final List list) throws ManagedException { - final Map newMap=new HashMap(); - Random random = new Random(); - BigDecimal remainder = amount; - if(amount.intValue()>=0) - { - for(int i=0;i<=list.size();i++) - { - Integer randomIndex = random.nextInt(list.size()); - BigDecimal randomElement = list.get(randomIndex); - if ( !(randomElement.compareTo(remainder) >0) ) { - Integer count=remainder.divide(randomElement).intValue(); - remainder= remainder.remainder( randomElement); - - newMap.put(randomElement,count); - - if (remainder.compareTo(BigDecimal.ZERO) ==0) { - break; - } - } - list.remove(randomIndex); - - } - if (remainder.compareTo(BigDecimal.ZERO) !=0) { - System.out.println("cant Proceed "); - return null ; - } - - } - return newMap; - } - - - - public Map getcountDenomination(BigDecimal amount, List list) throws ManagedException - { - Map newMap = new HashMap(); - - List selectedList = new ArrayList(); - for (BigDecimal denom : list) { - if (denom.compareTo(amount) <= 0) { - selectedList.add(denom); - } else { - throw new ManagedException("selected list is empty"); - } - } - for (int i = 0; i <= selectedList.size(); i++) { - BigDecimal maxDen = Collections.max(selectedList); - Integer count = amount.divide(maxDen).intValue(); - amount = amount.remainder(maxDen); - newMap.put(maxDen, count); - - if (amount.compareTo(BigDecimal.ZERO) == 0) { - break; - } - selectedList.remove(maxDen); - } - // get index of particular element - if (amount.compareTo(BigDecimal.ZERO) != 0) { - throw new ManagedException("amount cannot be withdrawn"); - } - return newMap; - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IATMService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IATMService.java deleted file mode 100644 index 91f56b9e..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IATMService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AddMoneyReq; -import com.bank.dto.WithrawMoneyReq; -import com.bank.model.ATM; - -/** - * @author ram - */ -public interface IATMService { - /** - * method name : createATM return type : ATM object parameter :object of ATM - * description : this method will return a atm which is created - */ - ATM createATM(final ATM atm) throws ManagedException; - - /** - * method name : addMoneyFromBank return type : String parameter :object of - * ATMMoneyReq description : this method will return a string if money is added - * to atm - */ - String addMoneyFromBank(final AddMoneyReq atm) throws ManagedException; - - /** - * method name : withrawMoney return type : String parameter :object of - * WithdrawMoneyReq description : this method will return a string if - * successfully money withraw - */ - Long withrawMoney(final WithrawMoneyReq withdraw) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IAccountService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IAccountService.java deleted file mode 100644 index d207310b..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IAccountService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.dto.AccountTransaction; -import com.bank.model.Account; - -public interface IAccountService { - /** - * method name : createAccount return type : Account object parameter :object of - * Account class description : this method will return a account which is - * created - */ - Account createAccount(final Account account) throws ManagedException; - - /** - * method name : depositMoney return type : String parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully amount is added and add to transaction list - */ - Long depositMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : withdrawlMoney return type : String object parameter :object of - * AccountTransaction class description : this method will return a string if - * successfully withdraw and add to transaction list - */ - Long withdrawlMoney(final AccountTransaction account) throws ManagedException; - - /** - * method name : getAccountDetails return type : Account object parameter :Long - * id description : this method will return a account which is created of given - * id - */ - Account getAccountDetails(final Long id) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java deleted file mode 100644 index 47657d85..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IAtmDenoService.java +++ /dev/null @@ -1,15 +0,0 @@ - package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; - -public interface IAtmDenoService { - - - - - void atmDenominationCreate(List list,Long atmId)throws ManagedException; - void atmDenominationDeposit(BigDecimal amount, Long atmId) throws ManagedException; -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java deleted file mode 100644 index 124f9c5b..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IBankDenominationService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import com.bank.Exception.ManagedException; - -public interface IBankDenominationService { - - - void bankDenominationWithdraw(BigDecimal amount,Long bankId) throws ManagedException; - void bankDenominationDeposit(BigDecimal amount, Long bankId) throws ManagedException ; - void bankDenominationCreate(List list,Long bankId)throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IBankService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IBankService.java deleted file mode 100644 index a464c987..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IBankService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Bank; - -public interface IBankService { - /* - * description : this method will return a bank which is created - */ - Bank createBank(final Bank bank) throws ManagedException; - - /* description : this method will return a list of all banks - */ - List getBankDetails() throws ManagedException; - - /* - * description : this method will return a bank of given id - */ - Optional getBankDetailsByID(final long Id) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java deleted file mode 100644 index 8256c10f..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ICustomerService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.bank.service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Customer; - -/** - * @author ram - * - */ -public interface ICustomerService { - /** - * description : this method will return a customer which is - * created - */ - Customer createCustomer(final Customer customer) throws ManagedException; - - /** - * description : this method will return a customer of specified id - */ - Customer getCustomerDetails(final Long id) throws ManagedException; - /* - * description : this method will return a customer of specified id with updation - * @throws CloneNotSupportedException ,ManagedException - */ - Customer updateCustomer(final Long id,final String name, final String userId ) throws ManagedException, CloneNotSupportedException; -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java deleted file mode 100644 index 85867ad5..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/IRefServcie.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; - -/** - * @author ram - * - */ -public interface IRefServcie { - - /** - * - * @param denomination - * @return - * @throws BankException - */ - - /** - * - * @return - * @throws ManagedException - */ - List returnAll() throws ManagedException; - void createDenomination(List list) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java deleted file mode 100644 index 9e8c9978..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/ITransactionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.bank.service; - -import java.util.List; -import java.util.Optional; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; - -/** - * @author ram - * - */ -public interface ITransactionService { - /** - * method name : createTransaction return type : Transaction object parameter - * :Transaction description : this method will return a transaction which is - * created - */ - Transaction createTransaction(final Transaction trans) throws ManagedException; - - /** - * method name : generateTransactionReport return type : List - * Object description : this method will return a list which of transactions - */ - List generateTransactionReport(Long accountId) throws ManagedException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java deleted file mode 100644 index 8a4a66f1..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/RefServcieImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.bank.service; - -import java.math.BigDecimal; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.RefMoney; -import com.bank.repository.RefMoneyRepository; -@Service -public class RefServcieImpl implements IRefServcie { - -@Autowired -private RefMoneyRepository refRepo; - @Override - public void createDenomination(List list) throws ManagedException{ - for(BigDecimal denomination: list ) - { - if(!refRepo.findById(denomination).isPresent()) - { - RefMoney refMoney=new RefMoney(); - refMoney.setDenomination(denomination); - refRepo.save(refMoney); - //return true; - } - else - { - throw new ManagedException("Denomination already exist!!!!"); - } - } - } - - @Override - public List returnAll() throws ManagedException { - - List list=refRepo.findAll(); - if(list.isEmpty()) - { - throw new ManagedException("no denomination found"); - } - else - { - return list; - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java deleted file mode 100644 index 213e1ea6..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.bank.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bank.Exception.ManagedException; -import com.bank.model.Transaction; -import com.bank.repository.TransactionRepository; -@Service -public class TransactionServiceImpl implements ITransactionService{ - final Logger LOGGER = LoggerFactory.getLogger(TransactionServiceImpl.class); - @Autowired - private TransactionRepository transact; - - @Override - public Transaction createTransaction(final Transaction trans) throws ManagedException { - - final Transaction newtransaction =transact.save(trans); - if(newtransaction!=null) - { - return newtransaction; - } - else - { - throw new ManagedException("no transaction has been created"); - } - } - - @Override - public List generateTransactionReport(Long accountId) throws ManagedException { - // TODO Auto-generated method stub - System.out.println(">>>>>>>>"+accountId); - List transopt=transact.findAllByAccountId(accountId); - System.out.println(">>>>>>>>"+transopt); - - return transopt; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/configrabbit/RabbitConfig.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/configrabbit/RabbitConfig.java deleted file mode 100644 index 7a0370c7..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/java/com/configrabbit/RabbitConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.configrabbit; - -import org.springframework.amqp.core.TopicExchange; -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.Queue; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - - -@Configuration -public class RabbitConfig { - //exchange will send the message through ROUTING_KEY to queue - public static final String ROUTING_KEY="sfg-message-queue"; - - //queue will recieve the message and make it durable - @Bean - Queue queue() - { - return new Queue(ROUTING_KEY, true); - } - - @Bean - TopicExchange exchange() - { - return new TopicExchange("spring-boot-exchange"); - - } - - @Bean - Binding binding(Queue queue, TopicExchange exchange) - { - return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY); - - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/resources/application.properties b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/resources/application.properties deleted file mode 100644 index 3d86cd80..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/main/resources/application.properties +++ /dev/null @@ -1,11 +0,0 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/bankapp?useSSL=false -spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true - -spring.rabbitmq.host = 127.0.0.1 -spring.rabbitmq.port = 5672 -spring.rabbitmq.username=guest -spring.rabbitmq.password=guest \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java deleted file mode 100644 index 15bba781..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/17BankInCapg/src/test/java/com/bank/testcases/AllTestCases.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.bank.testcases; - - - - - - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Optional; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.bank.Exception.ManagedException; -import com.bank.controller.CustomerController; -import com.bank.dto.ATMReq; -import com.bank.dto.CreateCustomerRequest; -import com.bank.model.ATM; -import com.bank.model.Account; -import com.bank.model.Bank; -import com.bank.model.Customer; -import com.bank.repository.ATMRepository; -import com.bank.repository.AccountRepository; -import com.bank.repository.BankRepository; -import com.bank.repository.CustomerRepository; -import com.bank.service.ATMServiceImpl; -import com.bank.service.AccountServiceImpl; -import com.bank.service.BankServiceImpl; -import com.bank.service.CustomerServiceImpl; - -@RunWith(SpringRunner.class) -@SpringBootTest -@SpringBootConfiguration -@ComponentScan("application.properties") -public class AllTestCases { - - @Autowired - CustomerRepository customerRepository; - - @Autowired - CustomerServiceImpl customerServiceImpl; - - @Autowired - BankRepository bankRepository; - - @Autowired - BankServiceImpl bankServiceImpl; - - @Autowired - AccountRepository accountRepository; - - @Autowired - AccountServiceImpl accountServiceImpl; - - @Autowired - ATMRepository atmRepository; - - @Autowired - ATMServiceImpl atmServiceImpl; - - - @Test - public void createBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - when(bankRepository.save(bank)).thenReturn(bank); - // System.out.println(bank); - assertThat(bankServiceImpl.createBank(bank), is(notNullValue())); - } - - @Test - public void testAddBank() throws ManagedException { - final Bank bank = new Bank(1L, new BigDecimal(0)); - bankServiceImpl.createBank(bank); - - List departments = bankServiceImpl.getBankDetails(); - Assert.assertEquals(1, departments.size()); - } - - @Test - public void testAddCustomer() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - List employees = (List) customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(1, employees.size()); - } - - - @Test - public void testAddCustomerName() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getCustomerName(), employees.getCustomerName()); - } - RestTemplate restTemplate = new RestTemplate(); - @Autowired - CustomerController customerController; - - - - @Test - public void customerCreateRestTemplateTest() { - Customer customer = new Customer(); - customer.setCustomerName("Lokesh"); - customer.setPin(442001L); - - final String uri = "http://localhost:8080/customer/createCustomer"; - Optional ob = bankRepository.findById(1L); - Bank obj = ob.get(); - - CreateCustomerRequest createCustomerRequest = new CreateCustomerRequest(customer,1L); - String result = restTemplate.postForObject(uri, createCustomerRequest, String.class); - - //System.out.println(result); - assertEquals(result, customerController.createCustomer(createCustomerRequest)); - } - - - - @Test - public void viewCustByRestTemplateTest() { - - final String uri = "http://localhost:8080/getCustomer"; - - RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - System.out.println(result); - assertEquals(result, customerController.getCustomer(1L)); - } - - - - @Test - public void testAddCustomerpin() throws ManagedException { - - Customer employee = new Customer(); - employee.setCustomerName("Lokesh"); - employee.setPin(442001L); - - customerServiceImpl.createCustomer(employee); - - Customer employees = customerServiceImpl.getCustomerDetails(1L); - Assert.assertEquals(employee.getPin(), employees.getPin()); - } - - - @Test - public void testAddAccount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - List information = (List) accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(1, information.size()); - } - - @Test - public void testAddAccountAmount() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAmount(), information.getAmount()); - } - - @Test - public void testAddAccountId() throws ManagedException { - - Account account = new Account (1L,new BigDecimal(100),new Customer(),new Bank(1L,new BigDecimal(0))); - - - accountServiceImpl.createAccount(account); - - Account information = accountServiceImpl.getAccountDetails(1L); - Assert.assertEquals(account.getAccountId(), information.getAccountId()); - } - - - @Test - public void createAtm() throws ManagedException { - Bank bank = new Bank(1L,new BigDecimal(1200)); - - Optional bnk = Optional.of(bank); - - ATM atm = new ATM(1L,new BigDecimal(5000), 1L); - - //ATMReq req = new ATMReq(1L,atm); - - - when(bankRepository.findById(Mockito.any(Long.class))).thenReturn(bnk); - when(atmRepository.save(atm)).thenReturn(atm); - assertThat(atmServiceImpl.createATM(atm), is(notNullValue())); - - } - - -} \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.gitignore b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.mvn/wrapper/maven-wrapper.jar b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.mvn/wrapper/maven-wrapper.properties b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/bootstrap.properties b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/bootstrap.properties deleted file mode 100644 index a2136c3d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/bootstrap.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.application.name=mongo-service -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8082 -spring.cloud.config.uri=http://localhost:8888 \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/mvnw b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/mvnw.cmd b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/pom.xml b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/pom.xml deleted file mode 100644 index 68500f50..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 4.0.0 - - com.mongoDb - mongodbExample - 0.0.1-SNAPSHOT - jar - - mongodbExample - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - - - - - - - UTF-8 - UTF-8 - 1.8 - Edgware.SR3 - - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-amqp - - - - org.projectlombok - lombok - 1.16.20 - provided - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java deleted file mode 100644 index 82ac709d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/MongoMain.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.mongo.db; - -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.MessageListener; -import org.springframework.amqp.core.Queue; -import org.springframework.amqp.core.TopicExchange; -import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; -import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; - -import com.mongo.db.rcvlistner.MsgListener; - -@SpringBootApplication -public class MongoMain { - public final static String MESSAGE_QUEUE = "sfg-message-queue"; - - @Bean - Queue queue() { - return new Queue(MESSAGE_QUEUE, false); - } - - @Bean - TopicExchange exchange() { - return new TopicExchange("spring-boot-exchange"); - } - - @Bean - Binding binding(Queue queue, TopicExchange exchange) { - return BindingBuilder.bind(queue).to(exchange).with(MESSAGE_QUEUE); - } - - @Bean - SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, - MessageListenerAdapter listenerAdapter) { - SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); - container.setConnectionFactory(connectionFactory); - container.setQueueNames(MESSAGE_QUEUE); - container.setMessageListener(listenerAdapter); - return container; - } - - @Bean - MessageListenerAdapter listenerAdapter(MsgListener receiver) { - return new MessageListenerAdapter(receiver, "receiveMessage"); - } - public static void main(String[] args) { - SpringApplication.run(MongoMain.class, args); - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java deleted file mode 100644 index a8303759..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/controller/AuditController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.mongo.db.controller; - -import java.util.List; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -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.RestController; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.service.IAuditService; -import com.mongo.db.vo.updateAuditRequest; - -/** - * @author trainee - * - */ -//@RequestMapping("/audit") -@RestController -public class AuditController { - - @Autowired - private IAuditService auditService; -/** - * - * @param audit - * @return - */ - @PostMapping - public ResponseEntitycreate(@RequestBody final AuditLog audit) - { - try { - auditService.createAudit(audit); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException exep) { - return new ResponseEntity(exep.getMessage(),HttpStatus.OK); - } - } - /** - * - * @param eventName - * @return - */ - @GetMapping("/{eventName}") - public ResponseEntitygetAudit(@PathVariable @NotNull final String eventName) - { - - try { - List list=auditService.getDetails(eventName); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @return - */ - @GetMapping - public ResponseEntitygetAllAudit() - { - - try { - List list=auditService.findall(); - return new ResponseEntity>(list,HttpStatus.OK); - } catch (AuditException e) { - - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param update - * @return - */ - @PutMapping - public ResponseEntityupdateAudit(@RequestBody final updateAuditRequest update) - { - - try { - AuditLog audit=auditService.update(update.getEventId(), update.getEventType()); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - - /** - * - * @param eventId - * @return - */ - @DeleteMapping("{eventId}") - public ResponseEntitydeleteAudit(@PathVariable final UUID eventId) - { - - try { - - String audit=auditService.deleteAudit(eventId); - return new ResponseEntity(audit,HttpStatus.ACCEPTED); - } catch (AuditException e) { - - return new ResponseEntity(e.getMessage(),HttpStatus.OK); - } - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java deleted file mode 100644 index 1b55caac..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/document/AuditLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.mongo.db.document; - -import java.util.Date; -import java.util.UUID; - -import javax.validation.constraints.NotNull; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Document -public class AuditLog { - - @Id - @NotNull - private UUID eventID=UUID.randomUUID(); - @NotNull - private String eventName; - private String eventType; - private Date eventDate; - private String userId; - private Object oldValue; - private Object newValue; - /** - * - * @return the eventID - */ - public UUID getEventID() { - return eventID; - } - /** - * @param eventID the eventID to set - */ - public void setEventID(UUID eventID) { - this.eventID = eventID; - } - /** - * @return the eventName - */ - public String getEventName() { - return eventName; - } - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - /** - * @return the eventDate - */ - public Date getEventDate() { - return eventDate; - } - /** - * @param eventDate the eventDate to set - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - /** - * @return the oldValue - */ - public Object getOldValue() { - return oldValue; - } - /** - * @param oldValue the oldValue to set - */ - public void setOldValue(Object oldValue) { - this.oldValue = oldValue; - } - /** - * @return the newValue - */ - public Object getNewValue() { - return newValue; - } - /** - * @param newValue the newValue to set - */ - public void setNewValue(Object newValue) { - this.newValue = newValue; - } - - public AuditLog() { - // TODO Auto-generated constructor stub - } - /** - * @param eventID - * @param eventName - * @param eventType - * @param eventDate - * @param userId - * @param oldValue - * @param newValue - */ - public AuditLog(UUID eventID, String eventName, String eventType, Date eventDate, String userId, - Object oldValue, Object newValue) { - super(); - this.eventID = eventID; - this.eventName = eventName; - this.eventType = eventType; - this.eventDate = eventDate; - this.userId = userId; - this.oldValue = oldValue; - this.newValue = newValue; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AuditLog [eventID=" + eventID + ", eventName=" + eventName + ", eventType=" + eventType + ", eventDate=" - + eventDate + ", userId=" + userId + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; - } - - - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java deleted file mode 100644 index 6479eb26..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/document/BaseEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mongo.db.document; - -public class BaseEntity { - private String userId; - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @param userId the userId to set - */ - public void setUserId(String userId) { - this.userId = userId; - } - - public BaseEntity() { - // TODO Auto-generated constructor stub - } - - /** - * @param userId - */ - public BaseEntity(String userId) { - super(); - this.userId = userId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BaseEntity [userId=" + userId + "]"; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java deleted file mode 100644 index c61912ac..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/exception/AuditException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mongo.db.exception; - -public class AuditException extends Exception{ - String msg; - - /** - * @param msg - */ - public AuditException(String msg) { - super(); - this.msg = msg; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/rcvlistner/MsgListener.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/rcvlistner/MsgListener.java deleted file mode 100644 index 6b479c68..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/rcvlistner/MsgListener.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mongo.db.rcvlistner; - -import java.io.IOException; -import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.mongo.db.document.AuditLog; -import auditdemo.demoAudit.entity.AuditLogExternal; - -@Component -public class MsgListener { - - /* - * @Autowired AuditMongoRepository amd; - */ - public static Object fromJsonToJava(String json, Class type) - throws JsonParseException, JsonMappingException, IOException { - ObjectMapper jsonMapper = new ObjectMapper(); - return jsonMapper.readValue(json, type); - } - - public void receiveMessage(String message) { - AuditLogExternal value = null; - - try { - System.out.println("Message Number " + MsgListener.fromJsonToJava(message, AuditLog.class) + " received."); - } catch (JsonParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java deleted file mode 100644 index b7d4db13..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/repo/AuditMongoRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mongo.db.repo; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.data.mongodb.repository.MongoRepository; - -import com.mongo.db.document.AuditLog; - -/** - * @author trainee - * - */ -public interface AuditMongoRepository extends MongoRepository{ - - /** - * @param eventName - * @return - */ - List findByEventName(String eventName); - /** - * @param eventType - * @return - */ - AuditLog findByEventType(String eventType); - - - Optional findByeventID(UUID eventID); -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java deleted file mode 100644 index cd8286f6..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/service/AuditServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; - -@Service("auditService") -public class AuditServiceImpl implements IAuditService{ - - @Autowired - private AuditMongoRepository auditRepo; - @Override - public AuditLog createAudit(AuditLog audit)throws AuditException { - AuditLog audi= auditRepo.save(audit); - if(audi!=null) - { - return audi; - } - else - { - throw new AuditException("audit not added"); - } - } - - - - @Override - public String deleteAudit(UUID id) throws AuditException { - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - {AuditLog aud=audit.get(); - auditRepo.delete(aud);; - return "deleted"; - } - else - { - throw new AuditException("not deleted"); - } - } - - @Override - public AuditLog update(UUID id,String eventType) throws AuditException { - //changes made after downgrading application - Optional audit=auditRepo.findByeventID(id); - if(audit.isPresent()) - { - AuditLog auditLog=audit.get(); - auditLog.setEventType(eventType); - AuditLog auu=auditRepo.save(auditLog); - return auu; - } - else - { - throw new AuditException("id not found!!!!"); - } - } - - - - @Override - public List getDetails(String eventName) throws AuditException { - // TODO Auto-generated method stub - List list=auditRepo.findByEventName(eventName); - if(list.isEmpty()) - { - throw new AuditException("List is empty"); - } - else - { - return list; - } - - } - - - - @Override - public List findall() throws AuditException { - // TODO Auto-generated method stub - return auditRepo.findAll(); - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java deleted file mode 100644 index db121ae5..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/service/IAuditService.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mongo.db.service; - -import java.util.List; -import java.util.UUID; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.exception.AuditException; - -public interface IAuditService { - - /** - * @method createAudit - * @param audit - * @return AuditLog object - * @throws AuditException - */ - AuditLog createAudit(AuditLog audit) throws AuditException; - /** - * @method getDetails - * @param eventName - * @return List - * @throws AuditException - */ - List getDetails(String eventName) throws AuditException; - /** - * @method deleteaudit - * @param id - * @return String - * @throws AuditException - */ - String deleteAudit(UUID id) throws AuditException; - /** - * @method update - * @param id - * @param eventType - * @return AuditLog - * @throws AuditException - */ - AuditLog update(UUID id,String eventType) throws AuditException; - /** - * @method findall - * @return List - * @throws AuditException - */ - List findall() throws AuditException; - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java deleted file mode 100644 index ac2a51a1..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/java/com/mongo/db/vo/updateAuditRequest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mongo.db.vo; - -import java.util.UUID; - -public class updateAuditRequest { - - private UUID eventId; - private String eventType; - /** - * @return the eventId - */ - public UUID getEventId() { - return eventId; - } - /** - * @param eventId the eventId to set - */ - public void setEventId(UUID eventId) { - this.eventId = eventId; - } - /** - * @return the eventType - */ - public String getEventType() { - return eventType; - } - /** - * @param eventType the eventType to set - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - -} diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/resources/application.properties b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/resources/application.properties deleted file mode 100644 index 9d3e4e0d..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/main/resources/application.properties +++ /dev/null @@ -1,15 +0,0 @@ -#Mongo -spring.data.mongodb.host=localhost -spring.data.mongodb.port=27017 -spring.data.mongodb.database=mongodb -server.port=8022 - -#Register with eureka -#eureka.client.service-url.defaultZone=http://localhost:8762/eureka - - - -#eureka.client.service-url.defaultZone=https://github.com/ramdafale/bank-config-server -#spring.application.name=mongo-client - - diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java deleted file mode 100644 index 86f4145b..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongoTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -import com.mongo.db.document.AuditLog; -import com.mongo.db.document.BaseEntity; -import com.mongo.db.exception.AuditException; -import com.mongo.db.repo.AuditMongoRepository; -import com.mongo.db.service.AuditServiceImpl; -import com.mongo.db.service.IAuditService; - -@RunWith(MockitoJUnitRunner.class) -public class MongoTest { - - @Mock - private AuditMongoRepository auditRepo; - - - @InjectMocks IAuditService auditServcie=new AuditServiceImpl(); - Date date=new Date(); - UUID id; - Timestamp time; - BaseEntity base1; - BaseEntity bsae2; - AuditLog audit; - AuditLog audit1; - AuditLog audit2; - @Before - public void init() - { - date=new Date(); - id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - time=new Timestamp(date.getTime()); - base1=new BaseEntity("1"); - bsae2=new BaseEntity("2"); - audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - audit1 =new AuditLog(UUID.fromString("38400000-8cf0-11cd-b23e-10b96e4ef00d"),"createnew","creation",time,"3",base1,bsae2); - } - @Test - public void auditcreateTest()throws AuditException - { Date date=new Date(); - UUID id=UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); - Timestamp time=new Timestamp(date.getTime()); - BaseEntity base1=new BaseEntity("1"); - BaseEntity bsae2=new BaseEntity("2"); - AuditLog audit =new AuditLog(id,"create","creation",time,"3",base1,bsae2); - Mockito.when(auditRepo.save(audit)).thenReturn(audit); - AuditLog audi; - - audi = auditServcie.createAudit(audit); - assertEquals("created",audi,audit); - } - @Test(expected=AuditException.class) - public void falsecreateTest() throws AuditException - { - AuditLog audit1=null; - Mockito.when(auditRepo.save(audit1)).thenReturn(audit1); - AuditLog audi; - audi = auditServcie.createAudit(audit1); - } - -@Test -public void auditgetDetails()throws AuditException -{ - - - List list=new ArrayList(); - - list.add(audit); - list.add(audit1); - Mockito.when(auditRepo.findByEventName("create")).thenReturn(list); - List newList=auditServcie.getDetails("create"); - assertEquals(list, newList); - -} -@Test(expected=AuditException.class) -public void auditgetDetailsfalse()throws AuditException -{ - - - List list=new ArrayList<>(); - Mockito.when(auditRepo.findByEventName("mongo")).thenReturn(list); - List newList=auditServcie.getDetails("mongo"); - - -} - -@Test -public void auditupdatetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - assertEquals(auditt,newAudit); -} - -@Test(expected=AuditException.class) -public void auditupdatefalsecase() throws AuditException -{ - Optional opt=Optional.empty(); - when(auditRepo.findById(id)).thenReturn(opt); - //AuditLog auditt=opt.get(); - //when(auditRepo.save(auditt)).thenReturn(auditt); - AuditLog newAudit=auditServcie.update(id, "updation"); - - -} - -@Test -public void auditdeletetruecase() throws AuditException -{ - Optional opt=Optional.of(audit); - when(auditRepo.findById(id)).thenReturn(opt); - AuditLog auditt=opt.get(); - - String newAudit=auditServcie.deleteAudit(id); - - assertEquals("deleted",newAudit); -} - -} -*/ \ No newline at end of file diff --git a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java b/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java deleted file mode 100644 index 160469e0..00000000 --- a/Rabbit MQ demo with object/RabbitMqAuditObjectDemo/mongodbClient2/src/test/java/com/mongoDb/mongodbExample/MongodbExampleApplicationTests.java +++ /dev/null @@ -1,17 +0,0 @@ -/*package com.mongoDb.mongodbExample; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class MongodbExampleApplicationTests { - - @Test - public void contextLoads() { - } - -} -*/ \ No newline at end of file diff --git a/RabbitDemoSimple/demoCommon/.classpath b/RabbitDemoSimple/demoCommon/.classpath deleted file mode 100644 index 9ae7bca0..00000000 --- a/RabbitDemoSimple/demoCommon/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/RabbitDemoSimple/demoCommon/.project b/RabbitDemoSimple/demoCommon/.project deleted file mode 100644 index f3900a66..00000000 --- a/RabbitDemoSimple/demoCommon/.project +++ /dev/null @@ -1,37 +0,0 @@ - - - demoCommon - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/RabbitDemoSimple/demoCommon/.settings/.jsdtscope b/RabbitDemoSimple/demoCommon/.settings/.jsdtscope deleted file mode 100644 index 24181231..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.jdt.core.prefs b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 45a6e0e0..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.m2e.core.prefs b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.common.component b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6ce3563c..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.common.project.facet.core.xml b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d74c55e0..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.container b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a4..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.name b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b6..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.validation.prefs b/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 04cad8cb..00000000 --- a/RabbitDemoSimple/demoCommon/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/RabbitDemoSimple/demoCommon/pom.xml b/RabbitDemoSimple/demoCommon/pom.xml deleted file mode 100644 index e7ea0b5f..00000000 --- a/RabbitDemoSimple/demoCommon/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - com.example.common - demoCommon - jar - 0.0.1-SNAPSHOT - demoCommon Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - demoCommon - - diff --git a/RabbitDemoSimple/demoCommon/src/main/java/com/example/commonDemo/TransactionNew.java b/RabbitDemoSimple/demoCommon/src/main/java/com/example/commonDemo/TransactionNew.java deleted file mode 100644 index ccc60efd..00000000 --- a/RabbitDemoSimple/demoCommon/src/main/java/com/example/commonDemo/TransactionNew.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * - */ -package com.example.commonDemo; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.logging.Level; -import java.util.logging.Logger; - - - - -/** - * @author trainee - * - */ - -public class TransactionNew implements Serializable{ - - /** - * - */ - private static final long serialVersionUID = -7197575110101065396L; - int transactionId; - int customerId; - int accountId; - int amount; - String transactionType; - - public TransactionNew() { - // TODO Auto-generated constructor stub - } - - public TransactionNew(int transactionId, int customerId, int accountId, int amount, String transactionType) { - super(); - this.transactionId = transactionId; - this.customerId = customerId; - this.accountId = accountId; - this.amount = amount; - this.transactionType = transactionType; - } - - - @Override - public String toString() { - return "TransactionNew [transactionId=" + transactionId + ", customerId=" + customerId + ", accountId=" - + accountId + ", amount=" + amount + ", transactionType=" + transactionType + "]"; - } - - public int getTransactionId() { - return transactionId; - } - - public void setTransactionId(int transactionId) { - this.transactionId = transactionId; - } - - public int getCustomerId() { - return customerId; - } - - public void setCustomerId(int customerId) { - this.customerId = customerId; - } - - public int getAccountId() { - return accountId; - } - - public void setAccountId(int accountId) { - this.accountId = accountId; - } - - public int getAmount() { - return amount; - } - - public void setAmount(int amount) { - this.amount = amount; - } - - public String getTransactionType() { - return transactionType; - } - - public void setTransactionType(String transactionType) { - this.transactionType = transactionType; - } - - public byte[] getBytes() { - byte[]bytes; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try{ - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(this); - oos.flush(); - oos.reset(); - bytes = baos.toByteArray(); - oos.close(); - baos.close(); - } catch(IOException e){ - bytes = new byte[] {}; - Logger.getLogger("bsdlog").log(Level.ALL, "unable to write to output stream" + e); - } - return bytes; - } - - public static TransactionNew fromBytes(byte[] body) { - TransactionNew obj = null; - try { - ByteArrayInputStream bis = new ByteArrayInputStream(body); - ObjectInputStream ois = new ObjectInputStream(bis); - obj = (TransactionNew) ois.readObject(); - ois.close(); - bis.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - catch (ClassNotFoundException ex) { - ex.printStackTrace(); - } - return obj; - } - - -} - - diff --git a/RabbitDemoSimple/demoCommon/src/main/webapp/WEB-INF/web.xml b/RabbitDemoSimple/demoCommon/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 9f88c1f9..00000000 --- a/RabbitDemoSimple/demoCommon/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Archetype Created Web Application - diff --git a/RabbitDemoSimple/demoCommon/target/classes/META-INF/MANIFEST.MF b/RabbitDemoSimple/demoCommon/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/RabbitDemoSimple/demoCommon/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/RabbitDemoSimple/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.properties b/RabbitDemoSimple/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.properties deleted file mode 100644 index 1135b68d..00000000 --- a/RabbitDemoSimple/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu Jun 07 12:58:15 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.example.common -m2e.projectName=demoCommon -m2e.projectLocation=C\:\\Users\\trainee\\Documents\\workspace-sts-3.9.4.RELEASE\\demoCommon -artifactId=demoCommon diff --git a/RabbitDemoSimple/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.xml b/RabbitDemoSimple/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.xml deleted file mode 100644 index e7ea0b5f..00000000 --- a/RabbitDemoSimple/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - com.example.common - demoCommon - jar - 0.0.1-SNAPSHOT - demoCommon Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - demoCommon - - diff --git a/RabbitDemoSimple/demoCommon/target/classes/com/example/commonDemo/TransactionNew.class b/RabbitDemoSimple/demoCommon/target/classes/com/example/commonDemo/TransactionNew.class deleted file mode 100644 index 45b67f73..00000000 Binary files a/RabbitDemoSimple/demoCommon/target/classes/com/example/commonDemo/TransactionNew.class and /dev/null differ diff --git a/RabbitDemoSimple/demoCommon/target/demoCommon.jar b/RabbitDemoSimple/demoCommon/target/demoCommon.jar deleted file mode 100644 index 34c4b370..00000000 Binary files a/RabbitDemoSimple/demoCommon/target/demoCommon.jar and /dev/null differ diff --git a/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.properties b/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.properties deleted file mode 100644 index 543c4f4c..00000000 --- a/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Fri May 18 14:55:13 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.example.common -m2e.projectName=demoCommon -m2e.projectLocation=C\:\\Users\\trainee\\Documents\\workspace-sts-3.9.4.RELEASE\\demoCommon -artifactId=demoCommon diff --git a/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.xml b/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.xml deleted file mode 100644 index 02a624c5..00000000 --- a/RabbitDemoSimple/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - com.example.common - demoCommon - war - 0.0.1-SNAPSHOT - demoCommon Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - demoCommon - - diff --git a/RabbitDemoSimple/demoCommon/target/maven-archiver/pom.properties b/RabbitDemoSimple/demoCommon/target/maven-archiver/pom.properties deleted file mode 100644 index d1d33964..00000000 --- a/RabbitDemoSimple/demoCommon/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Fri May 18 14:57:09 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.example.common -artifactId=demoCommon diff --git a/RabbitDemoSimple/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/RabbitDemoSimple/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index e69de29b..00000000 diff --git a/RabbitDemoSimple/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/RabbitDemoSimple/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index 58e7730d..00000000 --- a/RabbitDemoSimple/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1 +0,0 @@ -C:\Users\trainee\Documents\workspace-sts-3.9.4.RELEASE\demoCommon\src\main\java\com\example\commonDemo\TransactionNew.java diff --git a/RabbitDemoSimple/sampleRcv/.gitignore b/RabbitDemoSimple/sampleRcv/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/RabbitDemoSimple/sampleRcv/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/RabbitDemoSimple/sampleRcv/.mvn/wrapper/maven-wrapper.jar b/RabbitDemoSimple/sampleRcv/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/RabbitDemoSimple/sampleRcv/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/RabbitDemoSimple/sampleRcv/.mvn/wrapper/maven-wrapper.properties b/RabbitDemoSimple/sampleRcv/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/RabbitDemoSimple/sampleRcv/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/RabbitDemoSimple/sampleRcv/mvnw b/RabbitDemoSimple/sampleRcv/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/RabbitDemoSimple/sampleRcv/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/RabbitDemoSimple/sampleRcv/mvnw.cmd b/RabbitDemoSimple/sampleRcv/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/RabbitDemoSimple/sampleRcv/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/RabbitDemoSimple/sampleRcv/pom.xml b/RabbitDemoSimple/sampleRcv/pom.xml deleted file mode 100644 index da1cab78..00000000 --- a/RabbitDemoSimple/sampleRcv/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - com.example - sampleRcv - 0.0.1-SNAPSHOT - jar - - sampleRcv - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-amqp - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/SampleRcvApplication.java b/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/SampleRcvApplication.java deleted file mode 100644 index 5b3d5379..00000000 --- a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/SampleRcvApplication.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.example.sampleRcv; - -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.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; -import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; - -import com.example.sampleRcv.listener.MsgListener; - - -@SpringBootApplication -public class SampleRcvApplication { - - public final static String MESSAGE_QUEUE = "sfg-message-queue"; - - @Bean - Queue queue() { - return new Queue(MESSAGE_QUEUE, false); - } - - @Bean - TopicExchange exchange() { - return new TopicExchange("spring-boot-exchange"); - } - - @Bean - Binding binding(Queue queue, TopicExchange exchange) { - return BindingBuilder.bind(queue).to(exchange).with(MESSAGE_QUEUE); - } - - @Bean - SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, - MessageListenerAdapter listenerAdapter) { - SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); - container.setConnectionFactory(connectionFactory); - container.setQueueNames(MESSAGE_QUEUE); - container.setMessageListener(listenerAdapter); - return container; - } - - @Bean - MessageListenerAdapter listenerAdapter(MsgListener receiver) { - return new MessageListenerAdapter(receiver, "receiveMessage"); - } - - public static void main(String[] args) { - SpringApplication.run(SampleRcvApplication.class, args); - } -} diff --git a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/dto/Transaction.java b/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/dto/Transaction.java deleted file mode 100644 index 342f3437..00000000 --- a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/dto/Transaction.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - */ -package com.example.sampleRcv.dto; - -import java.io.Serializable; - -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -/** - * @author trainee - * - */ -@Document(collection="transactionCollection") -public class Transaction implements Serializable{ - - /** - * - */ - private static final long serialVersionUID = 1L; - @Id - int transactionId; - int customerId; - int accountId; - int amount; - String transactionType; - - public Transaction() { - // TODO Auto-generated constructor stub - } - - public Transaction(int transactionId, int customerId, int accountId, int amount, String transactionType) { - super(); - this.transactionId = transactionId; - this.customerId = customerId; - this.accountId = accountId; - this.amount = amount; - this.transactionType = transactionType; - } - - - @Override - public String toString() { - return "Transaction [transactionId=" + transactionId + ", customerId=" + customerId + ", accountId=" + accountId - + ", amount=" + amount + ", transactionType=" + transactionType + "]"; - } - - public int getTransactionId() { - return transactionId; - } - - public void setTransactionId(int transactionId) { - this.transactionId = transactionId; - } - - public int getCustomerId() { - return customerId; - } - - public void setCustomerId(int customerId) { - this.customerId = customerId; - } - - public int getAccountId() { - return accountId; - } - - public void setAccountId(int accountId) { - this.accountId = accountId; - } - - public int getAmount() { - return amount; - } - - public void setAmount(int amount) { - this.amount = amount; - } - - public String getTransactionType() { - return transactionType; - } - - public void setTransactionType(String transactionType) { - this.transactionType = transactionType; - } -} diff --git a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/listener/MsgListener.java b/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/listener/MsgListener.java deleted file mode 100644 index 57f9aa8e..00000000 --- a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/listener/MsgListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.example.sampleRcv.listener; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.example.commonDemo.TransactionNew; -import com.example.sampleRcv.dto.Transaction; -import com.example.sampleRcv.repository.DemoRepository; - - -@Component -public class MsgListener { - - @Autowired - DemoRepository demoRepository; - - public void receiveMessage(TransactionNew message) { - System.out.println("Received <" + message + ">"); - Transaction transaction = new Transaction(message.getTransactionId(), message.getCustomerId(), message.getAccountId(), message.getAmount(), message.getTransactionType()); - demoRepository.save(transaction); - } -} diff --git a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/repository/DemoRepository.java b/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/repository/DemoRepository.java deleted file mode 100644 index 4363a841..00000000 --- a/RabbitDemoSimple/sampleRcv/src/main/java/com/example/sampleRcv/repository/DemoRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * - */ -package com.example.sampleRcv.repository; - -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; - -import com.example.sampleRcv.dto.Transaction; - -@Repository -public interface DemoRepository extends MongoRepository{ - -} diff --git a/RabbitDemoSimple/sampleRcv/src/main/resources/application.properties b/RabbitDemoSimple/sampleRcv/src/main/resources/application.properties deleted file mode 100644 index d2f91279..00000000 --- a/RabbitDemoSimple/sampleRcv/src/main/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -server.port= 8061 - -#RabbitMQ -spring.rabbitmq.host = 127.0.0.1 -spring.rabbitmq.port = 5672 - -#MongoDB -spring.data.mongodb.host=127.0.0.1 -spring.data.mongodb.port=27017 -spring.data.mongodb.database=myapp \ No newline at end of file diff --git a/RabbitDemoSimple/sampleRcv/src/test/java/com/example/sampleRcv/SampleRcvApplicationTests.java b/RabbitDemoSimple/sampleRcv/src/test/java/com/example/sampleRcv/SampleRcvApplicationTests.java deleted file mode 100644 index 3b63b5d2..00000000 --- a/RabbitDemoSimple/sampleRcv/src/test/java/com/example/sampleRcv/SampleRcvApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.sampleRcv; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SampleRcvApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/RabbitDemoSimple/sampleSend/.gitignore b/RabbitDemoSimple/sampleSend/.gitignore deleted file mode 100644 index 82eca336..00000000 --- a/RabbitDemoSimple/sampleSend/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/RabbitDemoSimple/sampleSend/.mvn/wrapper/maven-wrapper.jar b/RabbitDemoSimple/sampleSend/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9..00000000 Binary files a/RabbitDemoSimple/sampleSend/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/RabbitDemoSimple/sampleSend/.mvn/wrapper/maven-wrapper.properties b/RabbitDemoSimple/sampleSend/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50..00000000 --- a/RabbitDemoSimple/sampleSend/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/RabbitDemoSimple/sampleSend/mvnw b/RabbitDemoSimple/sampleSend/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/RabbitDemoSimple/sampleSend/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/RabbitDemoSimple/sampleSend/mvnw.cmd b/RabbitDemoSimple/sampleSend/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/RabbitDemoSimple/sampleSend/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/RabbitDemoSimple/sampleSend/pom.xml b/RabbitDemoSimple/sampleSend/pom.xml deleted file mode 100644 index 6f897176..00000000 --- a/RabbitDemoSimple/sampleSend/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - com.example - sampleSend - 0.0.1-SNAPSHOT - jar - - sampleSend - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-amqp - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/RabbitDemoSimple/sampleSend/src/main/java/com/example/sampleSend/SampleSendApplication.java b/RabbitDemoSimple/sampleSend/src/main/java/com/example/sampleSend/SampleSendApplication.java deleted file mode 100644 index ef0f4478..00000000 --- a/RabbitDemoSimple/sampleSend/src/main/java/com/example/sampleSend/SampleSendApplication.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.example.sampleSend; - -import org.springframework.amqp.core.TopicExchange; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; - -@SpringBootApplication -public class SampleSendApplication { - - public final static String MESSAGE_QUEUE = "sfg-message-queue"; - - @Bean - TopicExchange exchange() { - return new TopicExchange("spring-boot-exchange"); - } - - public static void main(String[] args) { - SpringApplication.run(SampleSendApplication.class, args); - } -} diff --git a/RabbitDemoSimple/sampleSend/src/main/java/com/example/sampleSend/controller/AppController.java b/RabbitDemoSimple/sampleSend/src/main/java/com/example/sampleSend/controller/AppController.java deleted file mode 100644 index 0dd0e093..00000000 --- a/RabbitDemoSimple/sampleSend/src/main/java/com/example/sampleSend/controller/AppController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.example.sampleSend.controller; - -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.example.commonDemo.TransactionNew; -import com.example.sampleSend.SampleSendApplication; - -@RestController -public class AppController { - - private RabbitTemplate rabbitTemplate; - - /** - * @param rabbitTemplate - */ - public AppController(RabbitTemplate rabbitTemplate) { - this.rabbitTemplate = rabbitTemplate; - } - - @RequestMapping("/") - public String sendMsg(@RequestBody TransactionNew transaction) { - rabbitTemplate.convertAndSend(SampleSendApplication.MESSAGE_QUEUE, transaction); - return "send"; - } -} diff --git a/RabbitDemoSimple/sampleSend/src/main/resources/application.properties b/RabbitDemoSimple/sampleSend/src/main/resources/application.properties deleted file mode 100644 index ab0692b8..00000000 --- a/RabbitDemoSimple/sampleSend/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -server.port= 8060 -spring.rabbitmq.host = 127.0.0.1 -spring.rabbitmq.port = 5672 \ No newline at end of file diff --git a/RabbitDemoSimple/sampleSend/src/test/java/com/example/sampleSend/SampleSendApplicationTests.java b/RabbitDemoSimple/sampleSend/src/test/java/com/example/sampleSend/SampleSendApplicationTests.java deleted file mode 100644 index 31ce03e5..00000000 --- a/RabbitDemoSimple/sampleSend/src/test/java/com/example/sampleSend/SampleSendApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.sampleSend; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class SampleSendApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/SpringJDBCTemplateExampleForLearning/.DS_Store b/SpringJDBCTemplateExampleForLearning/.DS_Store deleted file mode 100644 index 5172429f..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/.classpath b/SpringJDBCTemplateExampleForLearning/.classpath deleted file mode 100644 index 4a77ee8e..00000000 --- a/SpringJDBCTemplateExampleForLearning/.classpath +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpringJDBCTemplateExampleForLearning/.project b/SpringJDBCTemplateExampleForLearning/.project deleted file mode 100644 index dfac2134..00000000 --- a/SpringJDBCTemplateExampleForLearning/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - SpringJDBCTemplateExample - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/SpringJDBCTemplateExampleForLearning/.settings/org.eclipse.jdt.core.prefs b/SpringJDBCTemplateExampleForLearning/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 63864f1a..00000000 --- a/SpringJDBCTemplateExampleForLearning/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=9 -org.eclipse.jdt.core.compiler.compliance=9 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=9 diff --git a/SpringJDBCTemplateExampleForLearning/.settings/org.eclipse.m2e.core.prefs b/SpringJDBCTemplateExampleForLearning/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/SpringJDBCTemplateExampleForLearning/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/SpringJDBCTemplateExampleForLearning/pom.xml b/SpringJDBCTemplateExampleForLearning/pom.xml deleted file mode 100644 index cbe105ba..00000000 --- a/SpringJDBCTemplateExampleForLearning/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - com.journaldev.spring - JdbcTemplate - 1.0-SNAPSHOT - - 4.3.0.RELEASE - 42.1.4 - - - - org.postgresql - postgresql - ${postgres.version} - - - org.springframework - spring-core - ${spring.framework} - - - org.springframework - spring-context - ${spring.framework} - - - org.springframework - spring-jdbc - ${spring.framework} - - - - \ No newline at end of file diff --git a/SpringJDBCTemplateExampleForLearning/sample_data_postgresql.sql b/SpringJDBCTemplateExampleForLearning/sample_data_postgresql.sql deleted file mode 100644 index 165a2106..00000000 --- a/SpringJDBCTemplateExampleForLearning/sample_data_postgresql.sql +++ /dev/null @@ -1,13 +0,0 @@ -create table people ( -id serial not null primary key, -first_name varchar(20) not null, -last_name varchar(20) not null, -age integer not null -); - -insert into people (id, first_name, last_name, age) values -(1, 'Vlad', 'Boyarskiy', 21), -(2,'Oksi', ' Bahatskaya', 30), -(3,'Vadim', ' Vadimich', 32); - -commit; \ No newline at end of file diff --git a/SpringJDBCTemplateExampleForLearning/src/.DS_Store b/SpringJDBCTemplateExampleForLearning/src/.DS_Store deleted file mode 100644 index 7b5c75f2..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/src/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/src/main/.DS_Store b/SpringJDBCTemplateExampleForLearning/src/main/.DS_Store deleted file mode 100644 index 0ea0534f..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/src/main/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/.DS_Store b/SpringJDBCTemplateExampleForLearning/src/main/java/.DS_Store deleted file mode 100644 index 0a8bc21e..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/src/main/java/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/.DS_Store b/SpringJDBCTemplateExampleForLearning/src/main/java/com/.DS_Store deleted file mode 100644 index f2dc9bb1..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/src/main/java/com/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/.DS_Store b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/.DS_Store deleted file mode 100644 index 487f56a5..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/Main.java b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/Main.java deleted file mode 100644 index be30ea7a..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/Main.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.journaldev; - -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import com.journaldev.model.Person; -import com.journaldev.spring.config.AppConfig; -import com.journaldev.spring.dao.PersonDAO; - -public class Main { - public static void main(String[] args) { - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); - - PersonDAO personDAO = context.getBean(PersonDAO.class); - - System.out.println("List of person is:"); - - for (Person p : personDAO.getAllPersons()) { - System.out.println(p); - } - - System.out.println("\nGet person with ID 2"); - - Person personById = personDAO.getPersonById(2L); - System.out.println(personById); - - System.out.println("\nCreating person: "); - Person person = new Person(4L, 36, "Sergey", "Emets"); - System.out.println(person); - personDAO.createPerson(person); - System.out.println("\nList of person is:"); - - for (Person p : personDAO.getAllPersons()) { - System.out.println(p); - } - - System.out.println("\nDeleting person with ID 2"); - personDAO.deletePerson(personById); - - System.out.println("\nUpdate person with ID 4"); - - Person pperson = personDAO.getPersonById(4L); - pperson.setLastName("CHANGED"); - personDAO.updatePerson(pperson); - - System.out.println("\nList of person is:"); - for (Person p : personDAO.getAllPersons()) { - System.out.println(p); - } - - context.close(); - } -} diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/model/Person.java b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/model/Person.java deleted file mode 100644 index 7f2452cb..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/model/Person.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.journaldev.model; - -public class Person { - private Long id; - private Integer age; - private String firstName; - private String lastName; - - public Person() { - } - - public Person(Long id, Integer age, String firstName, String lastName) { - this.id = id; - this.age = age; - this.firstName = firstName; - this.lastName = lastName; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Integer getAge() { - return age; - } - - public void setAge(Integer age) { - this.age = age; - } - - 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; - } - - @Override - public String toString() { - return "Person{" + "id=" + id + ", age=" + age + ", firstName='" + firstName + '\'' + ", lastName='" + lastName - + '\'' + '}'; - } -} diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/model/PersonMapper.java b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/model/PersonMapper.java deleted file mode 100644 index 04630828..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/model/PersonMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.journaldev.model; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.springframework.jdbc.core.RowMapper; - -public class PersonMapper implements RowMapper { - - public Person mapRow(ResultSet resultSet, int i) throws SQLException { - - Person person = new Person(); - person.setId(resultSet.getLong("id")); - person.setFirstName(resultSet.getString("first_name")); - person.setLastName(resultSet.getString("last_name")); - person.setAge(resultSet.getInt("age")); - return person; - } -} diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/.DS_Store b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/.DS_Store deleted file mode 100644 index 12db7cf6..00000000 Binary files a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/.DS_Store and /dev/null differ diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/config/AppConfig.java b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/config/AppConfig.java deleted file mode 100644 index e5254c62..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/config/AppConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.journaldev.spring.config; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -@Configuration -@ComponentScan("com.journaldev.spring") -@PropertySource("classpath:database.properties") -public class AppConfig { - - @Autowired - Environment environment; - - private final String URL = "url"; - private final String USER = "dbuser"; - private final String DRIVER = "driver"; - private final String PASSWORD = "dbpassword"; - - @Bean - DataSource dataSource() { - DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource(); - driverManagerDataSource.setUrl(environment.getProperty(URL)); - driverManagerDataSource.setUsername(environment.getProperty(USER)); - driverManagerDataSource.setPassword(environment.getProperty(PASSWORD)); - driverManagerDataSource.setDriverClassName(environment.getProperty(DRIVER)); - return driverManagerDataSource; - } -} diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/dao/PersonDAO.java b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/dao/PersonDAO.java deleted file mode 100644 index 7a4b9819..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/dao/PersonDAO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.journaldev.spring.dao; - -import java.util.List; - -import com.journaldev.model.Person; - -public interface PersonDAO { - Person getPersonById(Long id); - - List getAllPersons(); - - boolean deletePerson(Person person); - - boolean updatePerson(Person person); - - boolean createPerson(Person person); -} diff --git a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/dao/PersonDAOImpl.java b/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/dao/PersonDAOImpl.java deleted file mode 100644 index d7585393..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/java/com/journaldev/spring/dao/PersonDAOImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.journaldev.spring.dao; - -import java.util.List; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Component; - -import com.journaldev.model.Person; -import com.journaldev.model.PersonMapper; - -@Component -public class PersonDAOImpl implements PersonDAO { - - JdbcTemplate jdbcTemplate; - - private final String SQL_FIND_PERSON = "select * from people where id = ?"; - private final String SQL_DELETE_PERSON = "delete from people where id = ?"; - private final String SQL_UPDATE_PERSON = "update people set first_name = ?, last_name = ?, age = ? where id = ?"; - private final String SQL_GET_ALL = "select * from people"; - private final String SQL_INSERT_PERSON = "insert into people(id, first_name, last_name, age) values(?,?,?,?)"; - - @Autowired - public PersonDAOImpl(DataSource dataSource) { - jdbcTemplate = new JdbcTemplate(dataSource); - } - - public Person getPersonById(Long id) { - return jdbcTemplate.queryForObject(SQL_FIND_PERSON, new Object[] { id }, new PersonMapper()); - } - - public List getAllPersons() { - return jdbcTemplate.query(SQL_GET_ALL, new PersonMapper()); - } - - public boolean deletePerson(Person person) { - return jdbcTemplate.update(SQL_DELETE_PERSON, person.getId()) > 0; - } - - public boolean updatePerson(Person person) { - return jdbcTemplate.update(SQL_UPDATE_PERSON, person.getFirstName(), person.getLastName(), person.getAge(), - person.getId()) > 0; - } - - public boolean createPerson(Person person) { - return jdbcTemplate.update(SQL_INSERT_PERSON, person.getId(), person.getFirstName(), person.getLastName(), - person.getAge()) > 0; - } -} diff --git a/SpringJDBCTemplateExampleForLearning/src/main/resources/database.properties b/SpringJDBCTemplateExampleForLearning/src/main/resources/database.properties deleted file mode 100644 index 3c016a79..00000000 --- a/SpringJDBCTemplateExampleForLearning/src/main/resources/database.properties +++ /dev/null @@ -1,4 +0,0 @@ -driver=org.postgresql.Driver -url=jdbc:postgresql://127.0.0.1:5432/school -dbuser=postgres -dbpassword=postgres diff --git a/bank/.classpath b/bank/.classpath deleted file mode 100644 index 6d7587a8..00000000 --- a/bank/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bank/.eclipse-pmd b/bank/.eclipse-pmd deleted file mode 100644 index 410e8c55..00000000 --- a/bank/.eclipse-pmd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/bank/.project b/bank/.project deleted file mode 100644 index d022394d..00000000 --- a/bank/.project +++ /dev/null @@ -1,40 +0,0 @@ - - - bank - - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - - diff --git a/bank/.settings/org.eclipse.core.resources.prefs b/bank/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/bank/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/bank/.settings/org.eclipse.jdt.core.prefs b/bank/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351ae..00000000 --- a/bank/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bank/.settings/org.eclipse.wst.common.project.facet.core.xml b/bank/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d8582952..00000000 --- a/bank/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/bank/.settings/org.springframework.ide.eclipse.prefs b/bank/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index a12794d6..00000000 --- a/bank/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 diff --git a/bank/bin/.settings/org.eclipse.core.resources.prefs b/bank/bin/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 839d647e..00000000 --- a/bank/bin/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/bank/bin/.settings/org.eclipse.jdt.core.prefs b/bank/bin/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 714351ae..00000000 --- a/bank/bin/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bank/bin/.settings/org.eclipse.wst.common.project.facet.core.xml b/bank/bin/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d8582952..00000000 --- a/bank/bin/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/bank/bin/.settings/org.springframework.ide.eclipse.prefs b/bank/bin/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index a12794d6..00000000 --- a/bank/bin/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 diff --git a/bank/bin/mvnw b/bank/bin/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/bank/bin/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/bank/bin/mvnw.cmd b/bank/bin/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/bank/bin/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/bank/bin/pom.xml b/bank/bin/pom.xml deleted file mode 100644 index 77e0a5df..00000000 --- a/bank/bin/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - bank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/bank/bin/src/main/java/com/springboot/bank/BankApplication.class b/bank/bin/src/main/java/com/springboot/bank/BankApplication.class deleted file mode 100644 index 83bc78b5..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/BankApplication.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/controller/BankController.class b/bank/bin/src/main/java/com/springboot/bank/controller/BankController.class deleted file mode 100644 index 11b28f13..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/controller/BankController.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/model/ATM.class b/bank/bin/src/main/java/com/springboot/bank/model/ATM.class deleted file mode 100644 index 1142c83b..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/model/ATM.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/model/Bank.class b/bank/bin/src/main/java/com/springboot/bank/model/Bank.class deleted file mode 100644 index 77d3900f..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/model/Bank.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/model/Customer.class b/bank/bin/src/main/java/com/springboot/bank/model/Customer.class deleted file mode 100644 index acf0309f..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/model/Customer.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/repository/BankDAO.class b/bank/bin/src/main/java/com/springboot/bank/repository/BankDAO.class deleted file mode 100644 index f296085c..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/repository/BankDAO.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/repository/CustomerDAO.class b/bank/bin/src/main/java/com/springboot/bank/repository/CustomerDAO.class deleted file mode 100644 index 85a53f04..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/repository/CustomerDAO.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/service/BankService.class b/bank/bin/src/main/java/com/springboot/bank/service/BankService.class deleted file mode 100644 index 128ab942..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/service/BankService.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/service/BankServiceImpl.class b/bank/bin/src/main/java/com/springboot/bank/service/BankServiceImpl.class deleted file mode 100644 index 9eafc70d..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/service/BankServiceImpl.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/service/CustomerService.class b/bank/bin/src/main/java/com/springboot/bank/service/CustomerService.class deleted file mode 100644 index 8ac7b74c..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/service/CustomerService.class and /dev/null differ diff --git a/bank/bin/src/main/java/com/springboot/bank/service/CustomerServiceImpl.class b/bank/bin/src/main/java/com/springboot/bank/service/CustomerServiceImpl.class deleted file mode 100644 index c5be0e25..00000000 Binary files a/bank/bin/src/main/java/com/springboot/bank/service/CustomerServiceImpl.class and /dev/null differ diff --git a/bank/bin/src/main/resources/application.properties b/bank/bin/src/main/resources/application.properties deleted file mode 100644 index 359e7982..00000000 --- a/bank/bin/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -<<<<<<< HEAD -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -======= -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/bank/bin/src/test/java/com/springboot/bank/BankApplicationTests.class b/bank/bin/src/test/java/com/springboot/bank/BankApplicationTests.class deleted file mode 100644 index 9bf1c99f..00000000 Binary files a/bank/bin/src/test/java/com/springboot/bank/BankApplicationTests.class and /dev/null differ diff --git a/bank/bin/target/classes/META-INF/MANIFEST.MF b/bank/bin/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index 7af7641a..00000000 --- a/bank/bin/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,23 +0,0 @@ -<<<<<<< HEAD -Manifest-Version: 1.0 -Implementation-Title: bank -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: Lohit -Implementation-Vendor-Id: com.springboot -Build-Jdk: 1.8.0_121 -Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo - ot-starter-parent/bank -Created-By: Maven Integration for Eclipse - -======= -Manifest-Version: 1.0 -Implementation-Title: bank -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: Lohit -Implementation-Vendor-Id: com.springboot -Build-Jdk: 1.8.0_121 -Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo - ot-starter-parent/bank -Created-By: Maven Integration for Eclipse - ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/bank/bin/target/classes/META-INF/maven/com.springboot/bank/pom.properties b/bank/bin/target/classes/META-INF/maven/com.springboot/bank/pom.properties deleted file mode 100644 index ac4821f3..00000000 --- a/bank/bin/target/classes/META-INF/maven/com.springboot/bank/pom.properties +++ /dev/null @@ -1,17 +0,0 @@ -<<<<<<< HEAD -#Generated by Maven Integration for Eclipse -#Thu May 17 10:00:13 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.springboot -m2e.projectName=bank -m2e.projectLocation=C\:\\Users\\Lohit\\Desktop\\bank -artifactId=bank -======= -#Generated by Maven Integration for Eclipse -#Wed May 16 18:21:54 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.springboot -m2e.projectName=bank -m2e.projectLocation=C\:\\Users\\Lohit\\Desktop\\bank -artifactId=bank ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/bank/bin/target/classes/META-INF/maven/com.springboot/bank/pom.xml b/bank/bin/target/classes/META-INF/maven/com.springboot/bank/pom.xml deleted file mode 100644 index 77e0a5df..00000000 --- a/bank/bin/target/classes/META-INF/maven/com.springboot/bank/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - bank - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/bank/bin/target/classes/application.properties b/bank/bin/target/classes/application.properties deleted file mode 100644 index 359e7982..00000000 --- a/bank/bin/target/classes/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -<<<<<<< HEAD -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -======= -spring.datasource.url= jdbc:mysql://localhost:3306/sys -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update ->>>>>>> a53b592d6e45294abf4d2c1a52bb4a8929e5f30e diff --git a/bank/mvnw b/bank/mvnw deleted file mode 100644 index 5bf251c0..00000000 --- a/bank/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/bank/mvnw.cmd b/bank/mvnw.cmd deleted file mode 100644 index 019bd74d..00000000 --- a/bank/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@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 http://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 enable echoing my 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 - -%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% diff --git a/bank/pom.xml b/bank/pom.xml deleted file mode 100644 index d09d388b..00000000 --- a/bank/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - MyBankDemo - project for Bank Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - log4j - log4j - 1.2.17 - - - - org.mockito - mockito-all - 1.9.5 - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/bank/src/main/java/com/springboot/bank/BankApplication.java b/bank/src/main/java/com/springboot/bank/BankApplication.java deleted file mode 100644 index 1387b62c..00000000 --- a/bank/src/main/java/com/springboot/bank/BankApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.springboot.bank; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class BankApplication { - - public static void main(String[] args) { - SpringApplication.run(BankApplication.class, args); - } -} diff --git a/bank/src/main/java/com/springboot/bank/controller/ATMController.java b/bank/src/main/java/com/springboot/bank/controller/ATMController.java deleted file mode 100644 index 15ee78f7..00000000 --- a/bank/src/main/java/com/springboot/bank/controller/ATMController.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import java.math.BigDecimal; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.springboot.bank.dto.ATMDetails; -import com.springboot.bank.dto.WrapperBankATM; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.ATM; -import com.springboot.bank.service.ATMService; - -/** - * @author Sumit - * - */ - -@RestController -public class ATMController { - - final Logger LOGGER = Logger.getLogger(ATMController.class); - - @Autowired - ATMService atmService; - - @PostMapping(value = "/createATM") - public ResponseEntity createATM(@RequestBody WrapperBankATM wrapperBankATM) throws BankException { - ATM atmData = null; - try { - atmData = atmService.createATM(wrapperBankATM); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (atmData == null) - throw new BankException("atm details not added"); - else - return new ResponseEntity(atmData, HttpStatus.OK); - } - - @PostMapping(value = "/addMoney/{atmId}/{bankId}/{moneyToBeAddedToATM}") - public ResponseEntity addMoneyFromBank(@PathVariable Long atmId, @PathVariable Long bankId, - @PathVariable BigDecimal moneyToBeAddedToATM) throws BankException { - ATM atmData = null; - try { - atmData = atmService.addMoneyFromBank(atmId, bankId, moneyToBeAddedToATM); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (atmData == null) - throw new BankException("atm details not added"); - else - return new ResponseEntity(atmData, HttpStatus.OK); - } - - @PostMapping(value = "/withdrawMoneyFromATM") - public ResponseEntity withdrawMoney(@RequestBody ATMDetails atmDetails) throws BankException { - ATM atmData = null; - try { - atmData = atmService.withdrawMoney(atmDetails); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (atmData == null) - throw new BankException("atm details not added"); - else - return new ResponseEntity(atmData, HttpStatus.OK); - } - -} diff --git a/bank/src/main/java/com/springboot/bank/controller/AccountController.java b/bank/src/main/java/com/springboot/bank/controller/AccountController.java deleted file mode 100644 index 3f9c0d8f..00000000 --- a/bank/src/main/java/com/springboot/bank/controller/AccountController.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.springboot.bank.dto.AccountDetails; -import com.springboot.bank.dto.WrapperBankCustomerAccount; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.service.AccountService; - -/** - * @author Sumit - * - */ - -@RestController -public class AccountController { - - @Autowired - AccountService accountService; - - final Logger LOGGER = Logger.getLogger(AccountController.class); - - @PostMapping(value = "/createAccount") - public ResponseEntity createAccount(@RequestBody WrapperBankCustomerAccount wrapperBankCustomerAccount) - throws BankException { - Account accountData = null; - try { - accountData = accountService.createAccount(wrapperBankCustomerAccount); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not added"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } - - @PostMapping(value = "/depositMoney") - public ResponseEntity depositMoney(@RequestBody AccountDetails accountDetails) throws BankException { - Account accountData = null; - try { - accountData = accountService.depositMoney(accountDetails); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not found"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } - - @PostMapping(value = "/withdrawMoneyFromAccount") - public ResponseEntity withdrawMoney(@RequestBody AccountDetails accountDetails) throws BankException { - Account accountData = null; - try { - accountData = accountService.withdrawMoney(accountDetails); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not found"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } - - @PostMapping(value = "/viewAccount/{accountId}") - public ResponseEntity getAccountDetails(@PathVariable Long accountId) throws BankException { - Account accountData = null; - try { - accountData = accountService.getAccountDetails(accountId); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (accountData == null) - throw new BankException("Account details not found"); - else - return new ResponseEntity(accountData, HttpStatus.OK); - } -} diff --git a/bank/src/main/java/com/springboot/bank/controller/BankController.java b/bank/src/main/java/com/springboot/bank/controller/BankController.java deleted file mode 100644 index 22b501c1..00000000 --- a/bank/src/main/java/com/springboot/bank/controller/BankController.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.service.BankService; - -/** - * @author Sumit - * - */ - -@RestController -public class BankController { - - final Logger LOGGER = Logger.getLogger(BankController.class); - - @Autowired - private BankService bankService; - - @PostMapping(value = "/createBank") - public ResponseEntity addBank(@RequestBody Bank bank) throws BankException { - Bank bankData = null; - try { - bankData = bankService.createBank(bank); - } catch (Exception e) { - LOGGER.error(e.getMessage()); - } - if (bankData == null) - throw new BankException("Bank details not added"); - else - return new ResponseEntity(bankData, HttpStatus.OK); - } - - @GetMapping(value = "/viewBankDetails/{bankId}") - public ResponseEntity getBankDetails(@PathVariable Long bankId) throws BankException { - Bank bank = null; - try { - bank = bankService.getBankDetails(bankId); - } catch (Exception e) { - LOGGER.error(e.getMessage()); - } - if (bank == null) - throw new BankException("No such Id of Bank exixts"); - else - return new ResponseEntity(bank, HttpStatus.OK); - } -} diff --git a/bank/src/main/java/com/springboot/bank/controller/BankDenominationController.java b/bank/src/main/java/com/springboot/bank/controller/BankDenominationController.java deleted file mode 100644 index c9775065..00000000 --- a/bank/src/main/java/com/springboot/bank/controller/BankDenominationController.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.springframework.beans.factory.annotation.Autowired; -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.RestController; - -import com.springboot.bank.dto.WrapperATMDenomination; -import com.springboot.bank.dto.WrapperAccountDenomination; -import com.springboot.bank.dto.WrapperBankDenomination; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.BankDenomination; -import com.springboot.bank.service.BankDenominationService; - - - -/** - * @author Ram - * - */ -@RestController -public class BankDenominationController { - - @Autowired - BankDenominationService bankDenominationService; - - @PostMapping("/totalDenom") - public ResponseEntity getTotalDenominationForBank(@RequestBody WrapperBankDenomination wrapperBankDenomination ) throws BankException { - BankDenomination bankDenomination = new BankDenomination(); - try { - bankDenominationService.addDenominationNew(wrapperBankDenomination.getAmount()); - } catch (BankException e) { - System.out.println(e.getMessage()); - } - if (bankDenomination == null) { - throw new BankException("not found"); - } else { - return new ResponseEntity(bankDenomination, HttpStatus.OK); - } - } - - /** - * @param wrapperBankDenomination - * @return - * @throws BankException - */ -@PostMapping("/") public ResponseEntity getTotalDenominationForATM(@RequestBody WrapperATMDenomination wrapperATMDenomination ) throws BankException { - BankDenomination bankDenomination = new BankDenomination(); - try { - bankDenominationService.addDenominationNew(wrapperATMDenomination.getAmount()); - } catch (BankException e) { - System.out.println(e.getMessage()); - } - if (bankDenomination == null) { - throw new BankException("not found"); - } else { - return new ResponseEntity(bankDenomination, HttpStatus.OK); - } - } - - - - - -/** -* @param wrapperBankDenomination -* @return -* @throws BankException -*/ -@PostMapping("/") public ResponseEntity getTotalDenominationForATM(@RequestBody WrapperAccountDenomination wrapperAccountDenomination ) throws BankException { - BankDenomination bankDenomination = new BankDenomination(); - try { - bankDenominationService.addDenominationNew(wrapperAccountDenomination.getAmount()); - } catch (BankException e) { - System.out.println(e.getMessage()); - } - if (bankDenomination == null) { - throw new BankException("not found"); - } else { - return new ResponseEntity(bankDenomination, HttpStatus.OK); - } - } - - - -} \ No newline at end of file diff --git a/bank/src/main/java/com/springboot/bank/controller/CustomerController.java b/bank/src/main/java/com/springboot/bank/controller/CustomerController.java deleted file mode 100644 index b9b7faea..00000000 --- a/bank/src/main/java/com/springboot/bank/controller/CustomerController.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Customer; -import com.springboot.bank.service.CustomerService; - -/** - * @author Sumit - * - */ - -@RestController -public class CustomerController { - - final Logger LOGGER = Logger.getLogger(CustomerController.class); - - @Autowired - private CustomerService customerService; - - @PostMapping(value = "/createCustomer") - public ResponseEntity createCustomer(@RequestBody WrapperBankCustomer wrapperBankCustomer) - throws BankException { - Customer customerData = null; - try { - customerData = customerService.createCustomer(wrapperBankCustomer); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (customerData == null) - throw new BankException("Customer details not added"); - else - return new ResponseEntity(customerData, HttpStatus.OK); - } - - @GetMapping(value = "/viewCustomer/{customerId}") - public ResponseEntity getCustomerDetails(@PathVariable Long customerId) throws BankException { - Customer customerData = null; - try { - customerData = customerService.getCustomerDetails(customerId); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (customerData == null) - throw new BankException("No such Id of Bank exixts"); - else - return new ResponseEntity(customerData, HttpStatus.OK); - } - -} diff --git a/bank/src/main/java/com/springboot/bank/controller/TransactionController.java b/bank/src/main/java/com/springboot/bank/controller/TransactionController.java deleted file mode 100644 index ffe7623d..00000000 --- a/bank/src/main/java/com/springboot/bank/controller/TransactionController.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - */ -package com.springboot.bank.controller; - -import java.util.Optional; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Transaction; -import com.springboot.bank.service.TransactionService; - -/** - * @author Sumit - * - */ - -@RestController -public class TransactionController { - - final Logger LOGGER = Logger.getLogger(TransactionController.class); - - @Autowired - private TransactionService transactionService; - - @PostMapping(value = "/createTransaction") - public ResponseEntity createTransaction(@RequestBody Transaction transaction) throws BankException { - String transactionData = null; - try { - transactionData = transactionService.createTransaction(transaction); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (transactionData == null) - throw new BankException("Transaction details not added"); - else - return new ResponseEntity(transactionData, HttpStatus.OK); - } - - @PostMapping(value = "/viewTransaction/{customerId}") - public ResponseEntity> getTransactionDetails(@PathVariable Long customerId) - throws BankException { - Optional transactionData = null; - try { - transactionData = transactionService.getTransactionDetails(customerId); - } catch (BankException e) { - LOGGER.error(e.getMessage()); - } - if (transactionData == null) - throw new BankException("Transaction details not found"); - else - return new ResponseEntity>(transactionData, HttpStatus.OK); - } - -} diff --git a/bank/src/main/java/com/springboot/bank/dto/ATMDetails.java b/bank/src/main/java/com/springboot/bank/dto/ATMDetails.java deleted file mode 100644 index f1bc7c1c..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/ATMDetails.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import java.math.BigDecimal; - -/** - * @author Sumit - * - */ -public class ATMDetails { - - private Long bankId; - private Long atmId; - private Long accountId; - private BigDecimal amount; - - /** - * - */ - public ATMDetails() { - super(); - } - - /** - * @param bankId - * @param atmId - * @param accountId - * @param amount - */ - public ATMDetails(Long bankId, Long atmId, Long accountId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.atmId = atmId; - this.accountId = accountId; - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - - /** - * @param atmId - * the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ATMDetails [bankId=" + bankId + ", atmId=" + atmId + ", accountId=" + accountId + ", amount=" + amount - + "]"; - } -} diff --git a/bank/src/main/java/com/springboot/bank/dto/AccountDetails.java b/bank/src/main/java/com/springboot/bank/dto/AccountDetails.java deleted file mode 100644 index da690a62..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/AccountDetails.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import java.math.BigDecimal; - -/** - * @author Sumit - * - */ -public class AccountDetails { - - private Long bankId; - private Long customerId; - private Long accountId; - private BigDecimal amount; - - /** - * - */ - public AccountDetails() { - super(); - } - - /** - * @param bankId - * @param customerId - * @param accountId - * @param amountToBeAdded - */ - public AccountDetails(Long bankId, Long customerId, Long accountId, BigDecimal amount) { - super(); - this.bankId = bankId; - this.customerId = customerId; - this.accountId = accountId; - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - /** - * @return the amountToBeAdded - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amountToBeAdded - * the amountToBeAdded to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AccountDetails [bankId=" + bankId + ", customerId=" + customerId + ", accountId=" + accountId - + ", amount=" + amount + "]"; - } - -} diff --git a/bank/src/main/java/com/springboot/bank/dto/WrapperATMDenomination.java b/bank/src/main/java/com/springboot/bank/dto/WrapperATMDenomination.java deleted file mode 100644 index 3399a328..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/WrapperATMDenomination.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.BankDenomination; - -/** - * @author Ram - * - */ -public class WrapperATMDenomination { - - -private BankDenomination bankDenomination; -private Integer amount; -private Long bankId; -private Long atmId; - /** - * @param bankDenomination - * @param amount - * @param bankId - * @param atmId - */ - public WrapperATMDenomination(BankDenomination bankDenomination, Integer amount, Long bankId, Long atmId) { - this.bankDenomination = bankDenomination; - this.amount = amount; - this.bankId = bankId; - this.atmId = atmId; - } - /** - * @return the bankDenomination - */ - public BankDenomination getBankDenomination() { - return bankDenomination; - } - /** - * @param bankDenomination the bankDenomination to set - */ - public void setBankDenomination(BankDenomination bankDenomination) { - this.bankDenomination = bankDenomination; - } - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(Integer amount) { - this.amount = amount; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - /** - * @param atmId the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperATMDenomination [bankDenomination=" + bankDenomination + ", amount=" + amount + ", bankId=" - + bankId + ", atmId=" + atmId + "]"; - } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((amount == null) ? 0 : amount.hashCode()); - result = prime * result + ((atmId == null) ? 0 : atmId.hashCode()); - result = prime * result + ((bankDenomination == null) ? 0 : bankDenomination.hashCode()); - result = prime * result + ((bankId == null) ? 0 : bankId.hashCode()); - return result; - } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - WrapperATMDenomination other = (WrapperATMDenomination) obj; - if (amount == null) { - if (other.amount != null) - return false; - } else if (!amount.equals(other.amount)) - return false; - if (atmId == null) { - if (other.atmId != null) - return false; - } else if (!atmId.equals(other.atmId)) - return false; - if (bankDenomination == null) { - if (other.bankDenomination != null) - return false; - } else if (!bankDenomination.equals(other.bankDenomination)) - return false; - if (bankId == null) { - if (other.bankId != null) - return false; - } else if (!bankId.equals(other.bankId)) - return false; - return true; - } - - - - - -} diff --git a/bank/src/main/java/com/springboot/bank/dto/WrapperAccountDenomination.java b/bank/src/main/java/com/springboot/bank/dto/WrapperAccountDenomination.java deleted file mode 100644 index c6c1c92a..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/WrapperAccountDenomination.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.BankDenomination; - -/** - * @author Ram - * - */ -public class WrapperAccountDenomination { - - - private BankDenomination bankDenomination; - private Integer amount; - private Long bankId; - private Long accountId; - /** - * @param bankDenomination - * @param amount - * @param bankId - * @param accountId - */ - public WrapperAccountDenomination(BankDenomination bankDenomination, Integer amount, Long bankId, Long accountId) { - this.bankDenomination = bankDenomination; - this.amount = amount; - this.bankId = bankId; - this.accountId = accountId; - } - /** - * @return the bankDenomination - */ - public BankDenomination getBankDenomination() { - return bankDenomination; - } - /** - * @param bankDenomination the bankDenomination to set - */ - public void setBankDenomination(BankDenomination bankDenomination) { - this.bankDenomination = bankDenomination; - } - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - /** - * @param amount the amount to set - */ - public void setAmount(Integer amount) { - this.amount = amount; - } - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - /** - * @param bankId the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - /** - * @param accountId the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperAccountDenomination [bankDenomination=" + bankDenomination + ", amount=" + amount + ", bankId=" - + bankId + ", accountId=" + accountId + "]"; - } - - - -} diff --git a/bank/src/main/java/com/springboot/bank/dto/WrapperBankATM.java b/bank/src/main/java/com/springboot/bank/dto/WrapperBankATM.java deleted file mode 100644 index cf8211c6..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/WrapperBankATM.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.ATM; - -/** - * @author Sumit - * - */ -public class WrapperBankATM { - - ATM atm; - Long bankId; - - /** - * - */ - public WrapperBankATM() { - super(); - } - - /** - * @param atm - * @param bankId - */ - public WrapperBankATM(ATM atm, Long bankId) { - this.atm = atm; - this.bankId = bankId; - } - - /** - * @return the atm - */ - public ATM getAtm() { - return atm; - } - - /** - * @param atm - * the atm to set - */ - public void setAtm(ATM atm) { - this.atm = atm; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankATM [atm=" + atm + ", bankId=" + bankId + "]"; - } - -} diff --git a/bank/src/main/java/com/springboot/bank/dto/WrapperBankCustomer.java b/bank/src/main/java/com/springboot/bank/dto/WrapperBankCustomer.java deleted file mode 100644 index 3ccb164d..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/WrapperBankCustomer.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.Customer; - -/** - * @author trainee - * - */ -public class WrapperBankCustomer { - - Customer customer; - Long bankId; - - /** - * - */ - public WrapperBankCustomer() { - super(); - } - - /** - * @param customer - * @param bankId - */ - public WrapperBankCustomer(Customer customer, Long bankId) { - super(); - this.customer = customer; - this.bankId = bankId; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankCustomer [customer=" + customer + ", bankId=" + bankId + "]"; - } -} diff --git a/bank/src/main/java/com/springboot/bank/dto/WrapperBankCustomerAccount.java b/bank/src/main/java/com/springboot/bank/dto/WrapperBankCustomerAccount.java deleted file mode 100644 index 0e789a33..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/WrapperBankCustomerAccount.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.Account; - -/** - * @author Sumit - * - */ -public class WrapperBankCustomerAccount { - - private Account account; - private Long customerId; - private Long bankId; - - /** - * - */ - public WrapperBankCustomerAccount() { - super(); - } - - /** - * @param account - * @param customerId - * @param bankId - */ - public WrapperBankCustomerAccount(Account account, Long customerId, Long bankId) { - super(); - this.account = account; - this.customerId = customerId; - this.bankId = bankId; - } - - /** - * @return the account - */ - public Account getAccount() { - return account; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankCustomerAccount [account=" + account + ", customerId=" + customerId + ", bankId=" + bankId - + "]"; - } - -} diff --git a/bank/src/main/java/com/springboot/bank/dto/WrapperBankDenomination.java b/bank/src/main/java/com/springboot/bank/dto/WrapperBankDenomination.java deleted file mode 100644 index c8144f05..00000000 --- a/bank/src/main/java/com/springboot/bank/dto/WrapperBankDenomination.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - */ -package com.springboot.bank.dto; - -import com.springboot.bank.model.BankDenomination; - -/** - * @author Sumit - * - */ -public class WrapperBankDenomination { - - BankDenomination bankDenomination; - Integer amount; - Long bankId; - - /** - * - */ - public WrapperBankDenomination() { - super(); - } - - /** - * @param bankDenomination - * @param amount - * @param bankId - */ - public WrapperBankDenomination(BankDenomination bankDenomination, Integer amount, Long bankId) { - super(); - this.bankDenomination = bankDenomination; - this.amount = amount; - this.bankId = bankId; - } - - /** - * @return the bankDenomination - */ - public BankDenomination getBankDenomination() { - return bankDenomination; - } - - /** - * @param bankDenomination - * the bankDenomination to set - */ - public void setBankDenomination(BankDenomination bankDenomination) { - this.bankDenomination = bankDenomination; - } - - /** - * @return the amount - */ - public Integer getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(Integer amount) { - this.amount = amount; - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "WrapperBankDenomination [bankDenomination=" + bankDenomination + ", amount=" + amount + ", bankId=" - + bankId + "]"; - } - -} diff --git a/bank/src/main/java/com/springboot/bank/exception/BankException.java b/bank/src/main/java/com/springboot/bank/exception/BankException.java deleted file mode 100644 index 7abad68a..00000000 --- a/bank/src/main/java/com/springboot/bank/exception/BankException.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.exception; - -/** - * @author Sumit - * - */ -public class BankException extends Exception { - - public BankException(String message) { - super(message); - } -} diff --git a/bank/src/main/java/com/springboot/bank/model/ATM.java b/bank/src/main/java/com/springboot/bank/model/ATM.java deleted file mode 100644 index 24b399c4..00000000 --- a/bank/src/main/java/com/springboot/bank/model/ATM.java +++ /dev/null @@ -1,99 +0,0 @@ - -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @author Sumit - *It will represents the ATM entity - */ -@Entity -@Table(name = "atm") -public class ATM { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long atmId; - // @Required - private BigDecimal money; - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - private static final Logger LOGGER = Logger.getLogger( ATM.class.getName() ); - - /** - * - */ - public ATM() { - super(); - } - - /** - * @param atmId - * @param money - * @param bank - */ - public ATM(BigDecimal money, Bank bank) { - this.money = money; - this.bank = bank; - LOGGER.info("Inside the ATM Entity"); - - } - - /** - * @return the atmId - */ - public Long getAtmId() { - return atmId; - } - - /** - * @param atmId - * the atmId to set - */ - public void setAtmId(Long atmId) { - this.atmId = atmId; - } - - /** - * @return the money - */ - public BigDecimal getMoney() { - return money; - } - - /** - * @param money - * the money to set - */ - public void setMoney(BigDecimal money) { - this.money = money; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "ATM [atmId=" + atmId + ", money=" + money + ", bank=" + bank + "]"; - } -} diff --git a/bank/src/main/java/com/springboot/bank/model/Account.java b/bank/src/main/java/com/springboot/bank/model/Account.java deleted file mode 100644 index b54e015f..00000000 --- a/bank/src/main/java/com/springboot/bank/model/Account.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @author Sumit - *It will represents the Account Entity. - */ -@Entity -@Table(name = "account") -public class Account { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long accountId; - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - private BigDecimal amount; - - - - private static final Logger LOGGER = Logger.getLogger( Account.class.getName() ); - - /** - * - */ - public Account() { - super(); - } - - /** - * @param accountId acted as primary key of the table account - * @param bank - * @param customer - * @param amount - */ - public Account(Bank bank, Customer customer, BigDecimal amount) { - this.bank = bank; - this.customer = customer; - this.amount = amount; - LOGGER.info("Inside the account Entity"); - } - - /** - * @return the accountId - */ - public Long getAccountId() { - return accountId; - } - - /** - * @param accountId - * the accountId to set - */ - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Account [accountId=" + accountId + ", bank=" + bank + ", customer=" + customer + ", amount=" + amount - + "]"; - } -} diff --git a/bank/src/main/java/com/springboot/bank/model/Bank.java b/bank/src/main/java/com/springboot/bank/model/Bank.java deleted file mode 100644 index a6774624..00000000 --- a/bank/src/main/java/com/springboot/bank/model/Bank.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author Sumit - *It will represents the BANK entity - */ -@Table(name = "bank") -@Entity -public class Bank { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "bankId") - private Long bankId; - private BigDecimal amount; - - private static final Logger LOGGER = Logger.getLogger( Bank.class.getName() ); - - - /** - * - */ - public Bank() { - super(); - } - - /** - * @param bankId - * @param amount - */ - public Bank(BigDecimal amount) { - this.amount = amount; - LOGGER.info("Inside the BAnk Entity"); - } - - /** - * @return the bankId - */ - public Long getBankId() { - return bankId; - } - - /** - * @param bankId - * the bankId to set - */ - public void setBankId(Long bankId) { - this.bankId = bankId; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Bank [bankId=" + bankId + ", amount=" + amount + "]"; - } -} \ No newline at end of file diff --git a/bank/src/main/java/com/springboot/bank/model/BankDenomination.java b/bank/src/main/java/com/springboot/bank/model/BankDenomination.java deleted file mode 100644 index 01ec788f..00000000 --- a/bank/src/main/java/com/springboot/bank/model/BankDenomination.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToOne; - -/** - * @author Sumit - * - */ - -@Entity -public class BankDenomination { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long denominationId; - @OneToOne(targetEntity = Bank.class) - private Bank bank; - private Integer noOfDenomination; - private Integer denomination; - - - private static final Logger LOGGER = Logger.getLogger( ATM.class.getName() ); - /** - * - */ - public BankDenomination() { - - super(); - LOGGER.info("Inside the BankDenomination Entity"); - } - - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BankDenominationNew [denominationId=" + denominationId + ", bank=" + bank + ", noOfDenomination=" - + noOfDenomination + ", denomination=" + denomination + "]"; - } - - - - /** - * @return the denominationId - */ - public Long getDenominationId() { - return denominationId; - } - - /** - * @param denominationId - * the denominationId to set - */ - public void setDenominationId(Long denominationId) { - this.denominationId = denominationId; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - - /** - * @return the noOfDenomination - */ - public Integer getNoOfDenomination() { - return noOfDenomination; - } - - /** - * @param noOfDenomination - * the noOfDenomination to set - */ - public void setNoOfDenomination(Integer noOfDenomination) { - this.noOfDenomination = noOfDenomination; - } - - - - /** - * @return the denomination - */ - public Integer getDenomination() { - return denomination; - } - - - - /** - * @param denomination the denomination to set - */ - public void setDenomination(Integer denomination) { - this.denomination = denomination; - } - - - - /** - * @param denominationId - * @param bank - * @param noOfDenomination - * @param denomination - */ - public BankDenomination(Long denominationId, Bank bank, Integer noOfDenomination, Integer denomination) { - super(); - this.denominationId = denominationId; - this.bank = bank; - this.noOfDenomination = noOfDenomination; - this.denomination = denomination; - } - - - -} \ No newline at end of file diff --git a/bank/src/main/java/com/springboot/bank/model/Customer.java b/bank/src/main/java/com/springboot/bank/model/Customer.java deleted file mode 100644 index 9d6ac172..00000000 --- a/bank/src/main/java/com/springboot/bank/model/Customer.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.util.logging.Logger; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.springframework.lang.NonNull; - -/** - * @author Sumit - *It will represents the CUstomer Entity. - */ - -@Entity -@Table(name = "customer") -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long customerId; - @Column(nullable = false, length = 100) - private String customerName; - @NonNull - private Integer customerPin; - @ManyToOne(targetEntity = Bank.class) - private Bank bank; - - private static final Logger LOGGER = Logger.getLogger( Customer.class.getName() ); - - - // @JoinTable(name = "bank_customer", joinColumns = @JoinColumn(name = - // "customerId"), inverseJoinColumns = @JoinColumn(name = "bankId")) - - /** - * - */ - public Customer() { - super(); - } - - /** - * @param customerId - * @param customerName - * @param customerPin - * @param bank - */ - public Customer( String customerName, Integer customerPin, Bank bank) { - this.customerName = customerName; - this.customerPin = customerPin; - this.bank = bank; - LOGGER.info("Inside the Customer Entity"); - - } - - /** - * @return the customerId - */ - public Long getCustomerId() { - return customerId; - } - - /** - * @param customerId - * the customerId to set - */ - public void setCustomerId(Long customerId) { - this.customerId = customerId; - } - - /** - * @return the customerName - */ - public String getCustomerName() { - return customerName; - } - - /** - * @param customerName - * the customerName to set - */ - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - - /** - * @return the customerPin - */ - public Integer getCustomerPin() { - return customerPin; - } - - /** - * @param customerPin - * the customerPin to set - */ - public void setCustomerPin(Integer customerPin) { - this.customerPin = customerPin; - } - - /** - * @return the bank - */ - public Bank getBank() { - return bank; - } - - /** - * @param bank - * the bank to set - */ - public void setBank(Bank bank) { - this.bank = bank; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerPin=" + customerPin - + ", bank=" + bank + "]"; - } -} diff --git a/bank/src/main/java/com/springboot/bank/model/Transaction.java b/bank/src/main/java/com/springboot/bank/model/Transaction.java deleted file mode 100644 index e25f5216..00000000 --- a/bank/src/main/java/com/springboot/bank/model/Transaction.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * - */ -package com.springboot.bank.model; - -import java.math.BigDecimal; -import java.util.logging.Logger; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @author Sumit - * - */ - -@Entity -@Table(name = "transaction") -public class Transaction { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long transactionId; - @ManyToOne(targetEntity = Customer.class) - private Customer customer; - @ManyToOne(targetEntity = Account.class) - private Account account; - private BigDecimal amount; - private String transactionType; - - - private static final Logger LOGGER = Logger.getLogger( Bank.class.getName() ); - - - /** - * - */ - public Transaction() { - super(); - } - - /** - * @param transactionId - * @param customer - * @param account - * @param amount - * @param transactionType - */ - public Transaction(Customer customer, Account account, BigDecimal amount, String transactionType) { - this.customer = customer; - this.account = account; - this.amount = amount; - this.transactionType = transactionType; - LOGGER.info("Inside the Transaction Entity"); - - } - - /** - * @return the transactionId - */ - public Long getTransactionId() { - return transactionId; - } - - /** - * @param transactionId - * the transactionId to set - */ - public void setTransactionId(Long transactionId) { - this.transactionId = transactionId; - } - - /** - * @return the customer - */ - public Customer getCustomer() { - return customer; - } - - /** - * @param customer - * the customer to set - */ - public void setCustomer(Customer customer) { - this.customer = customer; - } - - /** - * @return the account - */ - public Account getAccount() { - return account; - } - - /** - * @param account - * the account to set - */ - public void setAccount(Account account) { - this.account = account; - } - - /** - * @return the amount - */ - public BigDecimal getAmount() { - return amount; - } - - /** - * @param amount - * the amount to set - */ - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - /** - * @return the transactionType - */ - public String getTransactionType() { - return transactionType; - } - - /** - * @param transactionType - * the transactionType to set - */ - public void setTransactionType(String transactionType) { - this.transactionType = transactionType; - } - - /* - * @return toString() representation of given object - */ - @Override - public String toString() { - return "Transaction [transactionId=" + transactionId + ", customer=" + customer + ", account=" + account - + ", amount=" + amount + ", transactionType=" + transactionType + "]"; - } -} diff --git a/bank/src/main/java/com/springboot/bank/repository/ATMDAO.java b/bank/src/main/java/com/springboot/bank/repository/ATMDAO.java deleted file mode 100644 index 52ddab83..00000000 --- a/bank/src/main/java/com/springboot/bank/repository/ATMDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.ATM; - -/** - * @author trainee - * - */ -public interface ATMDAO extends JpaRepository { - -} diff --git a/bank/src/main/java/com/springboot/bank/repository/AccountDAO.java b/bank/src/main/java/com/springboot/bank/repository/AccountDAO.java deleted file mode 100644 index 1d89cdbd..00000000 --- a/bank/src/main/java/com/springboot/bank/repository/AccountDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Account; - -/** - * @author trainee - * - */ -public interface AccountDAO extends JpaRepository{ - -} diff --git a/bank/src/main/java/com/springboot/bank/repository/BankDAO.java b/bank/src/main/java/com/springboot/bank/repository/BankDAO.java deleted file mode 100644 index 6776960c..00000000 --- a/bank/src/main/java/com/springboot/bank/repository/BankDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Bank; - -/** - * @author Sumit - * - */ -public interface BankDAO extends JpaRepository { - -} diff --git a/bank/src/main/java/com/springboot/bank/repository/BankDenominationDAO.java b/bank/src/main/java/com/springboot/bank/repository/BankDenominationDAO.java deleted file mode 100644 index 115117eb..00000000 --- a/bank/src/main/java/com/springboot/bank/repository/BankDenominationDAO.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.BankDenomination; - -/** - * @author Sumit - * - */ - -public interface BankDenominationDAO extends JpaRepository { - -} diff --git a/bank/src/main/java/com/springboot/bank/repository/CustomerDAO.java b/bank/src/main/java/com/springboot/bank/repository/CustomerDAO.java deleted file mode 100644 index 79289589..00000000 --- a/bank/src/main/java/com/springboot/bank/repository/CustomerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Customer; - -/** - * @author Sumit - * - */ -public interface CustomerDAO extends JpaRepository { - -} diff --git a/bank/src/main/java/com/springboot/bank/repository/TransactionDAO.java b/bank/src/main/java/com/springboot/bank/repository/TransactionDAO.java deleted file mode 100644 index bfc04e76..00000000 --- a/bank/src/main/java/com/springboot/bank/repository/TransactionDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.springboot.bank.repository; - -import org.springframework.data.jpa.repository.JpaRepository; -import com.springboot.bank.model.Transaction; - -/** - * @author Sumit - * - */ -public interface TransactionDAO extends JpaRepository { - -} diff --git a/bank/src/main/java/com/springboot/bank/service/ATMService.java b/bank/src/main/java/com/springboot/bank/service/ATMService.java deleted file mode 100644 index ff020b05..00000000 --- a/bank/src/main/java/com/springboot/bank/service/ATMService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; - -import com.springboot.bank.dto.ATMDetails; -import com.springboot.bank.dto.WrapperBankATM; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.ATM; - -/** - * @author trainee - * - */ -public interface ATMService { - - ATM createATM(WrapperBankATM wrapperBankATM) throws BankException; - - ATM addMoneyFromBank(Long atmId, Long bankId, BigDecimal moneyToBeAddedToATM) throws BankException; - - ATM withdrawMoney(ATMDetails atmDetails) throws BankException; - -} diff --git a/bank/src/main/java/com/springboot/bank/service/ATMServiceImpl.java b/bank/src/main/java/com/springboot/bank/service/ATMServiceImpl.java deleted file mode 100644 index 99df3a30..00000000 --- a/bank/src/main/java/com/springboot/bank/service/ATMServiceImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.ATMDetails; -import com.springboot.bank.dto.WrapperBankATM; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.ATM; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Bank; -import com.springboot.bank.repository.ATMDAO; -import com.springboot.bank.repository.AccountDAO; -import com.springboot.bank.repository.BankDAO; - -/** - * @author Sumit - * - */ -@Service("ATMService") -public class ATMServiceImpl implements ATMService { - - @Autowired - ATMDAO atmDao; - - @Autowired - BankDAO bankDao; - - @Autowired - AccountDAO accountDao; - - /* - * @see - * com.springboot.bank.service.ATMService#createATM(com.springboot.bank.model. - * ATM) - */ - @Override - public ATM createATM(WrapperBankATM wrapperBankATM) throws BankException { - ATM ATMData = wrapperBankATM.getAtm(); - Long bankId = wrapperBankATM.getBankId(); - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - if (bank == null) - throw new BankException("Id not found"); - else { - ATMData.setBank(bank); - ATMData = atmDao.save(ATMData); - } - return ATMData; - } - - @Override - public ATM addMoneyFromBank(Long atmId, Long bankId, BigDecimal moneyToBeAddedToATM) throws BankException { - - Optional atmList = atmDao.findById(atmId); - ATM atmdata = null; - ATM atm = atmList.get(); - if (atm == null) - throw new BankException("Atm with such Id doesnt exist"); - else { - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - if (bank == null) - throw new BankException("Bank with such Id doesnt exist"); - else { - BigDecimal bankMoney = bank.getAmount(); - BigDecimal finalAmount = bankMoney.subtract(moneyToBeAddedToATM); - if (finalAmount.compareTo(BigDecimal.ZERO) == 1) { - BigDecimal atmMoney = atm.getMoney().add(moneyToBeAddedToATM); - atm.setMoney(atmMoney); - bank.setAmount(finalAmount); - atmdata = atmDao.save(atm); - bankDao.save(bank); - } else - throw new BankException("Bank doesnt have enough money"); - } - return atmdata; - } - } - - @Override - public ATM withdrawMoney(ATMDetails atmDetails) throws BankException { - Long atmId = atmDetails.getAccountId(); - Long bankId = atmDetails.getBankId(); - Long accountId = atmDetails.getAccountId(); - BigDecimal amountToBeWithdrawn = atmDetails.getAmount(); - Account account = null; - Bank bank = null; - ATM atm = null; - if (accountId == 0 || bankId == 0 || atmId == 0) { - throw new BankException("Id cannot be zero"); - } - else { - Optional accountList = accountDao.findById(accountId); - account = accountList.get(); - BigDecimal newAccountBalance; - if (account == null) { - throw new BankException("No such account exists"); - } else { - newAccountBalance = amountToBeWithdrawn.subtract(account.getAmount()); - if (newAccountBalance.compareTo(BigDecimal.ZERO) == 1) { - account.setAmount(newAccountBalance); - accountDao.save(account); - } else { - throw new BankException("Account Balance cannot be negative"); - } - } - Optional bankList = bankDao.findById(bankId); - bank = bankList.get(); - if (bank == null) { - throw new BankException("No such id of Bank exists"); - } else { - BigDecimal newBankBalance = amountToBeWithdrawn.subtract(bank.getAmount()); - if (newBankBalance.compareTo(BigDecimal.ZERO) == 1) { - bank.setAmount(newBankBalance); - bankDao.save(bank); - } else { - throw new BankException("Bank Balance cannot be negative"); - } - } - Optional atmList = atmDao.findById(atmId); - atm = atmList.get(); - if (atm == null) { - throw new BankException("No such id of ATM exists"); - } else { - BigDecimal newBankBalance = amountToBeWithdrawn.subtract(bank.getAmount()); - if (newBankBalance.compareTo(BigDecimal.ZERO) == 1) { - atm.setMoney(newAccountBalance); - atmDao.save(atm); - } else { - throw new BankException("ATM Balance cannot be negative"); - } - } - } - return atm; - } -} diff --git a/bank/src/main/java/com/springboot/bank/service/AccountService.java b/bank/src/main/java/com/springboot/bank/service/AccountService.java deleted file mode 100644 index 0e0d7e7b..00000000 --- a/bank/src/main/java/com/springboot/bank/service/AccountService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.dto.AccountDetails; -import com.springboot.bank.dto.WrapperBankCustomerAccount; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; - -/** - * @author Sumit - * - */ -public interface AccountService { - - Account createAccount(WrapperBankCustomerAccount wrapperBankCustomerAccount) throws BankException; - - Account depositMoney(AccountDetails accountDetails) throws BankException; - - Account withdrawMoney(AccountDetails accountDetails) throws BankException; - - Account getAccountDetails(Long accountId) throws BankException; -} diff --git a/bank/src/main/java/com/springboot/bank/service/AccountServiceImpl.java b/bank/src/main/java/com/springboot/bank/service/AccountServiceImpl.java deleted file mode 100644 index 6bd0562d..00000000 --- a/bank/src/main/java/com/springboot/bank/service/AccountServiceImpl.java +++ /dev/null @@ -1,192 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; - -import javax.transaction.Transactional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.AccountDetails; -import com.springboot.bank.dto.WrapperBankCustomerAccount; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Bank; -import com.springboot.bank.model.Customer; -import com.springboot.bank.model.Transaction; -import com.springboot.bank.repository.AccountDAO; -import com.springboot.bank.repository.BankDAO; -import com.springboot.bank.repository.CustomerDAO; - -/** - * @author Sumit - * - */ -@Service("accountService") -public class AccountServiceImpl implements AccountService { - - @Autowired - BankDAO bankDao; - - @Autowired - CustomerDAO customerDao; - - @Autowired - AccountDAO accountDao; - - @Autowired - TransactionService transactionService; - - /* - * @see - * com.springboot.bank.service.AccountService#createAccount(com.springboot.bank. - * wrapper.WrapperBankCustomerAccount) - */ - @Override - public Account createAccount(WrapperBankCustomerAccount wrapperBankCustomerAccount) throws BankException { - - Account account = wrapperBankCustomerAccount.getAccount(); - if (account == null) - throw new BankException("Account not found"); - else { - Long bankId = wrapperBankCustomerAccount.getBankId(); - // System.out.println(bankId); - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - // System.out.println(bank); - if (bank == null) { - throw new BankException("Bank with such Id doesnt exist"); - } else { - account.setBank(bank); - } - Long customerId = wrapperBankCustomerAccount.getCustomerId(); - Optional customerList = customerDao.findById(customerId); - Customer customer = customerList.get(); - if (customer == null) { - throw new BankException("Customer with such Id doesnt exist"); - } else { - account.setCustomer(customer); - account = accountDao.save(account); - } - } - return account; - } - - @Transactional - @Override - public Account depositMoney(AccountDetails accountDetails) throws BankException { - - Long accountId = accountDetails.getAccountId(); - Long bankId = accountDetails.getBankId(); - Long customerId = accountDetails.getCustomerId(); - BigDecimal amountToBeAdded = accountDetails.getAmount(); - Account account = null; - Bank bank = null; - Customer customer = null; - if (accountId == 0 || bankId == 0 || customerId == 0 || amountToBeAdded.compareTo(BigDecimal.ZERO) == 0) - throw new BankException("Id or amount cannot be zero"); - else { - Optional accountList = accountDao.findById(accountId); - account = accountList.get(); - BigDecimal newAccountBalance; - if (account == null) { - throw new BankException("No such account id exists"); - } else { - newAccountBalance = amountToBeAdded.add(account.getAmount()); - Optional customerList = customerDao.findById(customerId); - customer = customerList.get(); - if (customer == null) { - throw new BankException("No such customer account exists"); - } else { - Optional bankList = bankDao.findById(bankId); - bank = bankList.get(); - if (bank == null) { - throw new BankException("No such bank account exists"); - } else { - account.setAmount(newAccountBalance); - accountDao.save(account); - Transaction transaction = new Transaction(customer, account, amountToBeAdded, - "Money Deposited"); - transactionService.createTransaction(transaction); - BigDecimal newBankBalance = amountToBeAdded.add(bank.getAmount()); - bank.setAmount(newBankBalance); - bankDao.save(bank); - } - } - } - } - return account; - } - - @Transactional - @Override - public Account withdrawMoney(AccountDetails accountDetails) throws BankException { - Long accountId = accountDetails.getAccountId(); - Long bankId = accountDetails.getBankId(); - Long customerId = accountDetails.getCustomerId(); - BigDecimal amountToBeWithdrawn = accountDetails.getAmount(); - Account account = null; - Bank bank = null; - Customer customer = null; - if (accountId == 0 || bankId == 0 || customerId == 0) { - throw new BankException("Id or amount cannot be zero"); - }else { - Optional accountList = accountDao.findById(accountId); - account = accountList.get(); - BigDecimal newAccountBalance; - if (account == null) { - throw new BankException("No such account exists"); - } else { - newAccountBalance = account.getAmount().subtract(amountToBeWithdrawn); - if (newAccountBalance.compareTo(BigDecimal.ZERO) == -1) { - throw new BankException("Account Balance cannot be 0 or negative"); - } else { - Optional bankList = bankDao.findById(bankId); - bank = bankList.get(); - if (bank == null) { - throw new BankException("No such bank id exists"); - } else { - BigDecimal newBankBalance = bank.getAmount().subtract(amountToBeWithdrawn); - if (newBankBalance.compareTo(BigDecimal.ZERO) == 0 - || newBankBalance.compareTo(BigDecimal.ZERO) == -1) { - throw new BankException("Bank Balance cannot be 0 or negative"); - } else { - Optional customerList = customerDao.findById(customerId); - customer = customerList.get(); - if (customer == null) { - throw new BankException("No such customer id exists"); - } else { - Transaction transaction = new Transaction(customer, account, amountToBeWithdrawn, - "Money Withdrawn"); - transactionService.createTransaction(transaction); - account.setAmount(newAccountBalance); - accountDao.save(account); - bank.setAmount(newBankBalance); - bankDao.save(bank); - - } - } - } - } - } - } - return account; - } - - @Override - public Account getAccountDetails(Long accountId) throws BankException { - Optional accountList = accountDao.findById(accountId); - Account account = null; - account = accountList.get(); - if (account == null) - throw new BankException("Account id doesnt exist"); - else { - account = accountDao.save(account); - } - return account; - } -} diff --git a/bank/src/main/java/com/springboot/bank/service/BankDenominationService.java b/bank/src/main/java/com/springboot/bank/service/BankDenominationService.java deleted file mode 100644 index b9e1dba2..00000000 --- a/bank/src/main/java/com/springboot/bank/service/BankDenominationService.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.dto.WrapperBankDenomination; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.BankDenomination; - -/** - * @author Sumit - * - */ -public interface BankDenominationService { - - - - void addDenominationNew(Integer amount) throws BankException; - -} diff --git a/bank/src/main/java/com/springboot/bank/service/BankDenominationServiceImpl.java b/bank/src/main/java/com/springboot/bank/service/BankDenominationServiceImpl.java deleted file mode 100644 index dfc4dad2..00000000 --- a/bank/src/main/java/com/springboot/bank/service/BankDenominationServiceImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Random; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.WrapperBankDenomination; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.model.BankDenomination; -import com.springboot.bank.model.BankDenomination; -import com.springboot.bank.repository.BankDAO; -import com.springboot.bank.repository.BankDenominationDAO; - -/** - * @author Sumit - * - */ -@Service("bankDenominationService") -public class BankDenominationServiceImpl implements BankDenominationService { - - @Autowired - private BankDenominationDAO bankDenominationDAO; - - @Autowired - BankDAO bankDao; - - /* - * @Override public BankDenomination addDenomination(WrapperBankDenomination - * wrapperBankDenomination) throws BankException { Long bankId = - * wrapperBankDenomination.getBankId(); Integer amount = - * wrapperBankDenomination.getAmount(); BankDenomination bankDenomination = - * wrapperBankDenomination.getBankDenomination(); Bank bank = null; Integer - * noOf2000s = null; Integer noOf500s = null; Integer noOf100s = null; Integer - * temperoryCount = 0; if (amount / 2000 != 0) { noOf2000s = amount / 2000; - * amount = amount % 2000; System.out.println(noOf2000s); temperoryCount = - * temperoryCount + noOf2000s; bankDenomination.setNoOf2000s(noOf2000s); } if - * (amount != 0 & amount / 500 != 0) { noOf500s = amount / 500; amount = amount - * % 500; temperoryCount = temperoryCount + noOf500s; - * bankDenomination.setNoOf500s(noOf500s); } - * - * if (amount != 0 & amount / 100 != 0) { noOf100s = amount / 100; amount = - * amount % 100; temperoryCount = temperoryCount + noOf100s; - * bankDenomination.setNoOf100s(noOf100s); } - * - * Optional bankList = bankDao.findById(bankId); if (bankList.isPresent()) - * { bank = bankList.get(); bankDenomination.setBank(bank); - * bankDenomination.setNoOfDenomination(temperoryCount); - * bankDenominationDAO.save(bankDenomination); } else { throw new - * BankException("bank is not present"); } return bankDenomination; } - */ - - @Override - public void addDenominationNew(Integer amount) throws BankException { - - List list1 = new ArrayList(); - list1.add(2000); - list1.add(500); - list1.add(100); - list1.add(200); - Random rand = new Random(); - Integer remainder = amount; - System.out.println("list >>>>" + list1); - for (int i = 0; i <= list1.size(); i++) { - Integer randomIndex = rand.nextInt(list1.size()); - // System.out.println("randomIndex >>" + randomIndex); - Integer randomElement = list1.get(randomIndex); - // System.out.println("randomElement >>" + randomElement); - if (randomElement.compareTo(remainder) == 0 || randomElement.compareTo(remainder) == -1) { - BankDenomination bankDenominationNew = new BankDenomination(); - bankDenominationNew.setNoOfDenomination(remainder / randomElement); - bankDenominationNew.setDenomination(randomElement); - remainder = remainder % randomElement; - System.out.println(bankDenominationNew); - if (remainder == 0) { - break; - } - } - list1.remove(randomIndex); - } - - } -} \ No newline at end of file diff --git a/bank/src/main/java/com/springboot/bank/service/BankService.java b/bank/src/main/java/com/springboot/bank/service/BankService.java deleted file mode 100644 index ef543af1..00000000 --- a/bank/src/main/java/com/springboot/bank/service/BankService.java +++ /dev/null @@ -1,22 +0,0 @@ - -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; - -/** - * @author Ram - * @nterface BankService - * Description : It has 2 methods declaration in it. whichever class will implements, - * will provide implemenatation for this methods. - * - */ -public interface BankService { - - Bank createBank(Bank bank) throws BankException; - - Bank getBankDetails(Long bankId) throws BankException; -} \ No newline at end of file diff --git a/bank/src/main/java/com/springboot/bank/service/BankServiceImpl.java b/bank/src/main/java/com/springboot/bank/service/BankServiceImpl.java deleted file mode 100644 index 9418e16a..00000000 --- a/bank/src/main/java/com/springboot/bank/service/BankServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.math.BigDecimal; -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.repository.BankDAO; - -/** - * @author Sumit - * @Service("bankService") - * Description : It provide implementation for BankServices method. - * 1.It Helps to create new bank - * 2.getBankDetails - */ -@Service("bankService") -public class BankServiceImpl implements BankService { - - - //Injecting properties of BankDAO - @Autowired - private BankDAO bankDao; - - /* - * BankService#createBank - * Desc: this method helps to create a new bank with default amount 0. - * - */ - @Override - public Bank createBank(Bank bank) throws BankException { - Bank bankData = null; - final BigDecimal amount = bank.getAmount(); - /*if (amount.compareTo(BigDecimal.ZERO) == -1) - throw new BankException("amount cannot be zero or less than zero"); - else {*/ - bankData = bankDao.save(bank); - return bankData; - } - - /* - *BankService#getBankDetails - *Desc : It will helps to get information about details of bank passing a Id of it. - *Exception : it will throw exception if Id not found. - */ - @Override - public Bank getBankDetails(Long bankId) throws BankException { - Optional bankList = bankDao.findById(bankId); - if (bankList.isPresent()) { - Bank bank = bankList.get(); - return bank; - } else - throw new BankException("Bank details not found"); - } -} diff --git a/bank/src/main/java/com/springboot/bank/service/CustomerService.java b/bank/src/main/java/com/springboot/bank/service/CustomerService.java deleted file mode 100644 index 8d490865..00000000 --- a/bank/src/main/java/com/springboot/bank/service/CustomerService.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Customer; - -/** - * @author Sumit - *@entity CustomerService - *Desc: It has 2 methods declared which helps to create customer and get customer details. - */ -public interface CustomerService { - - Customer createCustomer(WrapperBankCustomer wrapperBankCustomer) throws BankException; - - Customer getCustomerDetails(Long customerId) throws BankException; -} diff --git a/bank/src/main/java/com/springboot/bank/service/CustomerServiceImpl.java b/bank/src/main/java/com/springboot/bank/service/CustomerServiceImpl.java deleted file mode 100644 index 85382f46..00000000 --- a/bank/src/main/java/com/springboot/bank/service/CustomerServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.Optional; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Bank; -import com.springboot.bank.model.Customer; -import com.springboot.bank.repository.BankDAO; -import com.springboot.bank.repository.CustomerDAO; - -/** - * @author Sumit - *@Service("customerService") - *Desc: This class provide implementation for creating customer and - */ -@Service("customerService") -public class CustomerServiceImpl implements CustomerService { - - - - //injecting properties of CustomerDAO - @Autowired - CustomerDAO customerDao; - //injecting properties of BankDAO - @Autowired - BankDAO bankDao; - - /* - * CustomerService#createCustomer - * DESC: it will create a new customer having bankId associated with it. - * It calls save method to save he state of customer object into database. - */ - - - @Override - public Customer createCustomer(WrapperBankCustomer wrapperBankCustomer) throws BankException { - Customer customer = null; - Customer customerData = null; - customer = wrapperBankCustomer.getCustomer(); - // System.out.println(customer); - Long bankId = wrapperBankCustomer.getBankId(); - Optional bankList = bankDao.findById(bankId); - Bank bank = bankList.get(); - customer.setBank(bank); - customerData = customerDao.save(customer); - // System.out.println(customerData); - return customerData; - } - /* - * CustomerService#createCustomer - * DESC: it will show customer details having customerId associated with it. - * It calls findById method to find that entity by id and return the object to responce. - */ - @Override - public Customer getCustomerDetails(Long customerId) throws BankException { - Optional customerList = customerDao.findById(customerId); - if (customerList.isPresent()) { - Customer customer = customerList.get(); - return customer; - } else - throw new BankException("Bank details not found"); - } -} diff --git a/bank/src/main/java/com/springboot/bank/service/TransactionService.java b/bank/src/main/java/com/springboot/bank/service/TransactionService.java deleted file mode 100644 index 197cc772..00000000 --- a/bank/src/main/java/com/springboot/bank/service/TransactionService.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.Optional; -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Transaction; - -/** - * @author Sumit - *this interface has 2 methods which create a statements for an Customer - *and generate a report for statements - */ -public interface TransactionService { - - String createTransaction(Transaction transaction) throws BankException; - - Optional getTransactionDetails( Long customerId) throws BankException; -} diff --git a/bank/src/main/java/com/springboot/bank/service/TransactionServiceImpl.java b/bank/src/main/java/com/springboot/bank/service/TransactionServiceImpl.java deleted file mode 100644 index f061ed16..00000000 --- a/bank/src/main/java/com/springboot/bank/service/TransactionServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - */ -package com.springboot.bank.service; - -import java.util.Optional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.springboot.bank.exception.BankException; -import com.springboot.bank.model.Account; -import com.springboot.bank.model.Customer; -import com.springboot.bank.model.Transaction; -import com.springboot.bank.repository.CustomerDAO; -import com.springboot.bank.repository.TransactionDAO; - -/** - * @author Sumit - * - */ -@Service("transactionService") -public class TransactionServiceImpl implements TransactionService { - - //Injecting properties of TransactionDAO - @Autowired - private TransactionDAO transactionDao; - //Injecting properties of CustomerDAO - @Autowired - private CustomerDAO customerdao; - - /* - * - *TransactionService#createTransaction - * DESC: it will create a statement for a account of a customer - * which contain typeOfPayment,AMount etc. - * Exception: It throws exception if user enter acoount id or customr ID 0. - */ - @Override - public String createTransaction(Transaction transaction) throws BankException { - - Customer customer = transaction.getCustomer(); - Long customerId = customer.getCustomerId(); - Account account = transaction.getAccount(); - Long accountId = account.getAccountId(); - - if (accountId == 0) { - throw new BankException("accountId cannot be 0"); - } else if (customerId == 0) { - throw new BankException("customerId cannot be 0"); - } else { - transactionDao.save(transaction); - return "Transaction details added successfully"; - } - } - - - /* - * - *TransactionService#getTransactionDetails - * DESC: it will get details statement for a account of a customer - * which contain typeOfPayment,AMount etc. - */ - - @Override - public Optional getTransactionDetails(Long customerId) throws BankException { - - if (customerId == 0) { - throw new BankException("customerId cannot be 0"); - } else { - Optional transactionList = transactionDao.findById(customerId); - return transactionList; - } - } -} diff --git a/bank/src/main/resources/application.properties b/bank/src/main/resources/application.properties deleted file mode 100644 index 91dd5aff..00000000 --- a/bank/src/main/resources/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.datasource.url= jdbc:mysql://localhost:3306/mybank -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -logging.level.root=info - diff --git a/bank/src/test/java/com/springboot/bank/BankApplicationTests.java b/bank/src/test/java/com/springboot/bank/BankApplicationTests.java deleted file mode 100644 index 3bccdd00..00000000 --- a/bank/src/test/java/com/springboot/bank/BankApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.springboot.bank; - -import static org.mockito.Mockito.mock; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import com.springboot.bank.service.AccountService; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class BankApplicationTests { - - AccountService accountServiceMock = mock(AccountService.class); - - -} diff --git a/bank/src/test/java/com/springboot/bank/CustomerServiceTest.java b/bank/src/test/java/com/springboot/bank/CustomerServiceTest.java deleted file mode 100644 index 1d754acc..00000000 --- a/bank/src/test/java/com/springboot/bank/CustomerServiceTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package com.springboot.bank; - -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import com.springboot.bank.dto.WrapperBankCustomer; -import com.springboot.bank.model.Customer; -import com.springboot.bank.repository.CustomerDAO; -import com.springboot.bank.service.CustomerService; - -/** - * @author Sumit - * - */ -public class CustomerServiceTest { - - @Mock - private CustomerDAO daoMock; - - @InjectMocks - private CustomerService service; - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - @Test - public void testAddCustomer_returnsNewCustomer() { - - - } - -} \ No newline at end of file diff --git a/bank/target/classes/META-INF/MANIFEST.MF b/bank/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index 3bf6f1fb..00000000 --- a/bank/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Implementation-Title: MyBankDemo -Implementation-Version: 0.0.1-SNAPSHOT -Built-By: Ram -Implementation-Vendor-Id: com.springboot -Build-Jdk: 1.8.0_171 -Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo - ot-starter-parent/bank -Created-By: Maven Integration for Eclipse - diff --git a/bank/target/classes/META-INF/maven/com.springboot/bank/pom.properties b/bank/target/classes/META-INF/maven/com.springboot/bank/pom.properties deleted file mode 100644 index ad067d4b..00000000 --- a/bank/target/classes/META-INF/maven/com.springboot/bank/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Mon May 21 23:16:57 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.springboot -m2e.projectName=bank -m2e.projectLocation=C\:\\Users\\Ram\\Desktop\\bank -artifactId=bank diff --git a/bank/target/classes/META-INF/maven/com.springboot/bank/pom.xml b/bank/target/classes/META-INF/maven/com.springboot/bank/pom.xml deleted file mode 100644 index d09d388b..00000000 --- a/bank/target/classes/META-INF/maven/com.springboot/bank/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - 4.0.0 - - com.springboot - bank - 0.0.1-SNAPSHOT - jar - - MyBankDemo - project for Bank Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - mysql - mysql-connector-java - - - - log4j - log4j - 1.2.17 - - - - org.mockito - mockito-all - 1.9.5 - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/bank/target/classes/application.properties b/bank/target/classes/application.properties deleted file mode 100644 index 91dd5aff..00000000 --- a/bank/target/classes/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.datasource.url= jdbc:mysql://localhost:3306/mybank -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -logging.level.root=info - diff --git a/bank/target/classes/com/springboot/bank/BankApplication.class b/bank/target/classes/com/springboot/bank/BankApplication.class deleted file mode 100644 index ab7e0187..00000000 Binary files a/bank/target/classes/com/springboot/bank/BankApplication.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/controller/ATMController.class b/bank/target/classes/com/springboot/bank/controller/ATMController.class deleted file mode 100644 index 1eaa0cfe..00000000 Binary files a/bank/target/classes/com/springboot/bank/controller/ATMController.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/controller/AccountController.class b/bank/target/classes/com/springboot/bank/controller/AccountController.class deleted file mode 100644 index 3d0938c4..00000000 Binary files a/bank/target/classes/com/springboot/bank/controller/AccountController.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/controller/BankController.class b/bank/target/classes/com/springboot/bank/controller/BankController.class deleted file mode 100644 index 9594887b..00000000 Binary files a/bank/target/classes/com/springboot/bank/controller/BankController.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/controller/BankDenominationController.class b/bank/target/classes/com/springboot/bank/controller/BankDenominationController.class deleted file mode 100644 index 1a408959..00000000 Binary files a/bank/target/classes/com/springboot/bank/controller/BankDenominationController.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/controller/CustomerController.class b/bank/target/classes/com/springboot/bank/controller/CustomerController.class deleted file mode 100644 index 6f437e5c..00000000 Binary files a/bank/target/classes/com/springboot/bank/controller/CustomerController.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/controller/TransactionController.class b/bank/target/classes/com/springboot/bank/controller/TransactionController.class deleted file mode 100644 index fc5f5c88..00000000 Binary files a/bank/target/classes/com/springboot/bank/controller/TransactionController.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/ATMDetails.class b/bank/target/classes/com/springboot/bank/dto/ATMDetails.class deleted file mode 100644 index a4b60d61..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/ATMDetails.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/AccountDetails.class b/bank/target/classes/com/springboot/bank/dto/AccountDetails.class deleted file mode 100644 index 0126af32..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/AccountDetails.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/WrapperATMDenomination.class b/bank/target/classes/com/springboot/bank/dto/WrapperATMDenomination.class deleted file mode 100644 index 05e26372..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/WrapperATMDenomination.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/WrapperAccountDenomination.class b/bank/target/classes/com/springboot/bank/dto/WrapperAccountDenomination.class deleted file mode 100644 index b764f297..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/WrapperAccountDenomination.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/WrapperBankATM.class b/bank/target/classes/com/springboot/bank/dto/WrapperBankATM.class deleted file mode 100644 index 17d497fd..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/WrapperBankATM.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/WrapperBankCustomer.class b/bank/target/classes/com/springboot/bank/dto/WrapperBankCustomer.class deleted file mode 100644 index d5e2f9ad..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/WrapperBankCustomer.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/WrapperBankCustomerAccount.class b/bank/target/classes/com/springboot/bank/dto/WrapperBankCustomerAccount.class deleted file mode 100644 index 30646c54..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/WrapperBankCustomerAccount.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/dto/WrapperBankDenomination.class b/bank/target/classes/com/springboot/bank/dto/WrapperBankDenomination.class deleted file mode 100644 index dcabeb15..00000000 Binary files a/bank/target/classes/com/springboot/bank/dto/WrapperBankDenomination.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/exception/BankException.class b/bank/target/classes/com/springboot/bank/exception/BankException.class deleted file mode 100644 index bc0fb220..00000000 Binary files a/bank/target/classes/com/springboot/bank/exception/BankException.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/model/ATM.class b/bank/target/classes/com/springboot/bank/model/ATM.class deleted file mode 100644 index 4d15c9d3..00000000 Binary files a/bank/target/classes/com/springboot/bank/model/ATM.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/model/Account.class b/bank/target/classes/com/springboot/bank/model/Account.class deleted file mode 100644 index 7d02340c..00000000 Binary files a/bank/target/classes/com/springboot/bank/model/Account.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/model/Bank.class b/bank/target/classes/com/springboot/bank/model/Bank.class deleted file mode 100644 index 398e6d87..00000000 Binary files a/bank/target/classes/com/springboot/bank/model/Bank.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/model/BankDenomination.class b/bank/target/classes/com/springboot/bank/model/BankDenomination.class deleted file mode 100644 index f1a46277..00000000 Binary files a/bank/target/classes/com/springboot/bank/model/BankDenomination.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/model/Customer.class b/bank/target/classes/com/springboot/bank/model/Customer.class deleted file mode 100644 index 5dfefaa9..00000000 Binary files a/bank/target/classes/com/springboot/bank/model/Customer.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/model/Transaction.class b/bank/target/classes/com/springboot/bank/model/Transaction.class deleted file mode 100644 index fd16e723..00000000 Binary files a/bank/target/classes/com/springboot/bank/model/Transaction.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/repository/ATMDAO.class b/bank/target/classes/com/springboot/bank/repository/ATMDAO.class deleted file mode 100644 index 6326d873..00000000 Binary files a/bank/target/classes/com/springboot/bank/repository/ATMDAO.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/repository/AccountDAO.class b/bank/target/classes/com/springboot/bank/repository/AccountDAO.class deleted file mode 100644 index 1f516ff9..00000000 Binary files a/bank/target/classes/com/springboot/bank/repository/AccountDAO.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/repository/BankDAO.class b/bank/target/classes/com/springboot/bank/repository/BankDAO.class deleted file mode 100644 index de6da26a..00000000 Binary files a/bank/target/classes/com/springboot/bank/repository/BankDAO.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/repository/BankDenominationDAO.class b/bank/target/classes/com/springboot/bank/repository/BankDenominationDAO.class deleted file mode 100644 index 0c669220..00000000 Binary files a/bank/target/classes/com/springboot/bank/repository/BankDenominationDAO.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/repository/CustomerDAO.class b/bank/target/classes/com/springboot/bank/repository/CustomerDAO.class deleted file mode 100644 index 9d4b7691..00000000 Binary files a/bank/target/classes/com/springboot/bank/repository/CustomerDAO.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/repository/TransactionDAO.class b/bank/target/classes/com/springboot/bank/repository/TransactionDAO.class deleted file mode 100644 index 0162a54e..00000000 Binary files a/bank/target/classes/com/springboot/bank/repository/TransactionDAO.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/ATMService.class b/bank/target/classes/com/springboot/bank/service/ATMService.class deleted file mode 100644 index b87803fe..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/ATMService.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/ATMServiceImpl.class b/bank/target/classes/com/springboot/bank/service/ATMServiceImpl.class deleted file mode 100644 index 8033e254..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/ATMServiceImpl.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/AccountService.class b/bank/target/classes/com/springboot/bank/service/AccountService.class deleted file mode 100644 index 9a9f3041..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/AccountService.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/AccountServiceImpl.class b/bank/target/classes/com/springboot/bank/service/AccountServiceImpl.class deleted file mode 100644 index 1a4ce626..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/AccountServiceImpl.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/BankDenominationService.class b/bank/target/classes/com/springboot/bank/service/BankDenominationService.class deleted file mode 100644 index 3342e6f1..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/BankDenominationService.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/BankDenominationServiceImpl.class b/bank/target/classes/com/springboot/bank/service/BankDenominationServiceImpl.class deleted file mode 100644 index 315778a5..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/BankDenominationServiceImpl.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/BankService.class b/bank/target/classes/com/springboot/bank/service/BankService.class deleted file mode 100644 index 90716f05..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/BankService.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/BankServiceImpl.class b/bank/target/classes/com/springboot/bank/service/BankServiceImpl.class deleted file mode 100644 index 723b10ed..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/BankServiceImpl.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/CustomerService.class b/bank/target/classes/com/springboot/bank/service/CustomerService.class deleted file mode 100644 index a5be7366..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/CustomerService.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/CustomerServiceImpl.class b/bank/target/classes/com/springboot/bank/service/CustomerServiceImpl.class deleted file mode 100644 index 396693fb..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/CustomerServiceImpl.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/TransactionService.class b/bank/target/classes/com/springboot/bank/service/TransactionService.class deleted file mode 100644 index 51667e7e..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/TransactionService.class and /dev/null differ diff --git a/bank/target/classes/com/springboot/bank/service/TransactionServiceImpl.class b/bank/target/classes/com/springboot/bank/service/TransactionServiceImpl.class deleted file mode 100644 index f62346d2..00000000 Binary files a/bank/target/classes/com/springboot/bank/service/TransactionServiceImpl.class and /dev/null differ diff --git a/bank/target/test-classes/com/springboot/bank/BankApplicationTests.class b/bank/target/test-classes/com/springboot/bank/BankApplicationTests.class deleted file mode 100644 index faca8cfd..00000000 Binary files a/bank/target/test-classes/com/springboot/bank/BankApplicationTests.class and /dev/null differ diff --git a/bank/target/test-classes/com/springboot/bank/CustomerServiceTest.class b/bank/target/test-classes/com/springboot/bank/CustomerServiceTest.class deleted file mode 100644 index 83775688..00000000 Binary files a/bank/target/test-classes/com/springboot/bank/CustomerServiceTest.class and /dev/null differ diff --git a/demoCommon/.classpath b/demoCommon/.classpath deleted file mode 100644 index 9ae7bca0..00000000 --- a/demoCommon/.classpath +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demoCommon/.project b/demoCommon/.project deleted file mode 100644 index f3900a66..00000000 --- a/demoCommon/.project +++ /dev/null @@ -1,37 +0,0 @@ - - - demoCommon - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - - diff --git a/demoCommon/.settings/.jsdtscope b/demoCommon/.settings/.jsdtscope deleted file mode 100644 index 24181231..00000000 --- a/demoCommon/.settings/.jsdtscope +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/demoCommon/.settings/org.eclipse.jdt.core.prefs b/demoCommon/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 45a6e0e0..00000000 --- a/demoCommon/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/demoCommon/.settings/org.eclipse.m2e.core.prefs b/demoCommon/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/demoCommon/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/demoCommon/.settings/org.eclipse.wst.common.component b/demoCommon/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 6ce3563c..00000000 --- a/demoCommon/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/demoCommon/.settings/org.eclipse.wst.common.project.facet.core.xml b/demoCommon/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index d74c55e0..00000000 --- a/demoCommon/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.container b/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 3bd5d0a4..00000000 --- a/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.name b/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 05bd71b6..00000000 --- a/demoCommon/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Window \ No newline at end of file diff --git a/demoCommon/.settings/org.eclipse.wst.validation.prefs b/demoCommon/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 04cad8cb..00000000 --- a/demoCommon/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/demoCommon/pom.xml b/demoCommon/pom.xml deleted file mode 100644 index e7ea0b5f..00000000 --- a/demoCommon/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - com.example.common - demoCommon - jar - 0.0.1-SNAPSHOT - demoCommon Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - demoCommon - - diff --git a/demoCommon/src/main/java/com/example/commonDemo/TransactionNew.java b/demoCommon/src/main/java/com/example/commonDemo/TransactionNew.java deleted file mode 100644 index ccc60efd..00000000 --- a/demoCommon/src/main/java/com/example/commonDemo/TransactionNew.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * - */ -package com.example.commonDemo; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.logging.Level; -import java.util.logging.Logger; - - - - -/** - * @author trainee - * - */ - -public class TransactionNew implements Serializable{ - - /** - * - */ - private static final long serialVersionUID = -7197575110101065396L; - int transactionId; - int customerId; - int accountId; - int amount; - String transactionType; - - public TransactionNew() { - // TODO Auto-generated constructor stub - } - - public TransactionNew(int transactionId, int customerId, int accountId, int amount, String transactionType) { - super(); - this.transactionId = transactionId; - this.customerId = customerId; - this.accountId = accountId; - this.amount = amount; - this.transactionType = transactionType; - } - - - @Override - public String toString() { - return "TransactionNew [transactionId=" + transactionId + ", customerId=" + customerId + ", accountId=" - + accountId + ", amount=" + amount + ", transactionType=" + transactionType + "]"; - } - - public int getTransactionId() { - return transactionId; - } - - public void setTransactionId(int transactionId) { - this.transactionId = transactionId; - } - - public int getCustomerId() { - return customerId; - } - - public void setCustomerId(int customerId) { - this.customerId = customerId; - } - - public int getAccountId() { - return accountId; - } - - public void setAccountId(int accountId) { - this.accountId = accountId; - } - - public int getAmount() { - return amount; - } - - public void setAmount(int amount) { - this.amount = amount; - } - - public String getTransactionType() { - return transactionType; - } - - public void setTransactionType(String transactionType) { - this.transactionType = transactionType; - } - - public byte[] getBytes() { - byte[]bytes; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try{ - ObjectOutputStream oos = new ObjectOutputStream(baos); - oos.writeObject(this); - oos.flush(); - oos.reset(); - bytes = baos.toByteArray(); - oos.close(); - baos.close(); - } catch(IOException e){ - bytes = new byte[] {}; - Logger.getLogger("bsdlog").log(Level.ALL, "unable to write to output stream" + e); - } - return bytes; - } - - public static TransactionNew fromBytes(byte[] body) { - TransactionNew obj = null; - try { - ByteArrayInputStream bis = new ByteArrayInputStream(body); - ObjectInputStream ois = new ObjectInputStream(bis); - obj = (TransactionNew) ois.readObject(); - ois.close(); - bis.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - catch (ClassNotFoundException ex) { - ex.printStackTrace(); - } - return obj; - } - - -} - - diff --git a/demoCommon/src/main/webapp/WEB-INF/web.xml b/demoCommon/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 9f88c1f9..00000000 --- a/demoCommon/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Archetype Created Web Application - diff --git a/demoCommon/target/classes/META-INF/MANIFEST.MF b/demoCommon/target/classes/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/demoCommon/target/classes/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.properties b/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.properties deleted file mode 100644 index 1135b68d..00000000 --- a/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Thu Jun 07 12:58:15 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.example.common -m2e.projectName=demoCommon -m2e.projectLocation=C\:\\Users\\trainee\\Documents\\workspace-sts-3.9.4.RELEASE\\demoCommon -artifactId=demoCommon diff --git a/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.xml b/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.xml deleted file mode 100644 index e7ea0b5f..00000000 --- a/demoCommon/target/classes/META-INF/maven/com.example.common/demoCommon/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - com.example.common - demoCommon - jar - 0.0.1-SNAPSHOT - demoCommon Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - demoCommon - - diff --git a/demoCommon/target/classes/com/example/commonDemo/TransactionNew.class b/demoCommon/target/classes/com/example/commonDemo/TransactionNew.class deleted file mode 100644 index 45b67f73..00000000 Binary files a/demoCommon/target/classes/com/example/commonDemo/TransactionNew.class and /dev/null differ diff --git a/demoCommon/target/demoCommon.jar b/demoCommon/target/demoCommon.jar deleted file mode 100644 index 34c4b370..00000000 Binary files a/demoCommon/target/demoCommon.jar and /dev/null differ diff --git a/demoCommon/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF b/demoCommon/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF deleted file mode 100644 index d617fcce..00000000 --- a/demoCommon/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Built-By: trainee -Build-Jdk: 1.8.0_171 -Created-By: Maven Integration for Eclipse - diff --git a/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.properties b/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.properties deleted file mode 100644 index 543c4f4c..00000000 --- a/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Generated by Maven Integration for Eclipse -#Fri May 18 14:55:13 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.example.common -m2e.projectName=demoCommon -m2e.projectLocation=C\:\\Users\\trainee\\Documents\\workspace-sts-3.9.4.RELEASE\\demoCommon -artifactId=demoCommon diff --git a/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.xml b/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.xml deleted file mode 100644 index 02a624c5..00000000 --- a/demoCommon/target/m2e-wtp/web-resources/META-INF/maven/com.example.common/demoCommon/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - com.example.common - demoCommon - war - 0.0.1-SNAPSHOT - demoCommon Maven Webapp - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - - demoCommon - - diff --git a/demoCommon/target/maven-archiver/pom.properties b/demoCommon/target/maven-archiver/pom.properties deleted file mode 100644 index d1d33964..00000000 --- a/demoCommon/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Fri May 18 14:57:09 IST 2018 -version=0.0.1-SNAPSHOT -groupId=com.example.common -artifactId=demoCommon diff --git a/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index e69de29b..00000000 diff --git a/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index 58e7730d..00000000 --- a/demoCommon/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1 +0,0 @@ -C:\Users\trainee\Documents\workspace-sts-3.9.4.RELEASE\demoCommon\src\main\java\com\example\commonDemo\TransactionNew.java