Merge branch 'julian2' of Studium/Internet-Technologien into master
This commit is contained in:
commit
41dd15048a
@ -44,7 +44,7 @@
|
||||
<property name="allowNonPrintableEscapes" value="true"/>
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max" value="100"/>
|
||||
<property name="max" value="200"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="AvoidStarImport"/>
|
||||
@ -55,13 +55,14 @@
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||
</module>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="NeedBraces">
|
||||
<property name="tokens" value="LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlySame"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
|
||||
LITERAL_DO"/>
|
||||
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_DO, LITERAL_IF, LITERAL_ELSE"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
|
4
pom.xml
4
pom.xml
@ -212,6 +212,10 @@
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>3.1.9</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
|
@ -10,6 +10,8 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
|
||||
/**
|
||||
* config object.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -25,7 +27,10 @@ public class Configuration {
|
||||
private Database database;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gets Configuration object from file.
|
||||
* @return {@link de.hsel.itech.config.Configuration}
|
||||
*/
|
||||
public static Configuration get() {
|
||||
Gson gson = new Gson();
|
||||
|
||||
|
@ -5,6 +5,8 @@ import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* POJO for gson.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
|
@ -1,16 +1,27 @@
|
||||
package de.hsel.itech.db;
|
||||
|
||||
import de.hsel.itech.config.Configuration;
|
||||
import de.hsel.itech.db.pojo.Author;
|
||||
import de.hsel.itech.db.pojo.Book;
|
||||
import de.hsel.itech.db.pojo.Category;
|
||||
import de.hsel.itech.db.pojo.Publisher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.mariadb.jdbc.MariaDbPoolDataSource;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.sql.*;
|
||||
import java.time.Year;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* base class for everything regarding the database.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
@ -18,20 +29,64 @@ import java.sql.SQLException;
|
||||
*/
|
||||
public class Database {
|
||||
|
||||
private final String book = "book";
|
||||
private final String author = "author";
|
||||
private final String authorBook = "author_book";
|
||||
private final String publisher = "publisher";
|
||||
private final String category = "category";
|
||||
|
||||
private static Database instance;
|
||||
|
||||
/**
|
||||
* Singleton for database access.
|
||||
*
|
||||
* @return {@link Database}
|
||||
*/
|
||||
public static Database getInstance() {
|
||||
if (instance == null)
|
||||
instance = new Database();
|
||||
return instance;
|
||||
}
|
||||
|
||||
private MariaDbPoolDataSource dataSource;
|
||||
|
||||
public Database() {
|
||||
/**
|
||||
* initializes connection pool and executes database setup.
|
||||
*/
|
||||
private Database() {
|
||||
Configuration config = Configuration.get();
|
||||
dataSource = new MariaDbPoolDataSource("jdbc:mysql://" + config.getDatabase().getHostname() + ":" + config.getDatabase().getPort() + "/" + config.getDatabase().getDatabase());
|
||||
dataSource = new MariaDbPoolDataSource("jdbc:mysql://" + config.getDatabase().getHostname()
|
||||
+ ":" + config.getDatabase().getPort() + "/" + config.getDatabase().getDatabase() + "?useUnicode=true&characterEncoding=UTF-8");
|
||||
try {
|
||||
dataSource.setUser(config.getDatabase().getUsername());
|
||||
dataSource.setPassword(config.getDatabase().getPassword());
|
||||
dataSource.initialize();
|
||||
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
URL file = getClass().getClassLoader().getResource("database.sql");
|
||||
assert file != null;
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(file.getFile()))) {
|
||||
for (String line = br.readLine(); line != null; line = br.readLine()) {
|
||||
PreparedStatement statement = connection.prepareStatement(line);
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets connection from connection pool.
|
||||
*
|
||||
* @return {@link java.sql.Connection}
|
||||
*/
|
||||
@Nullable
|
||||
private Connection getConnection() {
|
||||
try {
|
||||
@ -42,28 +97,628 @@ public class Database {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getHello() {
|
||||
Connection connection = getConnection();
|
||||
/**
|
||||
* gets author by id.
|
||||
*
|
||||
* @param id ID from database
|
||||
* @return {@link de.hsel.itech.db.pojo.Author}
|
||||
*/
|
||||
@Nullable
|
||||
public Author getAuthor(long id) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSet(id, author);
|
||||
assert entry != null;
|
||||
|
||||
String hello = "";
|
||||
ResultSet rs = entry.getKey();
|
||||
Author author = null;
|
||||
try {
|
||||
assert connection != null;
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM test WHERE id = 1");
|
||||
author = new Author(rs.getLong("id"), rs.getString("name"));
|
||||
entry.getValue().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets author by name.
|
||||
*
|
||||
* @param name author name
|
||||
* @return {@link de.hsel.itech.db.pojo.Author}
|
||||
*/
|
||||
@Nullable
|
||||
public Author getAuthor(String name) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSets(author, "name", name);
|
||||
assert entry != null;
|
||||
assert entry.getKey() != null;
|
||||
|
||||
Author author = null;
|
||||
ResultSet rs = entry.getKey();
|
||||
try {
|
||||
if(rs.next())
|
||||
author = new Author(rs.getLong("id"), rs.getString("name"));
|
||||
entry.getValue().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets category by id.
|
||||
*
|
||||
* @param id ID from database
|
||||
* @return {@link de.hsel.itech.db.pojo.Category}
|
||||
*/
|
||||
@Nullable
|
||||
public Category getCategory(long id) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSet(id, category);
|
||||
assert entry != null;
|
||||
ResultSet rs = entry.getKey();
|
||||
|
||||
try {
|
||||
rs.beforeFirst();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return getCategory(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* get category by name.
|
||||
*
|
||||
* @param name category name
|
||||
* @return {@link de.hsel.itech.db.pojo.Category}
|
||||
*/
|
||||
@Nullable
|
||||
public Category getCategory(String name) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSets(category, "name", name);
|
||||
assert entry != null;
|
||||
|
||||
return getCategory(entry);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Category getCategory(@NotNull Map.Entry<ResultSet, Connection> entry) {
|
||||
ResultSet rs = entry.getKey();
|
||||
Category category = null;
|
||||
try{
|
||||
while(rs.next()) {
|
||||
category = new Category(rs.getLong("id"), rs.getString("name"), rs.getString("image"));
|
||||
}
|
||||
entry.getValue().close();
|
||||
}catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets publisher by id.
|
||||
*
|
||||
* @param id ID from database
|
||||
* @return {@link de.hsel.itech.db.pojo.Publisher}
|
||||
*/
|
||||
@Nullable
|
||||
public Publisher getPublisher(long id) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSet(id, publisher);
|
||||
assert entry != null;
|
||||
|
||||
ResultSet rs = entry.getKey();
|
||||
Publisher publisher = null;
|
||||
try {
|
||||
publisher = new Publisher(rs.getLong("id"), rs.getString("name"));
|
||||
entry.getValue().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return publisher;
|
||||
}
|
||||
|
||||
/**
|
||||
* get publisher by name.
|
||||
*
|
||||
* @param name publisher name
|
||||
* @return {@link de.hsel.itech.db.pojo.Publisher}
|
||||
*/
|
||||
@Nullable
|
||||
public Publisher getPublisher(String name) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSets(publisher, "name", name);
|
||||
assert entry != null;
|
||||
assert entry.getKey() != null;
|
||||
|
||||
Publisher publisher = null;
|
||||
ResultSet rs = entry.getKey();
|
||||
try {
|
||||
while(rs.next()) {
|
||||
publisher = new Publisher(rs.getLong("id"), rs.getString("name"));
|
||||
}
|
||||
entry.getValue().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return publisher;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets list of author ids from database.
|
||||
*
|
||||
* @param id book id from database
|
||||
* @return {@link java.util.List}
|
||||
*/
|
||||
@Nullable
|
||||
private List<Integer> getAuthors(long id) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSets(id, authorBook, book);
|
||||
assert entry != null;
|
||||
try {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
ResultSet rs = entry.getKey();
|
||||
while (rs.next()) {
|
||||
list.add(rs.getInt(author));
|
||||
}
|
||||
entry.getValue().close();
|
||||
return list;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets book by id.
|
||||
*
|
||||
* @param id ID from database
|
||||
* @return {@link de.hsel.itech.db.pojo.Book}
|
||||
*/
|
||||
@Nullable
|
||||
public Book getBook(long id) {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSet(id, book);
|
||||
assert entry != null;
|
||||
|
||||
|
||||
ResultSet rs = entry.getKey();
|
||||
Book book = null;
|
||||
try {
|
||||
Category category = getCategory(rs.getLong(this.category));
|
||||
Publisher publisher = getPublisher(rs.getLong(this.publisher));
|
||||
List<Integer> authorIds = getAuthors(id);
|
||||
assert category != null;
|
||||
assert publisher != null;
|
||||
assert authorIds != null;
|
||||
|
||||
List<Author> authors = new ArrayList<>();
|
||||
for (int i : authorIds) {
|
||||
Author author = getAuthor(i);
|
||||
assert author != null;
|
||||
authors.add(author);
|
||||
}
|
||||
book = new Book(rs.getLong("id"), rs.getLong("isbn"), authors, publisher, category, rs.getString("title"),
|
||||
Year.of(rs.getInt("year")), rs.getInt("price"), rs.getString("description"),
|
||||
rs.getString("image"));
|
||||
entry.getValue().close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return book;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets all books.
|
||||
*
|
||||
* @return {@link java.util.List}
|
||||
*/
|
||||
@Nullable
|
||||
public List<Book> getBooks() {
|
||||
Map.Entry<ResultSet, Connection> entry = getResultSets(book, "id");
|
||||
assert entry != null;
|
||||
|
||||
List<Long> ids = new ArrayList<>();
|
||||
try {
|
||||
ResultSet rs = entry.getKey();
|
||||
while (rs.next()) {
|
||||
ids.add(rs.getLong("id"));
|
||||
}
|
||||
entry.getValue().close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
List<Book> books = new ArrayList<>();
|
||||
for (long id : ids) {
|
||||
books.add(getBook(id));
|
||||
}
|
||||
return books;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets books by category.
|
||||
*
|
||||
* @param category category id
|
||||
* @return {@link java.util.List}
|
||||
*/
|
||||
@Nullable
|
||||
public List<Book> getBooks(long category) {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
List<Book> books = new ArrayList<>();
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT (id) FROM book WHERE category = ?");
|
||||
statement.setLong(1, category);
|
||||
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
resultSet.next();
|
||||
hello = resultSet.getString("hello");
|
||||
|
||||
while (resultSet.next()) {
|
||||
books.add(getBook(resultSet.getLong("id")));
|
||||
}
|
||||
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return books;
|
||||
}
|
||||
|
||||
return hello;
|
||||
|
||||
/**
|
||||
* get books by category.
|
||||
*
|
||||
* @param category Category object
|
||||
* @return {@link java.util.List}
|
||||
*/
|
||||
@Nullable
|
||||
public List<Book> getBooks(@NotNull Category category) {
|
||||
return getBooks(category.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts book into database.
|
||||
* authors, publishers, and category have to exist.
|
||||
*
|
||||
* @param book Book
|
||||
* @return insert count
|
||||
*/
|
||||
public int insert(@NotNull Book book) {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
int insertCount = 0;
|
||||
|
||||
//author exists ?
|
||||
List<Author> authors = new ArrayList<>();
|
||||
for (Author author : book.getAuthors()) {
|
||||
if (author.getId() == 0) {
|
||||
Author dbAuthor = getAuthor(author.getName());
|
||||
if (dbAuthor == null) {
|
||||
insertCount += insert(author);
|
||||
dbAuthor = getAuthor(author.getName());
|
||||
}
|
||||
authors.add(dbAuthor);
|
||||
}else authors.add(author);
|
||||
}
|
||||
|
||||
//publisher exists ?
|
||||
Publisher publisher;
|
||||
if(book.getPublisher().getId() == 0) {
|
||||
Publisher dbPublisher = getPublisher(book.getPublisher().getName());
|
||||
if(dbPublisher != null)
|
||||
publisher = dbPublisher;
|
||||
else {
|
||||
insertCount += insert(new Publisher(book.getPublisher().getName()));
|
||||
publisher = getPublisher(book.getPublisher().getName());
|
||||
}
|
||||
}else publisher = book.getPublisher();
|
||||
|
||||
//category exists ?
|
||||
Category category;
|
||||
if(book.getCategory().getId() == 0) {
|
||||
Category dbCategory = getCategory(book.getCategory().getName());
|
||||
if(dbCategory != null)
|
||||
category = dbCategory;
|
||||
else {
|
||||
insertCount += insert(new Category(book.getCategory().getName(), book.getCategory().getImage()));
|
||||
category = getCategory(book.getCategory().getName());
|
||||
}
|
||||
}else category = book.getCategory();
|
||||
|
||||
assert publisher != null;
|
||||
assert category != null;
|
||||
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO book(isbn, title, description, " +
|
||||
"price, year, publisher, category, image) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||
statement.setLong(1, book.getIsbn());
|
||||
statement.setString(2, book.getTitle());
|
||||
statement.setString(3, book.getDescription());
|
||||
statement.setInt(4, book.getPrice());
|
||||
statement.setInt(5, book.getYear().getValue());
|
||||
statement.setLong(6, publisher.getId());
|
||||
statement.setLong(7, category.getId());
|
||||
statement.setString(8, book.getImage());
|
||||
insertCount += statement.executeUpdate();
|
||||
ResultSet resultSet = statement.getGeneratedKeys();
|
||||
long lastId = -1;
|
||||
while(resultSet.next()) {
|
||||
lastId = resultSet.getLong("id");
|
||||
}
|
||||
|
||||
for (Author author : authors) {
|
||||
PreparedStatement authorStatement = connection.prepareStatement("INSERT INTO " + authorBook + " (author, book) VALUES (?, ?);");
|
||||
authorStatement.setLong(1, author.getId());
|
||||
authorStatement.setLong(2, lastId);
|
||||
insertCount += authorStatement.executeUpdate();
|
||||
}
|
||||
|
||||
connection.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return insertCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts Category into database.
|
||||
*
|
||||
* @param category Category
|
||||
* @return insert count
|
||||
*/
|
||||
public int insert(@NotNull Category category) {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
int insertCount = 0;
|
||||
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO category (name, image) VALUES (?, ?)");
|
||||
statement.setString(1, category.getName());
|
||||
statement.setString(2, category.getImage());
|
||||
insertCount += statement.executeUpdate();
|
||||
|
||||
connection.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return insertCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts Author.
|
||||
*
|
||||
* @param author Author
|
||||
* @return insert count
|
||||
*/
|
||||
public int insert(@NotNull Author author) {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
int insertCount = 0;
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO author (name) VALUES (?)");
|
||||
statement.setString(1, author.getName());
|
||||
|
||||
insertCount += statement.executeUpdate();
|
||||
|
||||
connection.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return insertCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts Publisher.
|
||||
*
|
||||
* @param publisher Publisher
|
||||
* @return insert count
|
||||
*/
|
||||
public int insert(@NotNull Publisher publisher) {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
int insertCount = 0;
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO publisher (name) VALUES (?)");
|
||||
statement.setString(1, publisher.getName());
|
||||
|
||||
insertCount += statement.executeUpdate();
|
||||
|
||||
connection.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return insertCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes book from database.
|
||||
*
|
||||
* @param id book id
|
||||
* @return deletion count
|
||||
*/
|
||||
public int deleteBook(long id) {
|
||||
int deleteCount = 0;
|
||||
|
||||
try {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
PreparedStatement statement = connection.prepareStatement("DELETE FROM author_book WHERE book = ?");
|
||||
statement.setLong(1, id);
|
||||
deleteCount = +statement.executeUpdate();
|
||||
|
||||
connection.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
deleteCount += delete(id, book);
|
||||
|
||||
return deleteCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes author from database.
|
||||
*
|
||||
* @param id author id
|
||||
* @return deletion count
|
||||
*/
|
||||
public int deleteAuthor(long id) {
|
||||
return delete(id, author);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes publisher from database.
|
||||
*
|
||||
* @param id publisher id
|
||||
* @return deletion count
|
||||
*/
|
||||
public int deletePublisher(long id) {
|
||||
return delete(id, publisher);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes category from database.
|
||||
*
|
||||
* @param id category count
|
||||
* @return deletion count
|
||||
*/
|
||||
public int deleteCategory(long id) {
|
||||
return delete(id, category);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deletes id from table.
|
||||
*
|
||||
* @param id database id
|
||||
* @param table table name
|
||||
* @return deletion count
|
||||
*/
|
||||
private int delete(long id, String table) {
|
||||
Connection connection = getConnection();
|
||||
assert connection != null;
|
||||
|
||||
int deleteCount = 0;
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("DELETE FROM " + table + " WHERE id=?");
|
||||
statement.setLong(1, id);
|
||||
|
||||
deleteCount = +statement.executeUpdate();
|
||||
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return deleteCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gets specific entry from database.
|
||||
*
|
||||
* @param id id from database
|
||||
* @param table table name
|
||||
* @return {@link java.util.Map.Entry}
|
||||
*/
|
||||
@Nullable
|
||||
private Map.Entry<ResultSet, Connection> getResultSet(long id, String table) {
|
||||
Connection connection = getConnection();
|
||||
try {
|
||||
assert connection != null;
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE id = ?");
|
||||
statement.setLong(1, id);
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
if (resultSet.next()) {
|
||||
return new AbstractMap.SimpleEntry<>(resultSet, connection);
|
||||
}
|
||||
return null;
|
||||
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets specific entries from table.
|
||||
*
|
||||
* @param id id all entries should reference
|
||||
* @param table table name
|
||||
* @param column column to match
|
||||
* @return {@link java.util.Map.Entry}
|
||||
*/
|
||||
@Nullable
|
||||
private Map.Entry<ResultSet, Connection> getResultSets(long id, @NotNull String table, @NotNull String column) {
|
||||
Connection connection = getConnection();
|
||||
try {
|
||||
assert connection != null;
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE " + column + " = ?");
|
||||
statement.setLong(1, id);
|
||||
|
||||
return getAllEntries(connection, statement);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets specific entries from table.
|
||||
*
|
||||
* @param table table name
|
||||
* @param column column to match
|
||||
* @return {@link java.util.Map.Entry}
|
||||
*/
|
||||
@Nullable
|
||||
private Map.Entry<ResultSet, Connection> getResultSets(@NotNull String table, @NotNull String column, @NotNull String value) {
|
||||
Connection connection = getConnection();
|
||||
try {
|
||||
assert connection != null;
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE " + column + " = ?");
|
||||
statement.setString(1, value);
|
||||
|
||||
return getAllEntries(connection, statement);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets all specified columns from table.
|
||||
*
|
||||
* @param table table name
|
||||
* @param columns columns as String array
|
||||
* @return {@link java.util.Map.Entry}
|
||||
*/
|
||||
@Nullable
|
||||
private Map.Entry<ResultSet, Connection> getResultSets(@NotNull String table, @NotNull String... columns) {
|
||||
Connection connection = getConnection();
|
||||
try {
|
||||
assert connection != null;
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT (" + String.join(",", columns) + ") FROM " + table);
|
||||
|
||||
return getAllEntries(connection, statement);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets all entries contained in result set.
|
||||
*
|
||||
* @param connection Connection
|
||||
* @param statement query statement
|
||||
* @return {@link java.util.Map.Entry}
|
||||
*/
|
||||
@Nullable
|
||||
private Map.Entry<ResultSet, Connection> getAllEntries(@NotNull Connection connection, @NotNull PreparedStatement statement) {
|
||||
try {
|
||||
ResultSet resultSet = statement.executeQuery();
|
||||
return new AbstractMap.SimpleEntry<>(resultSet, connection);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for Address.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,13 +15,14 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class Address {
|
||||
|
||||
private Customer customer;
|
||||
@NonNull private Customer customer;
|
||||
private long id;
|
||||
private String name;
|
||||
private String street;
|
||||
private String number;
|
||||
private int zipCode;
|
||||
private String city;
|
||||
@NonNull private String name;
|
||||
@NonNull private String street;
|
||||
@NonNull private String number;
|
||||
@NonNull private int zipCode;
|
||||
@NonNull private String city;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for Author.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,9 +15,10 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class Author {
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
@NonNull private String name;
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,15 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.time.Year;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* POJO for Book.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -13,21 +18,23 @@ import java.time.Year;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class Book {
|
||||
|
||||
private int isbn;
|
||||
private Author author;
|
||||
private Publisher publisher;
|
||||
private Category category;
|
||||
private String title;
|
||||
private Year year;
|
||||
private long id;
|
||||
@NonNull private long isbn;
|
||||
@NonNull private List<Author> authors;
|
||||
@NonNull private Publisher publisher;
|
||||
@NonNull private Category category;
|
||||
@NonNull private String title;
|
||||
@NonNull private Year year;
|
||||
|
||||
/**
|
||||
* saved in cents
|
||||
* saved in cents.
|
||||
*/
|
||||
private int price;
|
||||
private String description;
|
||||
private String image;
|
||||
@NonNull private int price;
|
||||
@NonNull private String description;
|
||||
@NonNull private String image;
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* POJO for Category.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,9 +12,16 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Category {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private long id;
|
||||
@NonNull private String name;
|
||||
private String image;
|
||||
|
||||
public Category(String name, String image) {
|
||||
this.name = name;
|
||||
this.image = image;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,14 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* POJO for CreditCard Payment.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -13,12 +17,13 @@ import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class CreditCardPayment {
|
||||
|
||||
private long id;
|
||||
private Customer customer;
|
||||
private int number;
|
||||
private String owner;
|
||||
private LocalDate expiration;
|
||||
private int checksum;
|
||||
@NonNull private Customer customer;
|
||||
@NonNull private int number;
|
||||
@NonNull private String owner;
|
||||
@NonNull private LocalDate expiration;
|
||||
@NonNull private int checksum;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for Customer.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,11 +15,12 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class Customer {
|
||||
|
||||
private long id;
|
||||
private String email;
|
||||
private String name;
|
||||
private String password;
|
||||
private boolean admin;
|
||||
@NonNull private String email;
|
||||
@NonNull private String name;
|
||||
@NonNull private String password;
|
||||
@NonNull private boolean admin;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for DebitCard Payment.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,11 +15,12 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class DebitCardPayment {
|
||||
|
||||
private long id;
|
||||
private Customer customer;
|
||||
private String iban;
|
||||
private String bic;
|
||||
private String owner;
|
||||
@NonNull private Customer customer;
|
||||
@NonNull private String iban;
|
||||
@NonNull private String bic;
|
||||
@NonNull private String owner;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for Invoice Payment.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,8 +15,9 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class InvoicePayment {
|
||||
|
||||
private long id;
|
||||
private Customer customer;
|
||||
@NonNull private Customer customer;
|
||||
}
|
@ -2,11 +2,15 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* POJO for Orders.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -14,16 +18,17 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class Order {
|
||||
|
||||
private long id;
|
||||
private LocalDateTime date;
|
||||
private Book book;
|
||||
@NonNull private LocalDateTime date;
|
||||
@NonNull private Book book;
|
||||
|
||||
/**
|
||||
* price in cents
|
||||
* price in cents.
|
||||
*/
|
||||
private int price;
|
||||
private PaymentType paymentType;
|
||||
private Address address;
|
||||
@NonNull private int price;
|
||||
@NonNull private PaymentType paymentType;
|
||||
@NonNull private Address address;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for PayPal Payment.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,10 +15,11 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class PayPalPayment {
|
||||
|
||||
private long id;
|
||||
private Customer customer;
|
||||
private String email;
|
||||
private String authCode;
|
||||
@NonNull private Customer customer;
|
||||
@NonNull private String email;
|
||||
@NonNull private String authCode;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for PaymentType.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,8 +15,9 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class PaymentType {
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
@NonNull private String name;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for Publisher.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,8 +15,9 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class Publisher {
|
||||
|
||||
private long id;
|
||||
private String name;
|
||||
@NonNull private String name;
|
||||
}
|
@ -2,8 +2,12 @@ package de.hsel.itech.db.pojo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for Shopping Cart.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
@ -11,10 +15,11 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class ShoppingCart {
|
||||
|
||||
private long id;
|
||||
private Customer customer;
|
||||
private Book article;
|
||||
private int count;
|
||||
@NonNull private Customer customer;
|
||||
@NonNull private Book article;
|
||||
@NonNull private int count;
|
||||
}
|
50
src/main/java/de/hsel/itech/servlet/AddBook.java
Normal file
50
src/main/java/de/hsel/itech/servlet/AddBook.java
Normal file
@ -0,0 +1,50 @@
|
||||
package de.hsel.itech.servlet;
|
||||
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Servlet: form to add a book to the database
|
||||
*
|
||||
*
|
||||
* @author Julian Hinxlage
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
*/
|
||||
|
||||
@WebServlet("/addbook")
|
||||
public class AddBook extends HttpServlet {
|
||||
|
||||
|
||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
||||
throws IOException {
|
||||
|
||||
resp.setCharacterEncoding("utf-8");
|
||||
PrintWriter out = resp.getWriter();
|
||||
|
||||
Utillity.insertFile(out, "template_head.html");
|
||||
|
||||
out.println("<form class=\"m-container\" action=\"booklist\" method=post>");
|
||||
Utillity.addValidationInput(out, "ISBN", "isbn", "text", "0", "[0-9]*");
|
||||
Utillity.addInput(out,"Titel", "title");
|
||||
Utillity.addInput(out,"Author", "author");
|
||||
Utillity.addValidationInput(out,"Preis", "price", "text", "0", "[0-9]*(,[0-9]{1,2})?");
|
||||
Utillity.addValidationInput(out,"Jahr", "year", "text", "2019", "[0-9]*");
|
||||
Utillity.addInput(out,"Beschreibung", "description");
|
||||
Utillity.addInput(out,"Verlag", "publisher");
|
||||
Utillity.addInput(out,"Kategorie", "category");
|
||||
Utillity.addInput(out,"Bild", "image", "DxAzOKSiPoE");
|
||||
Utillity.addSubmitButton(out, "Hinzufügen");
|
||||
out.println("</form>");
|
||||
|
||||
|
||||
Utillity.addButton(out,"Zurück zur Buchliste", "booklist");
|
||||
|
||||
Utillity.insertFile(out, "template_footer.html");
|
||||
}
|
||||
|
||||
}
|
186
src/main/java/de/hsel/itech/servlet/BookList.java
Normal file
186
src/main/java/de/hsel/itech/servlet/BookList.java
Normal file
@ -0,0 +1,186 @@
|
||||
package de.hsel.itech.servlet;
|
||||
|
||||
import de.hsel.itech.db.Database;
|
||||
import de.hsel.itech.db.pojo.Author;
|
||||
import de.hsel.itech.db.pojo.Book;
|
||||
import de.hsel.itech.db.pojo.Category;
|
||||
import de.hsel.itech.db.pojo.Publisher;
|
||||
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Year;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Servlet: list of all books and remove function
|
||||
*
|
||||
*
|
||||
* @author Julian Hinxlage
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
*/
|
||||
|
||||
@WebServlet("/booklist")
|
||||
public class BookList extends HttpServlet {
|
||||
|
||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
||||
throws IOException {
|
||||
req.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
|
||||
//get database object
|
||||
Database db = Database.getInstance();
|
||||
|
||||
resp.setCharacterEncoding("utf-8");
|
||||
PrintWriter out = resp.getWriter();
|
||||
|
||||
//header template
|
||||
Utillity.insertFile(out, "template_head.html");
|
||||
|
||||
//remove book by id
|
||||
String param = req.getParameter("removeid");
|
||||
if (param != null && Long.parseLong(param) != 0) {
|
||||
long isbn = Long.parseLong(param);
|
||||
db.deleteBook(isbn);
|
||||
resp.sendRedirect("booklist");
|
||||
}
|
||||
|
||||
//add book to database
|
||||
if (req.getParameter("title") != null) {
|
||||
try {
|
||||
|
||||
long isbn = Long.parseLong(req.getParameter("isbn"));
|
||||
String title = req.getParameter("title");
|
||||
String authorName = req.getParameter("author");
|
||||
String priceString = req.getParameter("price");
|
||||
String[] priceParts = priceString.split(",");
|
||||
int price = Integer.parseInt(priceParts[0]) * 100;
|
||||
if (priceParts.length >= 2) {
|
||||
if (priceParts[1].length() == 1) {
|
||||
price += Integer.parseInt(priceParts[1]) * 10;
|
||||
} else {
|
||||
price += Integer.parseInt(priceParts[1]);
|
||||
}
|
||||
}
|
||||
int year = Integer.parseInt(req.getParameter("year"));
|
||||
String categoryName = req.getParameter("category");
|
||||
String description = req.getParameter("description");
|
||||
String publisher = req.getParameter("publisher");
|
||||
String image = req.getParameter("image");
|
||||
|
||||
//check isbn
|
||||
List<Book> books = db.getBooks();
|
||||
boolean found = false;
|
||||
if (books != null) {
|
||||
for(Book b : books){
|
||||
if(b.getIsbn() == isbn){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
out.println("<aside class =\"m-note m-danger\">");
|
||||
out.println("<h3>Es gibt breits ein buch mit dieser ISBN </h3>");
|
||||
out.println("</aside>");
|
||||
} else {
|
||||
ArrayList<Author> authors = new ArrayList<>();
|
||||
String[] authorNames = authorName.split(",");
|
||||
for (String name : authorNames) {
|
||||
authors.add(new Author(name));
|
||||
}
|
||||
Category category = new Category(categoryName);
|
||||
Book book = new Book(isbn,
|
||||
authors,
|
||||
new Publisher(publisher),
|
||||
category,
|
||||
title, Year.of(year), price, description, image
|
||||
);
|
||||
db.insert(book);
|
||||
resp.sendRedirect("booklist");
|
||||
}
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
out.println("<aside class =\"m-note m-danger\">");
|
||||
out.println("<h3>Es gibt ein Fehler in der Eingabe </h3>");
|
||||
out.println("</aside>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//list all books
|
||||
List<Book> books = db.getBooks();
|
||||
if (books != null) {
|
||||
|
||||
//book entries
|
||||
out.println("<div class=\"m-container\">");
|
||||
for (Book book : books) {
|
||||
|
||||
out.println(" <div class=\"m-row\">");
|
||||
|
||||
out.println(" <div class=\"m-col-l-4\">");
|
||||
out.println(" <img class=\"m-image\" src=\"https://source.unsplash.com/" + book.getImage() + "/300x300\" alt=\"Buchcover\">");
|
||||
out.println(" </div>");
|
||||
|
||||
out.println(" <div class=\"m-col-l-4\">");
|
||||
out.println("<h2>" + book.getTitle() + "</h2>");
|
||||
out.println("ISBN: " + book.getIsbn() + "</br>");
|
||||
|
||||
List<String> authors = new ArrayList<>();
|
||||
for(Author author : book.getAuthors()) {
|
||||
authors.add(author.getName());
|
||||
}
|
||||
|
||||
out.println("von: " + String.join(", ", authors));
|
||||
|
||||
out.println("</br>Veröffentlicht von " + book.getPublisher().getName() + "");
|
||||
out.println("</br></br>" + book.getDescription() + "");
|
||||
|
||||
out.println(" </div>");
|
||||
|
||||
out.println(" <div class=\"m-col-l-4\">");
|
||||
out.println(" <div class=\"m-button m-danger\">");
|
||||
|
||||
out.println("<a href=\"/itech/booklist?removeid=" + book.getId() + "\">");
|
||||
out.println("Entfernen");
|
||||
out.println("</a>");
|
||||
|
||||
out.println(" <br>");
|
||||
out.println(" <br>");
|
||||
|
||||
out.print(" <h3>" + book.getPrice() / 100 + ",");
|
||||
if (book.getPrice() % 100 < 10) {
|
||||
out.print("0");
|
||||
}
|
||||
|
||||
out.println(book.getPrice() % 100 + " €</h3>");
|
||||
|
||||
out.println(" </div>");
|
||||
out.println(" </div>");
|
||||
out.println(" </div>");
|
||||
}
|
||||
out.println("</div>");
|
||||
}
|
||||
|
||||
//add book button
|
||||
Utillity.addButton(out, "Neues Buch Hinzufügen", "addbook");
|
||||
|
||||
//footer template
|
||||
Utillity.insertFile(out, "template_footer.html");
|
||||
}
|
||||
|
||||
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp)
|
||||
throws IOException {
|
||||
doGet(req, resp);
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package de.hsel.itech.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
**/
|
||||
public class Database extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 15679036734L;
|
||||
|
||||
/**
|
||||
* doGet.
|
||||
*
|
||||
* @param req Request
|
||||
* @param resp Response
|
||||
* @throws IOException failed
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
||||
throws IOException {
|
||||
|
||||
resp.setContentType("text/html");
|
||||
final PrintWriter out = resp.getWriter();
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Hallo Welt!</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1>" + new de.hsel.itech.db.Database().getHello() + "</h1>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package de.hsel.itech.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Hello World.
|
||||
*
|
||||
* @author Johannes Theiner
|
||||
* @version 0.1
|
||||
* @since 0.1
|
||||
**/
|
||||
public class HelloWorld extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 15679036735L;
|
||||
|
||||
/**
|
||||
* doGet.
|
||||
*
|
||||
* @param req Request
|
||||
* @param resp Response
|
||||
* @throws IOException failed
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
||||
throws IOException {
|
||||
|
||||
resp.setContentType("text/html");
|
||||
final PrintWriter out = resp.getWriter();
|
||||
out.println("<!DOCTYPE html>");
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Hallo Welt!</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1>Hallo Ostfriesland!</h1><br>");
|
||||
out.println("<h3>" + System.getProperty("catalina.base") + "</h3><br>");
|
||||
out.println("<h4>" + new File("").getAbsolutePath() + "</h4>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
}
|
61
src/main/java/de/hsel/itech/servlet/Utillity.java
Normal file
61
src/main/java/de/hsel/itech/servlet/Utillity.java
Normal file
@ -0,0 +1,61 @@
|
||||
package de.hsel.itech.servlet;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class Utillity {
|
||||
|
||||
static public void insertFile(PrintWriter out, String fileName) {
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(Utillity.class.getClassLoader().getResource(fileName).getFile()))) {
|
||||
for (String line = br.readLine(); line != null; line = br.readLine()) {
|
||||
out.println(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static public void addInput(PrintWriter out, String label, String name){
|
||||
addInput(out,label,name,"");
|
||||
}
|
||||
|
||||
static public void addInput(PrintWriter out, String label, String name, String value){
|
||||
out.println(" <div class=\"m-row\">");
|
||||
out.println(" <div class=\"m-col-l-2 m-push-l-5\">");
|
||||
out.println(label);
|
||||
out.println("<input type=\"text\" name=\"" + name + "\" value=\"" + value + "\">");
|
||||
out.println("</div>");
|
||||
out.println("</div>");
|
||||
}
|
||||
|
||||
static public void addValidationInput(PrintWriter out, String label, String name, String type, String value, String pattern){
|
||||
out.println(" <div class=\"m-row\">");
|
||||
out.println(" <div class=\"m-col-l-2 m-push-l-5\">");
|
||||
out.println(label);
|
||||
out.println("<input type=\"" + type + "\" name=\"" + name + "\" value=\"" + value + "\"required pattern=\"" + pattern + "\">");
|
||||
out.println("</div>");
|
||||
out.println("</div>");
|
||||
}
|
||||
|
||||
static public void addButton(PrintWriter out, String label, String url){
|
||||
out.println(" <div class=\"m-row\">");
|
||||
out.println(" <div class=\"m-col-l-4 m-push-l-4\">");
|
||||
out.println(" <div class=\"m-button m-success\">");
|
||||
out.println("<a href=\"" + url + "\">");
|
||||
out.println(label);
|
||||
out.println("</a>");
|
||||
out.println(" </div>");
|
||||
out.println("</div>");
|
||||
out.println("</div>");
|
||||
}
|
||||
|
||||
static public void addSubmitButton(PrintWriter out, String label){
|
||||
out.println(" <div class=\"m-row\">");
|
||||
out.println(" <div class=\"m-col-l-4 m-push-l-5\">");
|
||||
out.println(" <input type=\"" + "submit" + "\" value=\"" + label + "\">");
|
||||
out.println(" </div>");
|
||||
out.println("</div>");
|
||||
}
|
||||
}
|
23
src/main/resources/database.sql
Normal file
23
src/main/resources/database.sql
Normal file
@ -0,0 +1,23 @@
|
||||
CREATE TABLE IF NOT EXISTS test(id bigint primary key auto_increment, hello varchar(25));
|
||||
INSERT IGNORE INTO test(hello) values ('Welt');
|
||||
CREATE TABLE IF NOT EXISTS book (id bigint primary key auto_increment, isbn bigint unique, title varchar(50), description varchar(500), price int, year year, publisher bigint, category bigint, image varchar(11));
|
||||
CREATE TABLE IF NOT EXISTS publisher(id bigint primary key auto_increment, name varchar(50) unique);
|
||||
CREATE TABLE IF NOT EXISTS author(id bigint primary key auto_increment, name varchar(50) unique);
|
||||
CREATE TABLE IF NOT EXISTS author_book(author bigint, book bigint, primary key(author, book), foreign key (author) REFERENCES author(id), foreign key (book) references book(id));
|
||||
CREATE TABLE IF NOT EXISTS category(id bigint primary key auto_increment, name varchar(25), image varchar(11));
|
||||
CREATE TABLE IF NOT EXISTS user(id bigint primary key auto_increment, name varchar(50), email varchar(255), password binary(40), type tinyint);
|
||||
CREATE TABLE IF NOT EXISTS address(id bigint primary key auto_increment, street varchar(100), number smallint, zipCode smallint, city varchar(50));
|
||||
CREATE TABLE IF NOT EXISTS user_address(id bigint primary key auto_increment, user bigint, address bigint, foreign key (user) REFERENCES user(id), foreign key (address) references address(id));
|
||||
CREATE TABLE IF NOT EXISTS payment_type(id bigint primary key auto_increment, name varchar(25) unique);
|
||||
INSERT IGNORE INTO payment_type (name) values ('CreditCard');
|
||||
INSERT IGNORE INTO payment_type (name) values ('DebitCard');
|
||||
INSERT IGNORE INTO payment_type (name) values ('Invoice');
|
||||
INSERT IGNORE INTO payment_type (name) values ('PayPal');
|
||||
CREATE TABLE IF NOT EXISTS payment_debit(id bigint primary key auto_increment, iban varchar(34), bic varchar(8), owner varchar(50));
|
||||
CREATE TABLE IF NOT EXISTS payment_credit(id bigint primary key auto_increment, number varchar(19), owner varchar(50), expiration DATE, checksum tinyint);
|
||||
CREATE TABLE IF NOT EXISTS payment_invoice(id bigint primary key auto_increment);
|
||||
CREATE TABLE IF NOT EXISTS payment_paypal(id bigint primary key auto_increment, mail varchar(255), auth varchar(255));
|
||||
CREATE TABLE IF NOT EXISTS `order`(id bigint primary key auto_increment, user bigint, price bigint);
|
||||
CREATE TABLE IF NOT EXISTS order_book(`order` bigint, book bigint, count tinyint, primary key (`order`, book, count), foreign key (`order`) references `order`(id), foreign key (book) references `order`(id));
|
||||
CREATE TABLE IF NOT EXISTS shopping_cart(id bigint primary key auto_increment);
|
||||
CREATE TABLE IF NOT EXISTS cart_books(user bigint, book bigint, count tinyint, primary key(book, user), foreign key (book) REFERENCES book(id), foreign key (user) REFERENCES user(id));
|
81
src/main/resources/template_footer.html
Normal file
81
src/main/resources/template_footer.html
Normal file
@ -0,0 +1,81 @@
|
||||
<footer>
|
||||
<nav>
|
||||
<div class="m-container">
|
||||
<div class="m-row">
|
||||
<div class="m-col-s-3 m-col-t-6">
|
||||
<h3>Hilfe</h3>
|
||||
<ul>
|
||||
<li><a href="#">FAQ</a></li>
|
||||
<li><a href="#">Rückgabe</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="m-col-s-3 m-col-t-6">
|
||||
<h3>Zahlung</h3>
|
||||
<ul>
|
||||
<li><a href="#">Kreditkarten</a></li>
|
||||
<li><a href="#">Gutscheine</a></li>
|
||||
<li><a href="#">Bankeinzug</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="m-clearfix-t"></div>
|
||||
<div class="m-col-s-3 m-col-t-6">
|
||||
<h3>Amazon light</h3>
|
||||
<ul>
|
||||
<li><a href="#">Über</a></li>
|
||||
<li><a href="#">Kontakt</a></li>
|
||||
<li><a href="#">Presse</a></li>
|
||||
<li><a href="#">Jobs</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="m-col-s-3 m-col-t-6">
|
||||
<h3>Rechtliches</h3>
|
||||
<ul>
|
||||
<li><a href="https://joethei.xyz/imprint">Impressum</a></li>
|
||||
<li><a href="https://joethei.xyz/privacy">Datenschutz</a></li>
|
||||
<li><a href="https://joethei.xyz/disclaimer">Haftung</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-row">
|
||||
<div class="m-col-l-10 m-push-l-1">
|
||||
<p>Amazon light. Copyright © <a href="#">B1</a>,
|
||||
2019. All rights reserved.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
|
||||
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
|
||||
<script>
|
||||
function changeTheme() {
|
||||
|
||||
if(document.getElementById('myonoffswitch').checked) {
|
||||
swapStyleSheet("dark", "#22272e");
|
||||
}else {
|
||||
swapStyleSheet("light", "#cb4b16");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function swapStyleSheet(sheet, color) {
|
||||
document.getElementById("pagestyle").setAttribute("href", "css/m-" + sheet + ".css");
|
||||
document.getElementById("pagecolor").setAttribute("content", color);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.slider').slick({
|
||||
infinite: true,
|
||||
slidesToShow: 6,
|
||||
slidesToScroll: 3
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
65
src/main/resources/template_head.html
Normal file
65
src/main/resources/template_head.html
Normal file
@ -0,0 +1,65 @@
|
||||
<!Doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>Edit Book List</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<nav id="navigation">
|
||||
<div class="m-container">
|
||||
<div class="m-row">
|
||||
<a href="" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m"></a>
|
||||
<a id="m-navbar-show" href="#navigation" title="Show navigation"
|
||||
class="m-col-t-3 m-hide-m m-text-right"></a>
|
||||
<a id="m-navbar-hide" href="#" title="Hide navigation" class="m-col-t-3 m-hide-m m-text-right"></a>
|
||||
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
|
||||
<div class="m-row">
|
||||
<ol class="m-col-t-6 m-col-m-none">
|
||||
<li><a href="#">Katalog</a></li>
|
||||
<li><a href="#">(1) Warenkorb</a></li>
|
||||
</ol>
|
||||
<ol class="m-col-t-6 m-col-m-none" start="4">
|
||||
<li>
|
||||
<a href="#">Mein Account</a>
|
||||
<ol>
|
||||
<li><a href="#">Meine Bestellungen</a></li>
|
||||
<li><a href="#">Adressen & Konten</a></li>
|
||||
<li><a href="#">Abmelden</a></li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
<ol class="m-col-t-6 m-col-m-none" start="6">
|
||||
<li>
|
||||
<a href="#"><i class="fas fa-ellipsis-v"></i></a>
|
||||
<ol>
|
||||
<li>Dark Theme
|
||||
<div class="onoffswitch">
|
||||
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" onchange="changeTheme()">
|
||||
<label class="onoffswitch-label" for="myonoffswitch">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
<servlet>
|
||||
<servlet-name>helloWorld</servlet-name>
|
||||
<servlet-class>de.hsel.itech.servlet.HelloWorld</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>database</servlet-name>
|
||||
<servlet-class>de.hsel.itech.servlet.Database</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>helloWorld</servlet-name>
|
||||
<url-pattern>/index</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>database</servlet-name>
|
||||
<url-pattern>/db</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
12
src/main/webapp/index.html
Normal file
12
src/main/webapp/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>Internet Technologien</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li><a href="preview">Grobspezifikation</a></li>
|
||||
<li><a href="booklist">Backend</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<title>Amazon light</title>
|
||||
|
||||
<link rel="stylesheet" href="css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="../css/m-light.css" id="pagestyle"/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i%7CSource+Code+Pro:400,400i,600" />
|
||||
<meta name="theme-color" content="#cb4b16" id="pagecolor"/>
|
||||
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<link href="css/slick-theme.css" rel="stylesheet">
|
||||
<link href="../css/custom.css" rel="stylesheet">
|
||||
<link href="../css/slick-theme.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user