Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# See https://www.dartlang.org/guides/libraries/private-files

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/


*.html
*.css
*.rss

*target

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/


# Files and directories created by pub
.dart_tool/
.packages
build/

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

### Firebase ###
**/node_modules/*
**/.firebaserc

### Firebase Patch ###
.runtimeconfig.json
.firebase/

# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock

# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/

# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Databases

# Lab 4

JDBC Maven
5 changes: 5 additions & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.extern.findbugs.addSuppressFBWarnings = true
lombok.anyConstructor.addConstructorProperties = true
lombok.addNullAnnotations = <flavor>
141 changes: 141 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mkruchok</groupId>
<artifactId>DB4MK</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<url>https://github.com/MKruchok/Databases/tree/lab_4</url>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.2</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.4.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.2</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
</plugin>
</plugins>
</reporting>
</project>
9 changes: 9 additions & 0 deletions src/main/java/com/mkruchok/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.mkruchok;

import com.mkruchok.view.View;

public final class Application {
public static void main(final String[] args) {
new View().show();
}
}
23 changes: 23 additions & 0 deletions src/main/java/com/mkruchok/controller/AbstractController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.mkruchok.controller;

import java.sql.SQLException;
import java.util.List;

public interface AbstractController<E> {

List<E> findAll() throws SQLException;

default E findById(Integer id) throws SQLException {
return null;
}

default void create(E entity) throws SQLException {
}

default void update(Integer id, E entity) throws SQLException {
}

default void delete(Integer id) throws SQLException {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.mkruchok.controller.implementation;

import com.mkruchok.controller.AbstractController;
import com.mkruchok.model.entity.Device;
import com.mkruchok.service.implementation.DeviceService;
import java.sql.SQLException;
import java.util.List;

public final class DeviceController implements AbstractController<Device> {

private final DeviceService service = new DeviceService();

@Override
public List<Device> findAll() throws SQLException {
return service.findAll();
}

@Override
public Device findById(Integer id) throws SQLException {
return service.findById(id);
}

@Override
public void create(Device entity) throws SQLException {
service.create(entity);
}

@Override
public void update(Integer id, Device entity) throws SQLException {
service.update(id, entity);
}

@Override
public void delete(Integer id) throws SQLException {
service.delete(id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.mkruchok.controller.implementation;

import com.mkruchok.controller.AbstractController;
import com.mkruchok.model.entity.DevicesGroup;
import com.mkruchok.service.implementation.DevicesGroupService;
import java.sql.SQLException;
import java.util.List;

public final class DevicesGroupController implements AbstractController<DevicesGroup> {

private final DevicesGroupService service = new DevicesGroupService();

@Override
public List<DevicesGroup> findAll() throws SQLException {
return service.findAll();
}

@Override
public DevicesGroup findById(Integer id) throws SQLException {
return service.findById(id);
}

@Override
public void create(DevicesGroup entity) throws SQLException {
service.create(entity);
}

@Override
public void update(Integer id, DevicesGroup entity) throws SQLException {
service.update(id, entity);
}

@Override
public void delete(Integer id) throws SQLException {
service.delete(id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.mkruchok.controller.implementation;

import com.mkruchok.controller.AbstractController;
import com.mkruchok.model.entity.Hub;
import com.mkruchok.service.implementation.HubService;
import java.sql.SQLException;
import java.util.List;

public final class HubController implements AbstractController<Hub> {

private final HubService service = new HubService();

@Override
public List<Hub> findAll() throws SQLException {
return service.findAll();
}

@Override
public Hub findById(Integer id) throws SQLException {
return service.findById(id);
}

@Override
public void create(Hub entity) throws SQLException {
service.create(entity);
}

@Override
public void update(Integer id, Hub entity) throws SQLException {
service.update(id, entity);
}

@Override
public void delete(Integer id) throws SQLException {
service.delete(id);
}
}
Loading