Commit bd977b6d by Patryk Czarnik

Przenieniesienie definicji wyjątków z bazy do modelu

parent a6dab807
...@@ -6,6 +6,8 @@ import java.sql.SQLException; ...@@ -6,6 +6,8 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Customer; import sklep.model.Customer;
public class CustomerDAO { public class CustomerDAO {
......
...@@ -5,6 +5,8 @@ import java.sql.DriverManager; ...@@ -5,6 +5,8 @@ import java.sql.DriverManager;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Properties; import java.util.Properties;
import sklep.exn.DBException;
public class DBConnection implements AutoCloseable { public class DBConnection implements AutoCloseable {
private Connection sqlConnection; private Connection sqlConnection;
......
...@@ -6,6 +6,8 @@ import java.io.IOException; ...@@ -6,6 +6,8 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import sklep.exn.DBException;
public class DBSettings { public class DBSettings {
public static final String DB_SETTINGS_SYSTEM_PROPERTY = "sklep.db_settings_location"; public static final String DB_SETTINGS_SYSTEM_PROPERTY = "sklep.db_settings_location";
private static final String INTERNAL_DEFAULT_PROPERTIES = "/sklep.properties"; private static final String INTERNAL_DEFAULT_PROPERTIES = "/sklep.properties";
......
...@@ -6,6 +6,8 @@ import java.sql.SQLException; ...@@ -6,6 +6,8 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Order; import sklep.model.Order;
import sklep.model.OrderProduct; import sklep.model.OrderProduct;
......
...@@ -7,6 +7,8 @@ import java.sql.SQLException; ...@@ -7,6 +7,8 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
/* DAO - Data Access Object(s) /* DAO - Data Access Object(s)
......
...@@ -2,6 +2,7 @@ package sklep.db; ...@@ -2,6 +2,7 @@ package sklep.db;
import java.util.List; import java.util.List;
import sklep.exn.DBException;
import sklep.model.Product; import sklep.model.Product;
public class ZwyklyOdczyt_DAO { public class ZwyklyOdczyt_DAO {
......
package sklep.db; package sklep.exn;
public class DBException extends SklepException { public class DBException extends SklepException {
......
package sklep.db; package sklep.exn;
public class RecordNotFound extends SklepException { public class RecordNotFound extends SklepException {
......
package sklep.db; package sklep.exn;
public class SklepException extends Exception { public class SklepException extends Exception {
......
...@@ -9,9 +9,9 @@ import java.nio.file.Paths; ...@@ -9,9 +9,9 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import sklep.db.DBException;
import sklep.db.DBSettings; import sklep.db.DBSettings;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
public class PhotoUtil { public class PhotoUtil {
......
...@@ -15,8 +15,8 @@ import jakarta.ws.rs.core.Response; ...@@ -15,8 +15,8 @@ import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriBuilder;
import sklep.db.CustomerDAO; import sklep.db.CustomerDAO;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException; import sklep.exn.DBException;
import sklep.db.RecordNotFound; import sklep.exn.RecordNotFound;
import sklep.model.Customer; import sklep.model.Customer;
@Path("/customers") @Path("/customers")
......
...@@ -5,9 +5,9 @@ import jakarta.ws.rs.Path; ...@@ -5,9 +5,9 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
@Path("/products.html") @Path("/products.html")
......
...@@ -12,9 +12,9 @@ import jakarta.ws.rs.core.Response; ...@@ -12,9 +12,9 @@ import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status; import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriBuilder;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.OrderDAO; import sklep.db.OrderDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Order; import sklep.model.Order;
@Path("/orders") @Path("/orders")
......
...@@ -15,9 +15,9 @@ import jakarta.ws.rs.Produces; ...@@ -15,9 +15,9 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriBuilder;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
import sklep.model.ProductList; import sklep.model.ProductList;
......
...@@ -12,9 +12,9 @@ import jakarta.ws.rs.Path; ...@@ -12,9 +12,9 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
@Path("/products.json") @Path("/products.json")
......
...@@ -5,9 +5,9 @@ import jakarta.ws.rs.Path; ...@@ -5,9 +5,9 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
import sklep.model.ProductList; import sklep.model.ProductList;
......
...@@ -9,9 +9,9 @@ import jakarta.ws.rs.Path; ...@@ -9,9 +9,9 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces; import jakarta.ws.rs.Produces;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Price; import sklep.model.Price;
import sklep.model.Product; import sklep.model.Product;
import sklep.model.ProductList; import sklep.model.ProductList;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>wielomodulowy-baza</artifactId> <artifactId>wielomodulowy-model</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -6,8 +6,8 @@ import java.util.List; ...@@ -6,8 +6,8 @@ import java.util.List;
import jakarta.jws.WebParam; import jakarta.jws.WebParam;
import jakarta.jws.WebResult; import jakarta.jws.WebResult;
import jakarta.jws.WebService; import jakarta.jws.WebService;
import sklep.db.DBException; import sklep.exn.DBException;
import sklep.db.RecordNotFound; import sklep.exn.RecordNotFound;
import sklep.model.Customer; import sklep.model.Customer;
import sklep.model.Order; import sklep.model.Order;
import sklep.model.Product; import sklep.model.Product;
......
...@@ -2,7 +2,7 @@ package sklep.klient; ...@@ -2,7 +2,7 @@ package sklep.klient;
import java.util.List; import java.util.List;
import sklep.db.DBException; import sklep.exn.DBException;
import sklep.model.Product; import sklep.model.Product;
import sklep.soap.Sklep; import sklep.soap.Sklep;
......
...@@ -2,8 +2,8 @@ package sklep.klient; ...@@ -2,8 +2,8 @@ package sklep.klient;
import java.util.Scanner; import java.util.Scanner;
import sklep.db.DBException; import sklep.exn.DBException;
import sklep.db.RecordNotFound; import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
import sklep.soap.Sklep; import sklep.soap.Sklep;
......
...@@ -4,8 +4,8 @@ import java.math.BigDecimal; ...@@ -4,8 +4,8 @@ import java.math.BigDecimal;
import java.util.Locale; import java.util.Locale;
import java.util.Scanner; import java.util.Scanner;
import sklep.db.DBException; import sklep.exn.DBException;
import sklep.db.RecordNotFound; import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
import sklep.soap.Sklep; import sklep.soap.Sklep;
......
...@@ -19,8 +19,8 @@ import javax.swing.SwingWorker; ...@@ -19,8 +19,8 @@ import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import sklep.db.DBException; import sklep.exn.DBException;
import sklep.db.RecordNotFound; import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
import sklep.soap.Sklep; import sklep.soap.Sklep;
......
...@@ -9,9 +9,9 @@ import java.nio.file.Paths; ...@@ -9,9 +9,9 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import sklep.db.DBException;
import sklep.db.DBSettings; import sklep.db.DBSettings;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
public class PhotoUtil { public class PhotoUtil {
......
...@@ -7,10 +7,10 @@ import jakarta.jws.WebService; ...@@ -7,10 +7,10 @@ import jakarta.jws.WebService;
import jakarta.xml.ws.soap.MTOM; import jakarta.xml.ws.soap.MTOM;
import sklep.db.CustomerDAO; import sklep.db.CustomerDAO;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.OrderDAO; import sklep.db.OrderDAO;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Customer; import sklep.model.Customer;
import sklep.model.Order; import sklep.model.Order;
import sklep.model.Product; import sklep.model.Product;
......
...@@ -10,9 +10,9 @@ import jakarta.servlet.http.HttpServlet; ...@@ -10,9 +10,9 @@ import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
import sklep.model.Product; import sklep.model.Product;
@WebServlet("/edit") @WebServlet("/edit")
......
...@@ -8,7 +8,7 @@ import jakarta.servlet.annotation.WebServlet; ...@@ -8,7 +8,7 @@ import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import sklep.db.RecordNotFound; import sklep.exn.RecordNotFound;
@WebServlet("/photo") @WebServlet("/photo")
public class Photo extends HttpServlet { public class Photo extends HttpServlet {
......
...@@ -8,9 +8,9 @@ import java.nio.file.Path; ...@@ -8,9 +8,9 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import sklep.db.DBException;
import sklep.db.DBSettings; import sklep.db.DBSettings;
import sklep.db.RecordNotFound; import sklep.exn.DBException;
import sklep.exn.RecordNotFound;
public class PhotoUtil { public class PhotoUtil {
......
...@@ -4,8 +4,8 @@ import java.math.BigDecimal; ...@@ -4,8 +4,8 @@ import java.math.BigDecimal;
import java.util.List; import java.util.List;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.exn.DBException;
import sklep.model.Product; import sklep.model.Product;
/* Ta klasa jest po to, aby w skrypcie JSP w wygodny sposób odczytać sobie listę produktów z bazy danych. */ /* Ta klasa jest po to, aby w skrypcie JSP w wygodny sposób odczytać sobie listę produktów z bazy danych. */
......
...@@ -10,8 +10,8 @@ import jakarta.servlet.http.HttpServlet; ...@@ -10,8 +10,8 @@ import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.exn.DBException;
import sklep.model.Product; import sklep.model.Product;
@WebServlet("/products1") @WebServlet("/products1")
......
...@@ -10,8 +10,8 @@ import jakarta.servlet.http.HttpServlet; ...@@ -10,8 +10,8 @@ import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import sklep.db.DBConnection; import sklep.db.DBConnection;
import sklep.db.DBException;
import sklep.db.ProductDAO; import sklep.db.ProductDAO;
import sklep.exn.DBException;
import sklep.model.Product; import sklep.model.Product;
@WebServlet("/products2") @WebServlet("/products2")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment