Checkpoint - started to create database entities

This commit is contained in:
Filip Izydorczyk 2020-07-23 17:27:20 +02:00
parent 481922dbd3
commit c96d6d8380
24 changed files with 339 additions and 107 deletions

View File

@ -1,13 +0,0 @@
package com.plannaplan;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,26 @@
package com.plannaplan;
import com.plannaplan.interfaces.Historable;
import com.plannaplan.interfaces.ProtectedAction;
public class Assigner implements Historable, ProtectedAction {
public Assigner() {
}
public void assing() {
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
@Override
public void addActionToHistory() {
// TODO Auto-generated method stub
}
}

View File

@ -1,26 +0,0 @@
package com.plannaplan;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Book {
@Id
@GeneratedValue
private Long id;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
// standard constructors
// standard getters and setters
}

View File

@ -1,8 +0,0 @@
package com.plannaplan;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface BookRepository extends JpaRepository<Book, Long> {
}

View File

@ -1,17 +0,0 @@
package com.plannaplan;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BookService {
@Autowired
private BookRepository bookRepository;
public List<Book> list() {
return bookRepository.findAll();
}
}

View File

@ -0,0 +1,20 @@
package com.plannaplan;
import com.plannaplan.interfaces.ProtectedAction;
import com.plannaplan.models.ConfigData;
public class Configurator implements ProtectedAction {
public Configurator() {
}
public void config(ConfigData data) {
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,30 @@
package com.plannaplan;
public class Controller {
public Controller() {
}
public void startApp() {
}
public void assignCourse() {
}
public void addUnavailibility() {
}
public void addGroup() {
}
public void editGroup() {
}
public void getHistoryAtPoint() {
}
public void config() {
}
public void createTransfer() {
}
}

View File

@ -0,0 +1,26 @@
package com.plannaplan;
import com.plannaplan.interfaces.Historable;
import com.plannaplan.interfaces.ProtectedAction;
public class GroupAdder implements Historable, ProtectedAction {
public GroupAdder() {
}
public void addGroup() {
}
@Override
public void addActionToHistory() {
// TODO Auto-generated method stub
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,19 @@
package com.plannaplan;
import com.plannaplan.interfaces.ProtectedAction;
public class GroupEditor implements ProtectedAction {
public GroupEditor() {
}
public void setNewCapacity(int capaity) {
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,22 @@
package com.plannaplan;
import com.plannaplan.interfaces.ProtectedAction;
public class HistoryResolver implements ProtectedAction {
public HistoryResolver() {
}
public void getHistoryAtPoint() {
}
public void reproduce() {
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
}

View File

@ -1,18 +0,0 @@
package com.plannaplan;
public class SampleClass {
private String xd;
public SampleClass(String xd) {
this.setXd(xd);
}
public String getXd() {
return xd;
}
public void setXd(String xd) {
this.xd = xd;
}
}

View File

@ -0,0 +1,26 @@
package com.plannaplan;
import com.plannaplan.interfaces.Historable;
import com.plannaplan.interfaces.ProtectedAction;
public class TransferCreator implements Historable, ProtectedAction {
public TransferCreator() {
}
public void createTransfer() {
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
@Override
public void addActionToHistory() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,26 @@
package com.plannaplan;
import com.plannaplan.interfaces.Historable;
import com.plannaplan.interfaces.ProtectedAction;
public class UnavailabilityAdder implements Historable, ProtectedAction {
public UnavailabilityAdder() {
}
public void add() {
}
@Override
public void validateAction() {
// TODO Auto-generated method stub
}
@Override
public void addActionToHistory() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,12 @@
package com.plannaplan.configutils;
import java.io.File;
public class FileToDatabaseMigrator {
public FileToDatabaseMigrator() {
}
public void migrate(File file) {
}
}

View File

@ -0,0 +1,52 @@
package com.plannaplan.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Groups {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private Long courseId;
private int time;
private String room;
private int capacity;
public Groups() {
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
public Long getCourseId() {
return courseId;
}
public void setCourseId(Long courseId) {
this.courseId = courseId;
}
}

View File

@ -0,0 +1,5 @@
package com.plannaplan.interfaces;
public interface EventCreator {
void update();
}

View File

@ -0,0 +1,5 @@
package com.plannaplan.interfaces;
public interface Historable {
void addActionToHistory();
}

View File

@ -0,0 +1,5 @@
package com.plannaplan.interfaces;
public interface ProtectedAction {
void validateAction();
}

View File

@ -0,0 +1,29 @@
package com.plannaplan.models;
import java.io.File;
import java.util.Date;
public class ConfigData {
private Date start;
private Date end;
private File file;
public ConfigData(Date start, Date end, File file) {
this.start = start;
this.end = end;
this.file = file;
}
public File getFile() {
return file;
}
public Date getEnd() {
return end;
}
public Date getStart() {
return start;
}
}

View File

@ -0,0 +1,11 @@
package com.plannaplan.repositories;
import com.plannaplan.entities.Groups;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface GroupRepository extends JpaRepository<Groups, Long> {
}

View File

@ -0,0 +1,12 @@
package com.plannaplan.services;
import com.plannaplan.repositories.GroupRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class GroupService {
@Autowired
private GroupRepository repo;
}

View File

@ -0,0 +1,10 @@
package com.plannaplan.statisticutils;
public class Statistics {
public Statistics() {
}
public void getAll() {
}
}

View File

@ -1,24 +0,0 @@
package com.plannaplan;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Unit test for simple App.
*/
public class AppTest {
@Autowired
private BookService bookService;
@Ignore
@Test
public void whenApplicationStarts_thenHibernateCreatesInitialRecords() {
List<Book> books = bookService.list();
Assert.assertEquals(books.size(), 1);
}
}

View File

@ -1,8 +1,10 @@
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.datasource.url=jdbc:mysql://172.20.0.2:3306/test
spring.datasource.url=jdbc:mysql://172.20.0.3:3306/test?useUnicode=yes&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=example
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.open-in-view=true
spring.jpa.hibernate.ddl-auto=create
spring.jackson.serialization.fail-on-empty-beans=false
server.port=1285