diff --git a/haiti-bom/pom.xml b/haiti-bom/pom.xml index b6b00fd..08587a5 100644 --- a/haiti-bom/pom.xml +++ b/haiti-bom/pom.xml @@ -9,7 +9,7 @@ 1.5.0 pom - Haiti BOM + Haiti Dependencies Current versions of the framework dependencies https://github.com/haiti-projects/haiti-framework @@ -38,11 +38,11 @@ ${haiti.ver} ${haiti.ver} - 0.0.4 + 1.4.0 0.0.4 0.0.4 - 0.0.1 + 0.0.5 4.3.1 2.6.1 @@ -181,8 +181,8 @@ maven-compiler-plugin ${plugin.maven.compiler.ver} - 11 - 11 + ${maven.compiler.source} + ${maven.compiler.target} @@ -218,19 +218,6 @@ - - org.apache.maven.plugins - maven-javadoc-plugin - ${plugin.maven.javadoc.ver} - - - attach-javadocs - - jar - - - - org.apache.maven.plugins maven-gpg-plugin diff --git a/haiti-context/.gitignore b/haiti-context/.gitignore deleted file mode 100644 index 58ae9ed..0000000 --- a/haiti-context/.gitignore +++ /dev/null @@ -1,51 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -*.class -*.log -*.ctxt -.mtj.tmp/ -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar -hs_err_pid* -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf -.idea/**/contentModel.xml -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml -.idea/**/gradle.xml -.idea/**/libraries -cmake-build-*/ -.idea/**/mongoSettings.xml -*.iws -out/ -.idea_modules/ -atlassian-ide-plugin.xml -.idea/replstate.xml -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties -.idea/httpRequests -.idea/caches/build_file_checksums.ser diff --git a/haiti-context/pom.xml b/haiti-context/pom.xml deleted file mode 100644 index 853da60..0000000 --- a/haiti-context/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - 4.0.0 - - dev.struchkov.haiti - haiti - 1.5.0 - - - haiti-context - ${haiti.context.ver} - - Haiti Context - Basic framework general classes - https://github.com/haiti-projects/haiti-framework - - - 11 - ${java.version} - ${java.version} - UTF-8 - UTF-8 - - - - - dev.struchkov.haiti - haiti-exception - - - dev.struchkov.haiti - haiti-utils - - - - \ No newline at end of file diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/anotation/Marker.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/anotation/Marker.java deleted file mode 100644 index f0c6d84..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/anotation/Marker.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.struchkov.haiti.context.anotation; - -/** - * Маркер для разграничения политик валидации. - * - * @author upagge 26.05.20 - */ -public interface Marker { - - interface Create { - - } - - interface Update { - - } - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/domain/BasicEntity.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/domain/BasicEntity.java deleted file mode 100644 index d239269..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/domain/BasicEntity.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.struchkov.haiti.context.domain; - -/** - * Базовая класс для сущностей. - * - * @author upagge 14.01.2021 - */ -public interface BasicEntity { - - Key getId(); - - void setId(Key id); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/domain/ExistsContainer.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/domain/ExistsContainer.java deleted file mode 100644 index b6d6b49..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/domain/ExistsContainer.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.struchkov.haiti.context.domain; - -import java.util.Collection; -import java.util.Collections; - -import static dev.struchkov.haiti.utils.Inspector.isNotNull; - -/** - * Контейнер для возврата результата сервисных методов exists. - * - * @author upagge 11.01.2021 - */ -public class ExistsContainer { - - protected final Collection container; - protected final boolean allFound; - protected final Collection idNoFound; - - protected ExistsContainer(Collection container, boolean allFound, Collection idNoFound) { - this.container = container; - this.allFound = allFound; - this.idNoFound = idNoFound; - } - - public static ExistsContainer allFind(Collection container) { - isNotNull(container); - return new ExistsContainer<>(container, true, Collections.emptyList()); - } - - public static ExistsContainer notAllFind(Collection container, Collection idNoFound) { - isNotNull(container, idNoFound); - return new ExistsContainer<>(container, false, idNoFound); - } - - public Collection getContainer() { - return container; - } - - public boolean isAllFound() { - return allFound; - } - - public Collection getIdNoFound() { - return idNoFound; - } - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/enums/TypeSort.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/enums/TypeSort.java deleted file mode 100644 index bafb82b..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/enums/TypeSort.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.struchkov.haiti.context.enums; - -/** - * Допустимые типы сортировки. - * - * @author upagge 28.01.2020 - */ -public enum TypeSort { - - ASC, DESC - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Pagination.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Pagination.java deleted file mode 100644 index d6be34a..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Pagination.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.struchkov.haiti.context.page; - -import java.util.Set; - -public interface Pagination { - - Integer getPage(); - - Integer getSize(); - - Set getSorts(); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Sheet.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Sheet.java deleted file mode 100644 index af12211..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Sheet.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.struchkov.haiti.context.page; - -import java.util.List; -import java.util.function.Function; - -public interface Sheet { - - int getNumber(); - - int getSize(); - - long getTotalElement(); - - int getTotalPage(); - - List getContent(); - - boolean hasContent(); - - Sheet map(Function converter); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Sort.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Sort.java deleted file mode 100644 index 723308e..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/Sort.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.struchkov.haiti.context.page; - -import dev.struchkov.haiti.context.enums.TypeSort; - -public interface Sort { - - TypeSort getType(); - - String getField(); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/PaginationImpl.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/PaginationImpl.java deleted file mode 100644 index ce3a7ab..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/PaginationImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.struchkov.haiti.context.page.impl; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sort; - -import java.util.Set; - -public class PaginationImpl implements Pagination { - - private final Integer page; - private final Integer size; - private Set sorts; - - private PaginationImpl(int page, int size) { - this.page = page; - this.size = size; - } - - public PaginationImpl(int page, int size, Set sorts) { - this.page = page; - this.size = size; - this.sorts = sorts; - } - - public static Pagination of(int page, int size) { - return new PaginationImpl(page, size); - } - - public static Pagination of(int page, int size, Set sorts) { - return new PaginationImpl(page, size, sorts); - } - - @Override - public Integer getPage() { - return page; - } - - @Override - public Integer getSize() { - return size; - } - - @Override - public Set getSorts() { - return sorts; - } -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/SheetImpl.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/SheetImpl.java deleted file mode 100644 index d2c9d18..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/SheetImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -package dev.struchkov.haiti.context.page.impl; - -import dev.struchkov.haiti.context.page.Sheet; - -import java.util.Collections; -import java.util.List; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -public class SheetImpl implements Sheet { - - private final int number; - private final int size; - private final long totalElement; - private final int totalPage; - private final List content; - - public SheetImpl(int number, int size, long totalElement, int totalPage, List content) { - this.number = number; - this.size = size; - this.totalElement = totalElement; - this.totalPage = totalPage; - this.content = content; - } - - @Override - public Sheet map(Function function) { - return new SheetImpl<>( - this.number, - this.size, - this.totalElement, - this.totalPage, - this.content.stream().map(function).collect(Collectors.toList()) - ); - } - - public static Sheet empty() { - return new SheetImpl<>( - 0, - 0, - 0L, - 0, - Collections.emptyList() - ); - } - - public Sheet filter(Predicate predicate) { - final List filterContent = content.stream().filter(predicate).collect(Collectors.toList()); - return new SheetImpl<>( - this.number, - this.size, - this.totalElement, - this.totalPage, - filterContent - ); - } - - public boolean hasContent() { - return content != null && !content.isEmpty(); - } - - @Override - public int getNumber() { - return number; - } - - @Override - public int getSize() { - return size; - } - - @Override - public long getTotalElement() { - return totalElement; - } - - @Override - public int getTotalPage() { - return totalPage; - } - - @Override - public List getContent() { - return content; - } - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/SortImpl.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/SortImpl.java deleted file mode 100644 index 662e277..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/page/impl/SortImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package dev.struchkov.haiti.context.page.impl; - -import dev.struchkov.haiti.context.enums.TypeSort; -import dev.struchkov.haiti.context.page.Sort; - -import static dev.struchkov.haiti.utils.Inspector.isNotNull; - -public class SortImpl implements Sort { - - private final TypeSort type; - private final String field; - - private SortImpl(TypeSort type, String field) { - this.type = type; - this.field = field; - } - - public static Sort of(TypeSort type, String field) { - isNotNull(type); - return new SortImpl(type, field); - } - - @Override - public TypeSort getType() { - return type; - } - - @Override - public String getField() { - return field; - } - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/SimpleManagerRepository.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/SimpleManagerRepository.java deleted file mode 100644 index cd09938..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/SimpleManagerRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.struchkov.haiti.context.repository; - -import dev.struchkov.haiti.context.repository.simple.CrudOperation; -import dev.struchkov.haiti.context.repository.simple.MultipleOperation; -import dev.struchkov.haiti.context.repository.simple.PagingOperation; -import dev.struchkov.haiti.context.domain.BasicEntity; - -public interface SimpleManagerRepository, K> - extends CrudOperation, MultipleOperation, PagingOperation { - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/CrudOperation.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/CrudOperation.java deleted file mode 100644 index a6e5e4c..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/CrudOperation.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.struchkov.haiti.context.repository.simple; - -import java.util.Optional; - -/** - * Контракт для реализации объекта, который будет взаимодействовать с хранилищем данных. - * - * @param Класс сущности - * @param Класс идентификатора - * @author upagge - */ -public interface CrudOperation { - - /** - * Сохраняет сущность в базу данных. Не проверяет на наличие в хранилище. - * Если сущность с подобным идентификатором уже есть, то необходимо ее перезаписать. - * - * @param entity Сущность для сохранения - * @return Сохраненная сущность - */ - Entity save(Entity entity); - - Optional findById(Key id); - - boolean existsById(Key id); - - void deleteById(Key id); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/MultipleOperation.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/MultipleOperation.java deleted file mode 100644 index 09bda10..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/MultipleOperation.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.struchkov.haiti.context.repository.simple; - -import dev.struchkov.haiti.context.domain.BasicEntity; - -import java.util.Collection; -import java.util.List; - -public interface MultipleOperation, K> { - - List saveAll(Collection entities); - - void deleteAllById(Collection primaryKeys); - - List findAllById(Collection ids); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/PagingOperation.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/PagingOperation.java deleted file mode 100644 index f9a6c27..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/repository/simple/PagingOperation.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.struchkov.haiti.context.repository.simple; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; - -public interface PagingOperation { - - Sheet findAll(Pagination pagination); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/SimpleManagerService.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/service/SimpleManagerService.java deleted file mode 100644 index c802917..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/SimpleManagerService.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.struchkov.haiti.context.service; - -import dev.struchkov.haiti.context.domain.BasicEntity; -import dev.struchkov.haiti.context.service.simple.MultipleService; -import dev.struchkov.haiti.context.service.simple.PagingService; -import dev.struchkov.haiti.context.service.simple.SimpleService; - -public interface SimpleManagerService, Key> - extends SimpleService, MultipleService, PagingService { - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/FilterService.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/FilterService.java deleted file mode 100644 index b2e02cb..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/FilterService.java +++ /dev/null @@ -1,39 +0,0 @@ -package dev.struchkov.haiti.context.service.simple; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; - -import java.util.Optional; - -public interface FilterService { - - /** - * Получить все элементы по заданному фильтру. - * - * @param filter Фильтр - * @param pagination Пагинация - */ - Sheet getAll(Filter filter, Pagination pagination); - - /** - * Возвращает первый найденный объект по фильтру. - * - * @param filter Объект фильтра - */ - Optional getFirst(Filter filter); - - /** - * Проверка на наличие хотя бы одной сущности, которая удовлетворяет определенному набору параметров. - * - * @param filter Набор параметров - */ - boolean exists(Filter filter); - - /** - * Получить количество сущностей, которые удовлетворяют определенному набору параметров. - * - * @param filter Набор параметров - */ - long count(Filter filter); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/MultipleService.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/MultipleService.java deleted file mode 100644 index d28c61e..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/MultipleService.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.struchkov.haiti.context.service.simple; - -import dev.struchkov.haiti.context.domain.BasicEntity; -import dev.struchkov.haiti.context.domain.ExistsContainer; - -import java.util.Collection; -import java.util.List; - -public interface MultipleService, Key> { - - List createAll(Collection entities); - - List updateAll(Collection entities); - - void deleteAllById(Collection ids); - - ExistsContainer existsById(Collection ids); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/PagingService.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/PagingService.java deleted file mode 100644 index bb84006..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/PagingService.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.struchkov.haiti.context.service.simple; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; - -/** - * Расширение базового контракта сервисов с добавлением пагинации. - * - * @param Сущность сервиса. - * @author upagge 26.05.20 - */ -public interface PagingService { - - Sheet getAll(Pagination pagination); - -} diff --git a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/SimpleService.java b/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/SimpleService.java deleted file mode 100644 index 573c442..0000000 --- a/haiti-context/src/main/java/dev/struchkov/haiti/context/service/simple/SimpleService.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.struchkov.haiti.context.service.simple; - -import java.util.Optional; - -/** - * Базовый контракт для сервисов. - * - * @param Сущность сервиса. - */ -public interface SimpleService { - - Entity create(Entity entity); - - Entity update(Entity entity); - - Optional getById(Key id); - - Entity getByIdOrThrow(Key id); - - boolean existsById(Key id); - - void deleteById(Key id); - -} diff --git a/haiti-context/src/main/java/module-info.java b/haiti-context/src/main/java/module-info.java deleted file mode 100644 index 2876ed6..0000000 --- a/haiti-context/src/main/java/module-info.java +++ /dev/null @@ -1,12 +0,0 @@ -module haiti.context { - exports dev.struchkov.haiti.context.service.simple; - exports dev.struchkov.haiti.context.repository.simple; - exports dev.struchkov.haiti.context.page.impl; - exports dev.struchkov.haiti.context.repository; - exports dev.struchkov.haiti.context.domain; - exports dev.struchkov.haiti.context.service; - exports dev.struchkov.haiti.context.page; - exports dev.struchkov.haiti.context.enums; - - requires transitive haiti.utils; -} \ No newline at end of file diff --git a/haiti-core/.gitignore b/haiti-core/.gitignore deleted file mode 100644 index 58ae9ed..0000000 --- a/haiti-core/.gitignore +++ /dev/null @@ -1,51 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -*.class -*.log -*.ctxt -.mtj.tmp/ -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar -hs_err_pid* -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf -.idea/**/contentModel.xml -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml -.idea/**/gradle.xml -.idea/**/libraries -cmake-build-*/ -.idea/**/mongoSettings.xml -*.iws -out/ -.idea_modules/ -atlassian-ide-plugin.xml -.idea/replstate.xml -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties -.idea/httpRequests -.idea/caches/build_file_checksums.ser diff --git a/haiti-core/pom.xml b/haiti-core/pom.xml deleted file mode 100644 index 37a0f89..0000000 --- a/haiti-core/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - dev.struchkov.haiti - haiti - 1.5.0 - - - haiti-core - ${haiti.core.ver} - - Haiti Core - Implementation of the main classes of the framework - https://github.com/haiti-projects/haiti-framework - - - 11 - ${java.version} - ${java.version} - UTF-8 - UTF-8 - - - - - dev.struchkov.haiti - haiti-context - - - - dev.struchkov.haiti - haiti-filter - - - - \ No newline at end of file diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/repository/SimpleManagerRepositoryMap.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/repository/SimpleManagerRepositoryMap.java deleted file mode 100644 index 02b203b..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/repository/SimpleManagerRepositoryMap.java +++ /dev/null @@ -1,77 +0,0 @@ -package dev.struchkov.haiti.core.repository; - -import dev.struchkov.haiti.context.domain.BasicEntity; -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; -import dev.struchkov.haiti.context.repository.SimpleManagerRepository; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -import static dev.struchkov.haiti.utils.Inspector.isNotNull; -import static dev.struchkov.haiti.utils.Strings.ERR_OPERATION_NOT_SUPPORTED; - -public class SimpleManagerRepositoryMap> implements SimpleManagerRepository { - - protected final Map map = new HashMap<>(); - protected long key = 0; - - @Override - public T save(T accessTarget) { - isNotNull(accessTarget); - accessTarget.setId(key); - map.put(key, accessTarget); - key++; - return accessTarget; - } - - @Override - public Optional findById(Long id) { - isNotNull(id); - return Optional.ofNullable(map.get(id)); - } - - @Override - public boolean existsById(Long id) { - isNotNull(id); - return map.containsKey(id); - } - - @Override - public void deleteById(Long id) { - isNotNull(id); - map.remove(id); - } - - @Override - public List saveAll(Collection accessTargets) { - isNotNull(accessTargets); - return accessTargets.stream() - .map(this::save) - .collect(Collectors.toList()); - } - - @Override - public void deleteAllById(Collection accessTargets) { - isNotNull(accessTargets); - accessTargets.forEach(map::remove); - } - - @Override - public List findAllById(Collection ids) { - isNotNull(ids); - return ids.stream() - .map(map::get) - .collect(Collectors.toList()); - } - - @Override - public Sheet findAll(Pagination pagination) { - throw new IllegalStateException(ERR_OPERATION_NOT_SUPPORTED); - } - -} diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractFilterService.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractFilterService.java deleted file mode 100644 index d0f8b06..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractFilterService.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.struchkov.haiti.core.service; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; -import dev.struchkov.haiti.context.service.simple.FilterService; -import dev.struchkov.haiti.filter.Filter; -import dev.struchkov.haiti.filter.FilterOperation; -import dev.struchkov.haiti.utils.Inspector; - -import java.util.Optional; - -public abstract class AbstractFilterService implements FilterService { - - protected final FilterOperation filterOperation; - - protected AbstractFilterService(FilterOperation filterOperation) { - this.filterOperation = filterOperation; - } - - @Override - public Sheet getAll(F filter, Pagination pagination) { - Inspector.isNotNull(filter); - return filterOperation.findAll(createFilter(filter), pagination); - } - - @Override - public Optional getFirst(F filter) { - Inspector.isNotNull(filter); - return filterOperation.findFirst(createFilter(filter)); - } - - @Override - public boolean exists(F filter) { - Inspector.isNotNull(filter); - return filterOperation.exists(createFilter(filter)); - } - - @Override - public long count(F filter) { - Inspector.isNotNull(filter); - return filterOperation.count(createFilter(filter)); - } - - protected abstract Filter createFilter(F filter); - -} diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractMultipleService.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractMultipleService.java deleted file mode 100644 index e07aa1e..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractMultipleService.java +++ /dev/null @@ -1,49 +0,0 @@ -package dev.struchkov.haiti.core.service; - -import dev.struchkov.haiti.context.domain.BasicEntity; -import dev.struchkov.haiti.context.domain.ExistsContainer; -import dev.struchkov.haiti.context.repository.simple.MultipleOperation; -import dev.struchkov.haiti.context.service.simple.MultipleService; -import dev.struchkov.haiti.context.service.simple.SimpleService; -import dev.struchkov.haiti.core.util.ServiceOperation; -import dev.struchkov.haiti.utils.Inspector; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -public abstract class AbstractMultipleService, Key> implements MultipleService { - - private final SimpleService simpleService; - private final MultipleOperation multipleOperation; - - protected AbstractMultipleService(SimpleService simpleService, MultipleOperation multipleOperation) { - this.simpleService = simpleService; - this.multipleOperation = multipleOperation; - } - - @Override - public void deleteAllById(Collection ids) { - Inspector.isNotNull(ids); - multipleOperation.deleteAllById(ids); - } - - @Override - public List createAll(Collection entities) { - Inspector.isNotNull(entities); - return entities.stream().map(simpleService::create).collect(Collectors.toList()); - } - - @Override - public List updateAll(Collection entities) { - Inspector.isNotNull(entities); - return entities.stream().map(simpleService::update).collect(Collectors.toList()); - } - - @Override - public ExistsContainer existsById(Collection ids) { - Inspector.isNotNull(ids); - return ServiceOperation.existsContainerById(multipleOperation, ids); - } - -} diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractPagingService.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractPagingService.java deleted file mode 100644 index 6a0fa03..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractPagingService.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.struchkov.haiti.core.service; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; -import dev.struchkov.haiti.context.repository.simple.PagingOperation; -import dev.struchkov.haiti.context.service.simple.PagingService; -import dev.struchkov.haiti.utils.Inspector; - -public abstract class AbstractPagingService implements PagingService { - - private final PagingOperation pagingOperation; - - protected AbstractPagingService(PagingOperation pagingOperation) { - this.pagingOperation = pagingOperation; - } - - @Override - public Sheet getAll(Pagination pagination) { - Inspector.isNotNull(pagination); - return pagingOperation.findAll(pagination); - } - -} diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractSimpleManagerService.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractSimpleManagerService.java deleted file mode 100644 index 5c2a384..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractSimpleManagerService.java +++ /dev/null @@ -1,81 +0,0 @@ -package dev.struchkov.haiti.core.service; - -import dev.struchkov.haiti.context.domain.BasicEntity; -import dev.struchkov.haiti.context.domain.ExistsContainer; -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; -import dev.struchkov.haiti.context.repository.SimpleManagerRepository; -import dev.struchkov.haiti.context.service.SimpleManagerService; -import dev.struchkov.haiti.core.util.ServiceOperation; -import dev.struchkov.haiti.utils.Inspector; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -import static dev.struchkov.haiti.context.exception.NotFoundException.notFoundException; - -public abstract class AbstractSimpleManagerService, Key> implements SimpleManagerService { - - protected final SimpleManagerRepository repository; - - protected AbstractSimpleManagerService(SimpleManagerRepository repository) { - this.repository = repository; - } - - @Override - public void deleteAllById(Collection ids) { - Inspector.isNotNull(ids); - ServiceOperation.deleteAllById(repository, ids); - } - - @Override - public Sheet getAll(Pagination pagination) { - Inspector.isNotNull(pagination); - return ServiceOperation.getAll(repository, pagination); - } - - @Override - public Optional getById(Key id) { - Inspector.isNotNull(id); - return ServiceOperation.getById(repository, id); - } - - @Override - public Entity getByIdOrThrow(Key id) { - Inspector.isNotNull(id); - return getById(id).orElseThrow(notFoundException("Объект не найден. Идентификатор: ", id)); - } - - @Override - public boolean existsById(Key id) { - Inspector.isNotNull(id); - return ServiceOperation.existsById(repository, id); - } - - @Override - public void deleteById(Key id) { - Inspector.isNotNull(id); - ServiceOperation.deleteById(repository, id); - } - - @Override - public List createAll(Collection entities) { - Inspector.isNotNull(entities); - return entities.stream().map(this::create).collect(Collectors.toList()); - } - - @Override - public List updateAll(Collection entities) { - Inspector.isNotNull(entities); - return entities.stream().map(this::update).collect(Collectors.toList()); - } - - @Override - public ExistsContainer existsById(Collection ids) { - Inspector.isNotNull(ids); - return ServiceOperation.existsContainerById(repository, ids); - } - -} diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractSimpleService.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractSimpleService.java deleted file mode 100644 index fd30b60..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/service/AbstractSimpleService.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.struchkov.haiti.core.service; - -import dev.struchkov.haiti.context.repository.simple.CrudOperation; -import dev.struchkov.haiti.context.service.simple.SimpleService; -import dev.struchkov.haiti.core.util.ServiceOperation; -import dev.struchkov.haiti.utils.Inspector; - -import java.util.Optional; - -public abstract class AbstractSimpleService implements SimpleService { - - private final CrudOperation crudOperation; - - protected AbstractSimpleService(CrudOperation crudOperation) { - this.crudOperation = crudOperation; - } - - @Override - public Optional getById(Key id) { - Inspector.isNotNull(id); - return ServiceOperation.getById(crudOperation, id); - } - - @Override - public boolean existsById(Key id) { - Inspector.isNotNull(id); - return ServiceOperation.existsById(crudOperation, id); - } - - @Override - public void deleteById(Key id) { - Inspector.isNotNull(id); - ServiceOperation.deleteById(crudOperation, id); - } - -} diff --git a/haiti-core/src/main/java/dev/struchkov/haiti/core/util/ServiceOperation.java b/haiti-core/src/main/java/dev/struchkov/haiti/core/util/ServiceOperation.java deleted file mode 100644 index 8392c47..0000000 --- a/haiti-core/src/main/java/dev/struchkov/haiti/core/util/ServiceOperation.java +++ /dev/null @@ -1,60 +0,0 @@ -package dev.struchkov.haiti.core.util; - -import dev.struchkov.haiti.context.domain.BasicEntity; -import dev.struchkov.haiti.context.domain.ExistsContainer; -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; -import dev.struchkov.haiti.context.repository.simple.CrudOperation; -import dev.struchkov.haiti.context.repository.simple.MultipleOperation; -import dev.struchkov.haiti.context.repository.simple.PagingOperation; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import static dev.struchkov.haiti.utils.Exceptions.utilityClass; - -public final class ServiceOperation { - - private ServiceOperation() { - utilityClass(); - } - - public static , Key> void deleteAllById(MultipleOperation repository, Collection ids) { - repository.deleteAllById(ids); - } - - public static Sheet getAll(PagingOperation repository, Pagination pagination) { - return repository.findAll(pagination); - } - - public static Optional getById(CrudOperation repository, Key id) { - return repository.findById(id); - } - - public static boolean existsById(CrudOperation repository, Key id) { - return repository.existsById(id); - } - - public static void deleteById(CrudOperation repository, Key id) { - repository.deleteById(id); - } - - public static > ExistsContainer existsContainerById(MultipleOperation multipleOperation, Collection ids) { - final List existsEntity = multipleOperation.findAllById(ids); - final Set existsIds = existsEntity.stream() - .map(BasicEntity::getId) - .collect(Collectors.toSet()); - if (existsIds.containsAll(ids)) { - return ExistsContainer.allFind(existsEntity); - } else { - final Set noExistsId = ids.stream() - .filter(id -> !existsIds.contains(id)) - .collect(Collectors.toSet()); - return ExistsContainer.notAllFind(existsEntity, noExistsId); - } - } - -} diff --git a/haiti-core/src/main/java/module-info.java b/haiti-core/src/main/java/module-info.java deleted file mode 100644 index a60e1b5..0000000 --- a/haiti-core/src/main/java/module-info.java +++ /dev/null @@ -1,5 +0,0 @@ -module haiti.core { - requires haiti.context; - requires haiti.exception; - requires haiti.filter; -} \ No newline at end of file diff --git a/haiti-exception/pom.xml b/haiti-exception/pom.xml index 986e23d..9215bb2 100644 --- a/haiti-exception/pom.xml +++ b/haiti-exception/pom.xml @@ -5,8 +5,8 @@ 4.0.0 dev.struchkov.haiti - haiti - 1.5.0 + haiti-dependencies + 2.0.0 haiti-exception @@ -16,12 +16,4 @@ General exceptions for the haiti project https://github.com/haiti-projects/haiti-framework - - 11 - ${java.version} - ${java.version} - UTF-8 - UTF-8 - - \ No newline at end of file diff --git a/haiti-external-bom/pom.xml b/haiti-external-bom/pom.xml new file mode 100644 index 0000000..8e8784f --- /dev/null +++ b/haiti-external-bom/pom.xml @@ -0,0 +1,147 @@ + + + 4.0.0 + + dev.struchkov.haiti + haiti-external-bom + 2.0.0 + pom + + Haiti External Dependencies + External dependencies required for Haiti components + https://github.com/haiti-projects/haiti-framework + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0 + + + + GitHub + https://github.com/haiti-projects/haiti-framework/issues + + + + 11 + ${java.version} + ${java.version} + UTF-8 + UTF-8 + + 3.10.1 + 1.6.13 + 3.2.1 + 3.0.1 + + + + + + javax.persistence + javax.persistence-api + 2.2 + + + com.google.auto.service + auto-service + 1.0.1 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${plugin.maven.compiler.ver} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + + + release + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${plugin.nexus.staging.ver} + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-source-plugin + ${plugin.maven.source.ver} + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${plugin.maven.gpg.ver} + + + sign-artifacts + verify + + sign + + + + + + + + + + + scm:git:https://github.com/haiti-projects/haiti-framework.git + https://github.com/haiti-projects/haiti-framework + scm:git:https://github.com/haiti-projects/haiti-framework.git + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + + uPagge + Struchkov Mark + mark@struchkov.dev + https://mark.struchkov.dev + + + + \ No newline at end of file diff --git a/haiti-filter/pom.xml b/haiti-filter/pom.xml deleted file mode 100644 index 472cc7e..0000000 --- a/haiti-filter/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - dev.struchkov.haiti - haiti - 1.5.0 - - - haiti-filter - ${haiti.filter.api.ver} - - Haiti Filter - Fast and convenient filtering requests to data warehouses. - https://github.com/haiti-projects/haiti-framework - - - 11 - ${java.version} - ${java.version} - UTF-8 - UTF-8 - - - - - dev.struchkov.haiti - haiti-context - - - - \ No newline at end of file diff --git a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/Filter.java b/haiti-filter/src/main/java/dev/struchkov/haiti/filter/Filter.java deleted file mode 100644 index 3a975b8..0000000 --- a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/Filter.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.struchkov.haiti.filter; - -import java.util.function.Consumer; - -public interface Filter { - - Filter and(FilterQuery filterQuery); - - Filter and(Consumer query); - - Filter or(FilterQuery filterQuery); - - Filter or(Consumer query); - - Filter not(FilterQuery filterQuery); - - Filter not(Consumer query); - - Q build(); - -} diff --git a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/FilterOperation.java b/haiti-filter/src/main/java/dev/struchkov/haiti/filter/FilterOperation.java deleted file mode 100644 index fe98fca..0000000 --- a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/FilterOperation.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.struchkov.haiti.filter; - -import dev.struchkov.haiti.context.page.Pagination; -import dev.struchkov.haiti.context.page.Sheet; - -import java.util.Optional; - -public interface FilterOperation { - - Sheet findAll(Filter filter, Pagination pagination); - - Optional findFirst(Filter filter); - - boolean exists(Filter filter); - - long count(Filter filter); - -} diff --git a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/FilterQuery.java b/haiti-filter/src/main/java/dev/struchkov/haiti/filter/FilterQuery.java deleted file mode 100644 index cb7bddf..0000000 --- a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/FilterQuery.java +++ /dev/null @@ -1,61 +0,0 @@ -package dev.struchkov.haiti.filter; - -import java.util.Set; - -public interface FilterQuery { - - /** - * Добавляет в запрос поиск по диапазону. - * - * @param field Название поля в elasticsearch - * @param from Начало интервала - * @param to Конец интервала - */ - > FilterQuery between(String field, Y from, Y to); - - > FilterQuery greaterThan(String field, Y value); - - > FilterQuery lessThan(String field, Y value); - - /** - * Добавляет в запрос проверку по значению поля - * - * @param field Название поля - * @param value Значение поля для проверки - */ - FilterQuery matchPhrase(String field, Object value); - - /** - * Добавляет в запрос проверку по нескольким значениям одного поля - * - * @param field Название поля - * @param value Значения поля - */ - FilterQuery matchPhrase(String field, Set value); - - /** - * Добавляет в запрос проверку на NULL значение поля - * - * @param field Наименование поля - */ - FilterQuery exists(String field); - - /** - * Поиск подстрок - * - * @param field Названия поля - * @param value Часть искомого значения - */ - FilterQuery like(String field, String value, boolean ignoreCase); - - /** - * Добавляет в запрос поиск по флагу, который конвертируется в диапазон - * - * @param flag Значение флага - * @param field Поле для проверки - */ - FilterQuery checkBoolInt(String field, Boolean flag); - - Q build(); - -} diff --git a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/exception/BadFilterConstructorException.java b/haiti-filter/src/main/java/dev/struchkov/haiti/filter/exception/BadFilterConstructorException.java deleted file mode 100644 index 380bff6..0000000 --- a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/exception/BadFilterConstructorException.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.struchkov.haiti.filter.exception; - -public class BadFilterConstructorException extends FilterException { - - public BadFilterConstructorException(String s) { - super(s); - } - -} diff --git a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/exception/FilterException.java b/haiti-filter/src/main/java/dev/struchkov/haiti/filter/exception/FilterException.java deleted file mode 100644 index 6c35025..0000000 --- a/haiti-filter/src/main/java/dev/struchkov/haiti/filter/exception/FilterException.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.struchkov.haiti.filter.exception; - -import dev.struchkov.haiti.context.exception.BasicException; - -/** - * Исключения связанные с работой фильтров. - * - * @author upagge 09.11.2020 - */ -public class FilterException extends BasicException { - - protected FilterException(String message) { - super(message); - } - - protected FilterException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/haiti-filter/src/main/java/module-info.java b/haiti-filter/src/main/java/module-info.java deleted file mode 100644 index f049a3a..0000000 --- a/haiti-filter/src/main/java/module-info.java +++ /dev/null @@ -1,6 +0,0 @@ -module haiti.filter { - exports dev.struchkov.haiti.filter; - - requires haiti.exception; - requires haiti.context; -} \ No newline at end of file diff --git a/haiti-utils/pom.xml b/haiti-utils/pom.xml index 51e13b3..a809fd0 100644 --- a/haiti-utils/pom.xml +++ b/haiti-utils/pom.xml @@ -5,8 +5,8 @@ 4.0.0 dev.struchkov.haiti - haiti - 1.5.0 + haiti-dependencies + 2.0.0 Haiti Utils @@ -16,14 +16,6 @@ haiti-utils ${haiti.utils.ver} - - 11 - ${java.version} - ${java.version} - UTF-8 - UTF-8 - - dev.struchkov.haiti diff --git a/pom.xml b/pom.xml index e449b59..814da54 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,8 @@ 4.0.0 dev.struchkov.haiti - haiti - 1.5.0 + haiti-dependencies + 2.0.0 pom Haiti Framework @@ -24,12 +24,8 @@ - haiti-bom haiti-exception haiti-utils - haiti-context - haiti-core - haiti-filter @@ -39,15 +35,10 @@ UTF-8 UTF-8 - ${project.version} - - ${haiti.ver} + 2.0.0 ${haiti.ver} ${haiti.ver} - ${haiti.ver} ${haiti.ver} - ${haiti.ver} - ${haiti.ver} ${haiti.ver} 3.10.1 @@ -61,11 +52,21 @@ dev.struchkov.haiti - haiti-bom - ${haiti.bom.ver} + haiti-external-bom + ${haiti.ver} pom import + + dev.struchkov.haiti + haiti-exception + ${haiti.exception.ver} + + + dev.struchkov.haiti + haiti-utils + ${haiti.utils.ver} +