release-0.0.2

This commit is contained in:
Struchkov Mark 2022-01-13 13:53:02 +03:00
parent cf68f1738e
commit dbdae65df9
23 changed files with 690 additions and 417 deletions

View File

@ -6,12 +6,231 @@
<groupId>dev.struchkov.haiti</groupId> <groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-bom</artifactId> <artifactId>haiti-bom</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Haiti BOM</name> <name>Haiti BOM</name>
<description>Current versions of the framework dependencies</description> <description>Current versions of the framework dependencies</description>
<url>https://github.com/haiti-projects/haiti-framework</url> <url>https://github.com/haiti-projects/haiti-framework</url>
<properties>
<skip.deploy>true</skip.deploy>
<java.version>11</java.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<haiti.exception.ver>0.0.2</haiti.exception.ver>
<haiti.context.ver>0.0.2</haiti.context.ver>
<haiti.core.ver>0.0.2</haiti.core.ver>
<haiti.filter.api.ver>0.0.2</haiti.filter.api.ver>
<haiti.filter.criteria.ver>0.0.2</haiti.filter.criteria.ver>
<haiti.database.ver>0.0.2</haiti.database.ver>
<haiti.utils.ver>0.0.2</haiti.utils.ver>
<spring.data.elasticsearch.ver>4.1.0</spring.data.elasticsearch.ver>
<spring.data.jpa.ver>2.4.0</spring.data.jpa.ver>
<spring.data.commons.ver>2.4.0</spring.data.commons.ver>
<javax.persisttence.api.ver>2.2</javax.persisttence.api.ver>
<elasticsearch.ver>7.9.3</elasticsearch.ver>
<lombok.ver>1.18.22</lombok.ver>
<slf4j.ver>1.7.32</slf4j.ver>
<plugin.nexus.staging.ver>1.6.8</plugin.nexus.staging.ver>
<plugin.maven.compiler.ver>3.8.0</plugin.maven.compiler.ver>
<plugin.maven.source.ver>3.2.1</plugin.maven.source.ver>
<plugin.maven.javadoc.ver>3.3.1</plugin.maven.javadoc.ver>
<plugin.maven.gpg.ver>3.0.1</plugin.maven.gpg.ver>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-exception</artifactId>
<version>${haiti.exception.ver}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-context</artifactId>
<version>${haiti.exception.ver}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-context</artifactId>
<version>${haiti.context.ver}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-core</artifactId>
<version>${haiti.core.ver}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-filter</artifactId>
<version>${haiti.filter.api.ver}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti.filter</groupId>
<artifactId>haiti-filter-criteria</artifactId>
<version>${haiti.filter.criteria.ver}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-utils</artifactId>
<version>${haiti.utils.ver}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.ver}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.ver}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>${javax.persisttence.api.ver}</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>${spring.data.elasticsearch.ver}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring.data.commons.ver}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data.jpa.ver}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.ver}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${plugin.nexus.staging.ver}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${plugin.maven.source.ver}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.maven.javadoc.ver}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${plugin.maven.gpg.ver}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.maven.compiler.ver}</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
<scm>
<connection>scm:git:https://github.com/haiti-projects/haiti-framework.git</connection>
<url>https://github.com/haiti-projects/haiti-framework</url>
<developerConnection>scm:git:https://github.com/haiti-projects/haiti-framework.git</developerConnection>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<url>https://mark.struchkov.dev</url>
</developer>
</developers>
<licenses> <licenses>
<license> <license>
<name>Apache License, Version 2.0</name> <name>Apache License, Version 2.0</name>
@ -35,210 +254,4 @@
</license> </license>
</licenses> </licenses>
<organization>
<name>Struchkov Inc.</name>
<url>https://mark.struchkov.dev</url>
</organization>
<scm>
<connection>scm:git:https://github.com/haiti-projects/haiti-framework.git</connection>
<url>https://github.com/haiti-projects/haiti-framework</url>
<developerConnection>scm:git:https://github.com/haiti-projects/haiti-framework.git</developerConnection>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/haiti-projects/haiti-framework/issues</url>
</issueManagement>
<properties>
<java.version>16</java.version>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<haiti.context.version>0.0.1-SNAPSHOT</haiti.context.version>
<haiti.core.version>0.0.1-SNAPSHOT</haiti.core.version>
<haiti.filter.api.version>0.0.1-SNAPSHOT</haiti.filter.api.version>
<haiti.filter.criteria.version>0.0.1-SNAPSHOT</haiti.filter.criteria.version>
<haiti.database.version>0.0.1-RELEASE</haiti.database.version>
<haiti.utils.version>0.0.1-SNAPSHOT</haiti.utils.version>
<spring.data.elasticsearch.version>4.1.0</spring.data.elasticsearch.version>
<spring.data.jpa.version>2.4.0</spring.data.jpa.version>
<spring.data.commons.version>2.4.0</spring.data.commons.version>
<elasticsearch.version>7.9.3</elasticsearch.version>
<lombok.version>1.18.22</lombok.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-context</artifactId>
<version>${haiti.context.version}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-core</artifactId>
<version>${haiti.core.version}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-filter</artifactId>
<version>${haiti.filter.api.version}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti.filter</groupId>
<artifactId>haiti-filter-criteria</artifactId>
<version>${haiti.filter.criteria.version}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-utils</artifactId>
<version>${haiti.utils.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>${spring.data.elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring.data.commons.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data.jpa.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer>
</developers>
</project> </project>

View File

@ -6,35 +6,49 @@
<parent> <parent>
<groupId>dev.struchkov.haiti</groupId> <groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti</artifactId> <artifactId>haiti</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2</version>
</parent> </parent>
<artifactId>haiti-context</artifactId> <artifactId>haiti-context</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>${haiti.context.ver}</version>
<name>Haiti Context</name> <name>Haiti Context</name>
<description>Basic framework classes</description> <description>Basic framework classes</description>
<url>https://github.com/haiti-projects/haiti-framework</url>
<properties>
<skip.deploy>false</skip.deploy>
</properties>
<dependencies> <dependencies>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-exception</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
<developers> <developers>
<developer> <developer>
<id>uPagge</id> <id>uPagge</id>
<name>Struchkov Mark</name> <name>Struchkov Mark</name>
<email>mark@struchkov.dev</email> <email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url> <url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer> </developer>
</developers> </developers>

View File

@ -1,5 +1,7 @@
package dev.struchkov.haiti.context.domain; package dev.struchkov.haiti.context.domain;
import lombok.NonNull;
/** /**
* // TODO: 14.01.2021 Добавить описание. * // TODO: 14.01.2021 Добавить описание.
* *
@ -9,4 +11,6 @@ public interface BasicEntity<K> {
K getId(); K getId();
void setId(@NonNull K id);
} }

View File

@ -1,15 +1,13 @@
package dev.struchkov.haiti.context.page; package dev.struchkov.haiti.context.page;
import dev.struchkov.haiti.context.enums.TypeSort; import java.util.Set;
public interface Pagination { public interface Pagination {
int getPage(); Integer getPage();
int getSize(); Integer getSize();
TypeSort getTypeSort(); Set<? extends Sort> getSorts();
String getFieldSort();
} }

View File

@ -0,0 +1,11 @@
package dev.struchkov.haiti.context.page;
import dev.struchkov.haiti.context.enums.TypeSort;
public interface Sort {
TypeSort getType();
String getField();
}

View File

@ -0,0 +1,35 @@
package dev.struchkov.haiti.context.page.impl;
import dev.struchkov.haiti.context.page.Pagination;
import dev.struchkov.haiti.context.page.Sort;
import lombok.Getter;
import java.util.Set;
@Getter
public class PaginationImpl implements Pagination {
private final Integer page;
private final Integer size;
private Set<? extends Sort> sorts;
private PaginationImpl(int page, int size) {
this.page = page;
this.size = size;
}
public PaginationImpl(int page, int size, Set<? extends Sort> 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<? extends Sort> sorts) {
return new PaginationImpl(page, size, sorts);
}
}

View File

@ -1,4 +1,4 @@
package dev.struchkov.haiti.core.page; package dev.struchkov.haiti.context.page.impl;
import dev.struchkov.haiti.context.page.Sheet; import dev.struchkov.haiti.context.page.Sheet;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View File

@ -0,0 +1,21 @@
package dev.struchkov.haiti.context.page.impl;
import dev.struchkov.haiti.context.enums.TypeSort;
import dev.struchkov.haiti.context.page.Sort;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class SortImpl implements Sort {
private final TypeSort type;
private final String field;
public static Sort of(@NonNull TypeSort type, String field) {
return new SortImpl(type, field);
}
}

View File

@ -6,15 +6,18 @@
<parent> <parent>
<groupId>dev.struchkov.haiti</groupId> <groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti</artifactId> <artifactId>haiti</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2</version>
</parent> </parent>
<artifactId>haiti-core</artifactId> <artifactId>haiti-core</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>${haiti.core.ver}</version>
<name>Haiti Core</name> <name>Haiti Core</name>
<description>Implementation of the main classes of the framework</description> <description>Implementation of the main classes of the framework</description>
<url>https://github.com/haiti-projects/haiti-framework</url>
<properties>
<skip.deploy>false</skip.deploy>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -33,18 +36,24 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
<developers> <developers>
<developer> <developer>
<id>uPagge</id> <id>uPagge</id>
<name>Struchkov Mark</name> <name>Struchkov Mark</name>
<email>mark@struchkov.dev</email> <email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url> <url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer> </developer>
</developers> </developers>

View File

@ -1,35 +0,0 @@
package dev.struchkov.haiti.core.page;
import dev.struchkov.haiti.context.enums.TypeSort;
import dev.struchkov.haiti.context.page.Pagination;
import lombok.Getter;
@Getter
public class PaginationImpl implements Pagination {
private final int page;
private final int size;
private String fieldSort;
private TypeSort typeSort;
private PaginationImpl(int page, int size) {
this.page = page;
this.size = size;
}
public PaginationImpl(int page, int size, String fieldSort, TypeSort typeSort) {
this.page = page;
this.size = size;
this.fieldSort = fieldSort;
this.typeSort = typeSort;
}
public static Pagination of(int page, int size) {
return new PaginationImpl(page, size);
}
public static Pagination of(int page, int size, String fieldSort, TypeSort typeSort) {
return new PaginationImpl(page, size, fieldSort, typeSort);
}
}

View File

@ -0,0 +1,68 @@
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 lombok.NonNull;
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;
public class SimpleManagerRepositoryMap<T extends BasicEntity<Long>> implements SimpleManagerRepository<T, Long> {
protected final Map<Long, T> map = new HashMap<>();
protected long key = 0;
@Override
public T save(@NonNull T accessTarget) {
accessTarget.setId(key);
map.put(key, accessTarget);
key++;
return accessTarget;
}
@Override
public Optional<T> findById(@NonNull Long id) {
return Optional.ofNullable(map.get(id));
}
@Override
public boolean existsById(@NonNull Long id) {
return map.containsKey(id);
}
@Override
public void deleteById(@NonNull Long id) {
map.remove(id);
}
@Override
public List<T> saveAll(@NonNull Collection<T> accessTargets) {
return accessTargets.stream()
.map(this::save)
.collect(Collectors.toList());
}
@Override
public void deleteAllById(@NonNull Collection<Long> accessTargets) {
accessTargets.forEach(map::remove);
}
@Override
public List<T> findAllById(@NonNull Collection<Long> ids) {
return ids.stream()
.map(map::get)
.collect(Collectors.toList());
}
@Override
public Sheet<T> findAll(@NonNull Pagination pagination) {
return null;
}
}

43
haiti-exception/pom.xml Normal file
View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>haiti</artifactId>
<groupId>dev.struchkov.haiti</groupId>
<version>0.0.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>haiti-exception</artifactId>
<version>${haiti.exception.ver}</version>
<name>Haiti Exception</name>
<description>General exceptions for the haiti project</description>
<properties>
<skip.deploy>false</skip.deploy>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<url>https://mark.struchkov.dev</url>
</developer>
</developers>
</project>

View File

@ -1,5 +1,8 @@
package dev.struchkov.haiti.context.exception; package dev.struchkov.haiti.context.exception;
import java.text.MessageFormat;
import java.util.function.Supplier;
/** /**
* Исключения связанные с доступом. * Исключения связанные с доступом.
*/ */
@ -9,5 +12,9 @@ public class AccessException extends BasicException {
super(message); super(message);
} }
public static Supplier<AccessException> supplier(String message, Object... objects) {
return () -> new AccessException(MessageFormat.format(message, objects));
}
} }

View File

@ -6,15 +6,19 @@
<parent> <parent>
<groupId>dev.struchkov.haiti</groupId> <groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti</artifactId> <artifactId>haiti</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2</version>
</parent> </parent>
<artifactId>haiti-filter</artifactId> <artifactId>haiti-filter</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>${haiti.filter.api.ver}</version>
<packaging>jar</packaging>
<name>Haiti Filter</name> <name>Haiti Filter</name>
<description>Fast and convenient filtering requests to data warehouses.</description> <description>Fast and convenient filtering requests to data warehouses.</description>
<url>https://github.com/haiti-projects/haiti-framework</url>
<properties>
<skip.deploy>false</skip.deploy>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -28,18 +32,24 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
<developers> <developers>
<developer> <developer>
<id>uPagge</id> <id>uPagge</id>
<name>Struchkov Mark</name> <name>Struchkov Mark</name>
<email>mark@struchkov.dev</email> <email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url> <url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer> </developer>
</developers> </developers>

View File

@ -1,13 +1,21 @@
package dev.struchkov.haiti.filter; package dev.struchkov.haiti.filter;
import java.util.function.Consumer;
public interface Filter { public interface Filter {
Filter and(FilterQuery filterQuery); Filter and(FilterQuery filterQuery);
Filter and(Consumer<FilterQuery> query);
Filter or(FilterQuery filterQuery); Filter or(FilterQuery filterQuery);
Filter or(Consumer<FilterQuery> query);
Filter not(FilterQuery filterQuery); Filter not(FilterQuery filterQuery);
Filter not(Consumer<FilterQuery> query);
<Q> Q build(); <Q> Q build();
} }

View File

@ -5,37 +5,50 @@
<parent> <parent>
<groupId>dev.struchkov.haiti</groupId> <groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti</artifactId> <artifactId>haiti</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>Haiti Utils</name>
<description>Utility useful things</description>
<artifactId>haiti-utils</artifactId> <artifactId>haiti-utils</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>${haiti.utils.ver}</version>
<properties>
<skip.deploy>false</skip.deploy>
</properties>
<dependencies> <dependencies>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-exception</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-context</artifactId>
</dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
<developers> <developers>
<developer> <developer>
<id>uPagge</id> <id>uPagge</id>
<name>Struchkov Mark</name> <name>Struchkov Mark</name>
<email>mark@struchkov.dev</email> <email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url> <url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer> </developer>
</developers> </developers>

View File

@ -1,7 +1,11 @@
package dev.struchkov.haiti.utils; package dev.struchkov.haiti.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import java.util.Arrays;
import java.util.Objects;
import java.util.function.Supplier; import java.util.function.Supplier;
/** /**
@ -9,7 +13,7 @@ import java.util.function.Supplier;
* *
* @author upagge 06.09.2020 * @author upagge 06.09.2020
*/ */
@UtilityClass @NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Assert { public final class Assert {
/** /**
@ -24,6 +28,12 @@ public final class Assert {
} }
} }
public static void isAnyNotNull(Supplier<? extends RuntimeException> exception, Object... objects) {
if (Arrays.stream(objects).allMatch(Objects::isNull)) {
throw exception.get();
}
}
/** /**
* Проверка на null значение с возвращением исключения, если объект null. * Проверка на null значение с возвращением исключения, если объект null.
* *

View File

@ -10,6 +10,7 @@ import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -136,6 +137,10 @@ public class ObjectUtils {
&& method.getName().toLowerCase().endsWith(fieldName.toLowerCase()); && method.getName().toLowerCase().endsWith(fieldName.toLowerCase());
} }
public static <T> List<T> toList(T... t) {
return Arrays.stream(t).collect(Collectors.toList());
}
public static <T> Collection<T> toCollect(T... t) { public static <T> Collection<T> toCollect(T... t) {
return Arrays.stream(t).collect(Collectors.toList()); return Arrays.stream(t).collect(Collectors.toList());
} }

291
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>dev.struchkov.haiti</groupId> <groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti</artifactId> <artifactId>haiti</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
@ -15,11 +15,175 @@
<module>haiti-filter</module> <module>haiti-filter</module>
<module>haiti-bom</module> <module>haiti-bom</module>
<module>haiti-utils</module> <module>haiti-utils</module>
<module>haiti-exception</module>
</modules> </modules>
<name>Haiti Framework</name> <name>Haiti Framework</name>
<description>Fast development to keep time on the beach</description> <description>Fast development to keep time on the beach</description>
<url>https://github.com/haiti-projects/haiti-framework</url> <url>https://github.com/haiti-projects/haiti-framework</url>
<properties>
<haiti.bom.ver>0.0.2</haiti.bom.ver>
<haiti.exception.ver>0.0.2</haiti.exception.ver>
<haiti.context.ver>0.0.2</haiti.context.ver>
<haiti.core.ver>0.0.2</haiti.core.ver>
<haiti.filter.api.ver>0.0.2</haiti.filter.api.ver>
<haiti.filter.criteria.ver>0.0.2</haiti.filter.criteria.ver>
<haiti.database.ver>0.0.2</haiti.database.ver>
<haiti.utils.ver>0.0.2</haiti.utils.ver>
<plugin.nexus.staging.ver>1.6.8</plugin.nexus.staging.ver>
<plugin.maven.source.ver>3.2.1</plugin.maven.source.ver>
<plugin.maven.javadoc.ver>3.3.1</plugin.maven.javadoc.ver>
<plugin.maven.gpg.ver>3.0.1</plugin.maven.gpg.ver>
</properties>
<scm>
<connection>scm:git:https://github.com/haiti-projects/haiti-framework.git</connection>
<url>https://github.com/haiti-projects/haiti-framework</url>
<developerConnection>scm:git:https://github.com/haiti-projects/haiti-framework.git</developerConnection>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/haiti-projects/haiti-framework/issues</url>
</issueManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-bom</artifactId>
<version>0.0.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${plugin.nexus.staging.ver}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${plugin.maven.source.ver}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.maven.javadoc.ver}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${plugin.maven.gpg.ver}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<gpgArgument>--pinentry-mode</gpgArgument>
<gpgArgument>loopback</gpgArgument>
</gpgArguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer>
</developers>
<licenses> <licenses>
<license> <license>
<name>Apache License, Version 2.0</name> <name>Apache License, Version 2.0</name>
@ -43,129 +207,4 @@
</license> </license>
</licenses> </licenses>
<organization>
<name>Struchkov Inc.</name>
<url>https://mark.struchkov.dev</url>
</organization>
<scm>
<connection>scm:git:https://github.com/haiti-projects/haiti-framework.git</connection>
<url>https://github.com/haiti-projects/haiti-framework</url>
<developerConnection>scm:git:https://github.com/haiti-projects/haiti-framework.git</developerConnection>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/haiti-projects/haiti-framework/issues</url>
</issueManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-bom</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<organization>Struchkov Inc.</organization>
<organizationUrl>https://struchkov.dev</organizationUrl>
<url>https://mark.struchkov.dev</url>
<roles>
<role>Project Lead</role>
</roles>
<timezone>+3</timezone>
</developer>
</developers>
</project> </project>