From 2ab40a24c746e3360db87df1fac17920cad8b534 Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Mon, 27 Jul 2020 16:44:04 +0200 Subject: [PATCH] Events --- .../main/java/com/plannaplan/Acceptor.java | 9 +++++++ .../src/main/java/com/plannaplan/Emailer.java | 9 +++++++ .../main/java/com/plannaplan/EventChcker.java | 13 ++++++++++ .../com/plannaplan/TransferValidator.java | 19 ++++++++++++++ .../plannaplan/abstracts/EventWatcher.java | 26 +++++++++++++++++++ .../services/AssignmentService.java | 10 +++---- .../plannaplan/services/TransferService.java | 10 +++---- .../com/plannaplan/services/UserService.java | 10 +++---- .../transferutils/TransferMatcher.java | 9 +++++++ .../transferutils/TransfersExecuter.java | 9 +++++++ 10 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 buisnesslogic/src/main/java/com/plannaplan/Acceptor.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/Emailer.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/EventChcker.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/TransferValidator.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/abstracts/EventWatcher.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/transferutils/TransferMatcher.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/transferutils/TransfersExecuter.java diff --git a/buisnesslogic/src/main/java/com/plannaplan/Acceptor.java b/buisnesslogic/src/main/java/com/plannaplan/Acceptor.java new file mode 100644 index 0000000..b549da9 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/Acceptor.java @@ -0,0 +1,9 @@ +package com.plannaplan; + +public class Acceptor { + public Acceptor() { + } + + public void run() { + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/Emailer.java b/buisnesslogic/src/main/java/com/plannaplan/Emailer.java new file mode 100644 index 0000000..22ec932 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/Emailer.java @@ -0,0 +1,9 @@ +package com.plannaplan; + +public class Emailer { + public Emailer() { + } + + public void performAllMails() { + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/EventChcker.java b/buisnesslogic/src/main/java/com/plannaplan/EventChcker.java new file mode 100644 index 0000000..db8b927 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/EventChcker.java @@ -0,0 +1,13 @@ +package com.plannaplan; + +import com.plannaplan.interfaces.EventCreator; + +public class EventChcker implements EventCreator { + + @Override + public void update() { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/TransferValidator.java b/buisnesslogic/src/main/java/com/plannaplan/TransferValidator.java new file mode 100644 index 0000000..2849f82 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/TransferValidator.java @@ -0,0 +1,19 @@ +package com.plannaplan; + +import com.plannaplan.interfaces.Historable; + +public class TransferValidator implements Historable { + + public TransferValidator() { + } + + public void performAllTransfers() { + } + + @Override + public void addActionToHistory() { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/abstracts/EventWatcher.java b/buisnesslogic/src/main/java/com/plannaplan/abstracts/EventWatcher.java new file mode 100644 index 0000000..ac8467a --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/abstracts/EventWatcher.java @@ -0,0 +1,26 @@ +package com.plannaplan.abstracts; + +import java.util.ArrayList; +import java.util.List; + +import com.plannaplan.interfaces.EventCreator; + +public abstract class EventWatcher { + + protected List creators; + + public EventWatcher() { + this.creators = new ArrayList<>(); + } + + public void attach(EventCreator creator) { + this.creators.add(creator); + } + + public void detach(EventCreator creator) { + this.creators.remove(creator); + } + + public void update() { + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java b/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java index e914c65..53e74cf 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java +++ b/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java @@ -1,19 +1,17 @@ package com.plannaplan.services; -import com.plannaplan.interfaces.EventCreator; +import com.plannaplan.abstracts.EventWatcher; import com.plannaplan.repositories.AssignmentRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class AssignmentService implements EventCreator { +public class AssignmentService extends EventWatcher { @Autowired private AssignmentRepository repo; - @Override - public void update() { - // TODO Auto-generated method stub - + public AssignmentService() { + super(); } } \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/TransferService.java b/buisnesslogic/src/main/java/com/plannaplan/services/TransferService.java index 11e1b19..6d864aa 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/services/TransferService.java +++ b/buisnesslogic/src/main/java/com/plannaplan/services/TransferService.java @@ -1,19 +1,17 @@ package com.plannaplan.services; -import com.plannaplan.interfaces.EventCreator; +import com.plannaplan.abstracts.EventWatcher; import com.plannaplan.repositories.TransferRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class TransferService implements EventCreator { +public class TransferService extends EventWatcher { @Autowired private TransferRepository repo; - @Override - public void update() { - // TODO Auto-generated method stub - + public TransferService() { + super(); } } \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java b/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java index 8b7dc5f..ffa133a 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java +++ b/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java @@ -1,20 +1,18 @@ package com.plannaplan.services; -import com.plannaplan.interfaces.EventCreator; +import com.plannaplan.abstracts.EventWatcher; import com.plannaplan.repositories.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class UserService implements EventCreator { +public class UserService extends EventWatcher { @Autowired private UserRepository repo; - @Override - public void update() { - // TODO Auto-generated method stub - + public UserService() { + super(); } } \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/transferutils/TransferMatcher.java b/buisnesslogic/src/main/java/com/plannaplan/transferutils/TransferMatcher.java new file mode 100644 index 0000000..6395220 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/transferutils/TransferMatcher.java @@ -0,0 +1,9 @@ +package com.plannaplan.transferutils; + +public class TransferMatcher { + public TransferMatcher() { + } + + public void findMatches() { + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/transferutils/TransfersExecuter.java b/buisnesslogic/src/main/java/com/plannaplan/transferutils/TransfersExecuter.java new file mode 100644 index 0000000..43db7c9 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/transferutils/TransfersExecuter.java @@ -0,0 +1,9 @@ +package com.plannaplan.transferutils; + +public class TransfersExecuter { + public TransfersExecuter() { + } + + public void execute() { + } +} \ No newline at end of file