From 0f08fa6a0e8bd0eaa37c569d40c88e800b9aa2fd Mon Sep 17 00:00:00 2001 From: Mark Struchkov Date: Sun, 28 Jul 2019 21:41:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D1=8B=D0=B9=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=20=D0=AD=D1=82=D0=BE?= =?UTF-8?q?=20=D0=B2=D1=81=D0=B5=20=D0=BE=D1=82=D0=BD=D0=BE=D1=81=D0=B8?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=BA=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=D0=BC=20=D1=81=D0=BE=D1=86=D0=B8?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=81=D0=B5=D1=82=D0=B8?= =?UTF-8?q?,=20=D0=BD=D0=BE=20=D0=BD=D0=B8=D0=BA=D0=B0=D0=BA=20=D0=BD?= =?UTF-8?q?=D0=B8=20=D0=BA=20=D0=B0=D0=B1=D1=81=D1=82=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/repository/EventRepository.java | 18 -------- .../impl/jpa/EventRepositoryJpaImpl.java | 42 ------------------- .../impl/local/EventRepositoryQueue.java | 26 ------------ .../repository/jpa/EventRepositoryJpa.java | 15 ------- .../social/core/service/RawEventService.java | 20 --------- .../service/impl/RawEventServiceImpl.java | 34 --------------- 6 files changed, 155 deletions(-) delete mode 100644 src/main/java/org/sadtech/social/core/repository/EventRepository.java delete mode 100644 src/main/java/org/sadtech/social/core/repository/impl/jpa/EventRepositoryJpaImpl.java delete mode 100644 src/main/java/org/sadtech/social/core/repository/impl/local/EventRepositoryQueue.java delete mode 100644 src/main/java/org/sadtech/social/core/repository/jpa/EventRepositoryJpa.java delete mode 100644 src/main/java/org/sadtech/social/core/service/RawEventService.java delete mode 100644 src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java diff --git a/src/main/java/org/sadtech/social/core/repository/EventRepository.java b/src/main/java/org/sadtech/social/core/repository/EventRepository.java deleted file mode 100644 index 1661718..0000000 --- a/src/main/java/org/sadtech/social/core/repository/EventRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.sadtech.social.core.repository; - -import java.util.Queue; - -/** - * Обработка событий социальной сети. - * - * @author upagge [08/07/2019] - */ -public interface EventRepository { - - void add(T dataObject); - - void cleanAll(); - - Queue getEventQueue(); - -} diff --git a/src/main/java/org/sadtech/social/core/repository/impl/jpa/EventRepositoryJpaImpl.java b/src/main/java/org/sadtech/social/core/repository/impl/jpa/EventRepositoryJpaImpl.java deleted file mode 100644 index c7bea8d..0000000 --- a/src/main/java/org/sadtech/social/core/repository/impl/jpa/EventRepositoryJpaImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.sadtech.social.core.repository.impl.jpa; - -import com.google.gson.JsonObject; -import org.sadtech.social.core.domain.jpa.JsonObjectId; -import org.sadtech.social.core.repository.EventRepository; -import org.sadtech.social.core.repository.jpa.EventRepositoryJpa; - -import java.util.List; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.stream.Collectors; - -/** - * TODO: Добавить описание класса. - * - * @author upagge [28/07/2019] - */ -public class EventRepositoryJpaImpl implements EventRepository { - - private final EventRepositoryJpa eventRepositoryJpa; - - public EventRepositoryJpaImpl(EventRepositoryJpa eventRepositoryJpa) { - this.eventRepositoryJpa = eventRepositoryJpa; - } - - @Override - public void add(JsonObject dataObject) { - eventRepositoryJpa.saveAndFlush(new JsonObjectId(dataObject)); - } - - @Override - public void cleanAll() { - eventRepositoryJpa.deleteAll(); - } - - @Override - public Queue getEventQueue() { - List allEvent = eventRepositoryJpa.findAll(); - eventRepositoryJpa.deleteAll(allEvent); - return allEvent.stream().map(JsonObjectId::getJsonObject).collect(Collectors.toCollection(ConcurrentLinkedQueue::new)); - } -} diff --git a/src/main/java/org/sadtech/social/core/repository/impl/local/EventRepositoryQueue.java b/src/main/java/org/sadtech/social/core/repository/impl/local/EventRepositoryQueue.java deleted file mode 100644 index 8fee934..0000000 --- a/src/main/java/org/sadtech/social/core/repository/impl/local/EventRepositoryQueue.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.sadtech.social.core.repository.impl.local; - -import com.google.gson.JsonObject; -import org.sadtech.social.core.repository.EventRepository; - -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; - -public class EventRepositoryQueue implements EventRepository { - - private final Queue jsonObjects = new ConcurrentLinkedQueue<>(); - - @Override - public void add(JsonObject jsonObject) { - jsonObjects.offer(jsonObject); - } - - @Override - public void cleanAll() { - jsonObjects.clear(); - } - - public Queue getEventQueue() { - return jsonObjects; - } -} diff --git a/src/main/java/org/sadtech/social/core/repository/jpa/EventRepositoryJpa.java b/src/main/java/org/sadtech/social/core/repository/jpa/EventRepositoryJpa.java deleted file mode 100644 index bb46f75..0000000 --- a/src/main/java/org/sadtech/social/core/repository/jpa/EventRepositoryJpa.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sadtech.social.core.repository.jpa; - -import org.sadtech.social.core.domain.jpa.JsonObjectId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -/** - * TODO: Добавить описание интерфейса. - * - * @author upagge [28/07/2019] - */ -@Repository -public interface EventRepositoryJpa extends JpaRepository { - -} diff --git a/src/main/java/org/sadtech/social/core/service/RawEventService.java b/src/main/java/org/sadtech/social/core/service/RawEventService.java deleted file mode 100644 index ce7da07..0000000 --- a/src/main/java/org/sadtech/social/core/service/RawEventService.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.sadtech.social.core.service; - -import com.google.gson.JsonObject; - -import java.util.Queue; - -/** - * Интерфейс для взаимодействия с событиями социальной сети. - * - * @author upagge [08/07/2019] - */ -public interface RawEventService { - - void cleanAll(); - - void add(JsonObject jsonObject); - - Queue getJsonObjects(); - -} \ No newline at end of file diff --git a/src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java b/src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java deleted file mode 100644 index 44ad42d..0000000 --- a/src/main/java/org/sadtech/social/core/service/impl/RawEventServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.sadtech.social.core.service.impl; - -import com.google.gson.JsonObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.sadtech.social.core.repository.EventRepository; -import org.sadtech.social.core.service.RawEventService; - -import java.util.Queue; - -@Slf4j -@RequiredArgsConstructor -public class RawEventServiceImpl implements RawEventService { - - private final EventRepository eventRepository; - - @Override - public void cleanAll() { - eventRepository.cleanAll(); - log.info("Репозиторий событий очищен"); - } - - @Override - public void add(JsonObject jsonObject) { - eventRepository.add(jsonObject); - log.info("Событие отправленно в репозиторий"); - } - - @Override - public Queue getJsonObjects() { - return eventRepository.getEventQueue(); - } - -}