[FEAT] reorganize pakages
This commit is contained in:
parent
9d5c3c01db
commit
70cbb1aae9
@ -5,9 +5,9 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
import org.kar.archidata.dataAccess.QueryOptions;
|
||||
import org.kar.archidata.dataAccess.options.DBInterfaceOption;
|
||||
import org.kar.archidata.dataAccess.options.QueryOption;
|
||||
import org.kar.archidata.db.DBEntry;
|
||||
import org.kar.archidata.model.User;
|
||||
|
||||
|
@ -31,6 +31,10 @@ import org.kar.archidata.dataAccess.options.Condition;
|
||||
import org.kar.archidata.dataAccess.options.DBInterfaceOption;
|
||||
import org.kar.archidata.dataAccess.options.DBInterfaceRoot;
|
||||
import org.kar.archidata.dataAccess.options.FilterValue;
|
||||
import org.kar.archidata.dataAccess.options.GroupBy;
|
||||
import org.kar.archidata.dataAccess.options.Limit;
|
||||
import org.kar.archidata.dataAccess.options.OrderBy;
|
||||
import org.kar.archidata.dataAccess.options.QueryOption;
|
||||
import org.kar.archidata.dataAccess.options.TransmitKey;
|
||||
import org.kar.archidata.db.DBEntry;
|
||||
import org.kar.archidata.exception.DataAccessException;
|
||||
@ -1224,7 +1228,8 @@ public class DataAccess {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void addElement(final PreparedStatement ps, final Object value, final CountInOut iii) throws Exception {
|
||||
public static void addElement(final PreparedStatement ps, final Object value, final CountInOut iii)
|
||||
throws Exception {
|
||||
if (value instanceof final UUID tmp) {
|
||||
final byte[] dataByte = UuidUtils.asBytes(tmp);
|
||||
ps.setBytes(iii.value, dataByte);
|
||||
|
@ -20,6 +20,10 @@ import org.kar.archidata.dataAccess.exportTools.TableQuery;
|
||||
import org.kar.archidata.dataAccess.exportTools.TableQueryTypes;
|
||||
import org.kar.archidata.dataAccess.options.Condition;
|
||||
import org.kar.archidata.dataAccess.options.DBInterfaceOption;
|
||||
import org.kar.archidata.dataAccess.options.GroupBy;
|
||||
import org.kar.archidata.dataAccess.options.Limit;
|
||||
import org.kar.archidata.dataAccess.options.OrderBy;
|
||||
import org.kar.archidata.dataAccess.options.QueryOption;
|
||||
import org.kar.archidata.db.DBEntry;
|
||||
import org.kar.archidata.exception.DataAccessException;
|
||||
import org.kar.archidata.tools.DateTools;
|
||||
|
@ -8,17 +8,17 @@ import java.util.List;
|
||||
public class QueryAnd implements QueryItem {
|
||||
protected final List<QueryItem> childs;
|
||||
|
||||
public QueryAnd(final List<QueryItem> childs) {
|
||||
this.childs = childs;
|
||||
public QueryAnd(final List<QueryItem> child) {
|
||||
this.childs = child;
|
||||
}
|
||||
|
||||
public QueryAnd(final QueryItem... items) {
|
||||
public QueryAnd(final QueryItem... child) {
|
||||
this.childs = new ArrayList<>();
|
||||
Collections.addAll(this.childs, items);
|
||||
Collections.addAll(this.childs, child);
|
||||
}
|
||||
|
||||
public void add(final QueryItem... items) {
|
||||
Collections.addAll(this.childs, items);
|
||||
public void add(final QueryItem... child) {
|
||||
Collections.addAll(this.childs, child);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,12 @@ public class QueryCondition implements QueryItem {
|
||||
private final String comparator;
|
||||
private final Object value;
|
||||
|
||||
/**
|
||||
* Simple DB comparison element. Note the injected object is injected in the statement and not in the query directly.
|
||||
* @param key Field to check (the Model property name)
|
||||
* @param comparator (simple comparator String)
|
||||
* @param value Value that the field must be equals.
|
||||
*/
|
||||
public QueryCondition(final String key, final String comparator, final Object value) {
|
||||
this.key = key;
|
||||
this.comparator = comparator;
|
||||
|
@ -1,3 +0,0 @@
|
||||
package org.kar.archidata.dataAccess;
|
||||
|
||||
public class QueryOption {}
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
import org.kar.archidata.dataAccess.options.AccessDeletedItems;
|
||||
import org.kar.archidata.dataAccess.options.CreateDropTable;
|
||||
import org.kar.archidata.dataAccess.options.QueryOption;
|
||||
import org.kar.archidata.dataAccess.options.ReadAllColumn;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
137
src/org/kar/archidata/dataAccess/exportTools/README.md
Normal file
137
src/org/kar/archidata/dataAccess/exportTools/README.md
Normal file
@ -0,0 +1,137 @@
|
||||
Archi-data
|
||||
==========
|
||||
|
||||
Archi-data is a framework that simplify:
|
||||
- Creating a REST server with:
|
||||
- Right control
|
||||
- Swagger display interface
|
||||
- Normalize error generate by the server
|
||||
- Access to the DB:
|
||||
- introspect Object and insert in the TD (SQLITE & MY-SQL)
|
||||
- Manage migration
|
||||
- JPA checker for many generic request
|
||||
- simplify the request of the Test-service
|
||||
|
||||
|
||||
Documentation:
|
||||
--------------
|
||||
|
||||
The documentation is available [here](doc/index.md)
|
||||
|
||||
Develop in cmd-line:
|
||||
--------------------
|
||||
|
||||
The first step is configuring your JAVA version (or select the JVM with the OS)
|
||||
|
||||
```bash
|
||||
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
||||
```
|
||||
|
||||
Install the dependency:
|
||||
|
||||
```bash
|
||||
mvn install
|
||||
```
|
||||
|
||||
Run the test
|
||||
```bash
|
||||
mvn test
|
||||
```
|
||||
|
||||
Install it for external use
|
||||
```bash
|
||||
mvn install
|
||||
```
|
||||
|
||||
Develop With Eclipse:
|
||||
--------------------
|
||||
|
||||
Import the project:
|
||||
- Open a (new) project on eclipse
|
||||
- `File` -> `Import`
|
||||
- `Maven` -> `Existing Maven project`
|
||||
- Select the `pom.xml` file and click on import
|
||||
|
||||
Run the Test:
|
||||
- Open the package `test.kar.archidata`
|
||||
- Click right on it
|
||||
- Select `Debug As` -> `JUnit Test`
|
||||
|
||||
Install in the local maven repository:
|
||||
- Click right on the `pom.xml` file
|
||||
- Select `Run As` -> `Maven install`
|
||||
|
||||
|
||||
Some tools:
|
||||
============
|
||||
|
||||
Auto-update dependency:
|
||||
-----------------------
|
||||
|
||||
Auto-update to the last version dependency:
|
||||
|
||||
```bash
|
||||
mvn versions:use-latest-versions
|
||||
```
|
||||
|
||||
Format the code
|
||||
---------------
|
||||
|
||||
Simply run the cmd-line:
|
||||
|
||||
```bash
|
||||
mvn formatter:format
|
||||
```
|
||||
|
||||
Reformat XML file like the pom.xml
|
||||
|
||||
```bash
|
||||
XMLLINT_INDENT=" " xmllint --format "back/pom.xml" -o "back/pom.xml"
|
||||
```
|
||||
|
||||
Enable the pre-commit checker
|
||||
-----------------------------
|
||||
|
||||
```bash
|
||||
./tools/configure_precommit.bash
|
||||
```
|
||||
|
||||
> **_Note_**: You can change the code in `.git/hooks/pre-commit` by replacing `formatter:verify` with `formatter:format` to auto format the code @ every commit
|
||||
|
||||
|
||||
|
||||
Add Gitea in the dependency for the registry:
|
||||
=============================================
|
||||
|
||||
Read instruction for tocken in ~/.m2/setting.xml
|
||||
|
||||
edit file: ```~/.m2/settings.xml```
|
||||
|
||||
```xml
|
||||
<settings>
|
||||
<servers>
|
||||
<server>
|
||||
<id>gitea</id>
|
||||
<configuration>
|
||||
<httpHeaders>
|
||||
<property>
|
||||
<name>Authorization</name>
|
||||
<value>token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</value>
|
||||
</property>
|
||||
</httpHeaders>
|
||||
</configuration>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
```
|
||||
|
||||
release:
|
||||
========
|
||||
|
||||
```bash
|
||||
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
||||
mvn install
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** This option permit to access on deleted items of a table */
|
||||
public class AccessDeletedItems extends QueryOption {
|
||||
public AccessDeletedItems() {}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** By default some element are not read like createAt and UpdatedAt. This option permit to read it. */
|
||||
public class CheckFunction extends QueryOption {
|
||||
private final CheckFunctionInterface checker;
|
||||
|
@ -4,7 +4,6 @@ import java.sql.PreparedStatement;
|
||||
|
||||
import org.kar.archidata.dataAccess.CountInOut;
|
||||
import org.kar.archidata.dataAccess.QueryItem;
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
import org.kar.archidata.dataAccess.QueryOptions;
|
||||
|
||||
/** By default some element are not read like createAt and UpdatedAt. This option permit to read it. */
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** This option permit to create the DROP `Table` IF EXIST in the generation of structure. */
|
||||
public class CreateDropTable extends QueryOption {
|
||||
public CreateDropTable() {}
|
||||
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.kar.archidata.GlobalConfiguration;
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
import org.kar.archidata.dataAccess.QueryOptions;
|
||||
import org.kar.archidata.db.DBConfig;
|
||||
import org.kar.archidata.db.DBEntry;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
public class DBInterfaceRoot extends QueryOption {
|
||||
private final boolean root;
|
||||
|
||||
|
@ -2,8 +2,6 @@ package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** By default some element are not read like createAt and UpdatedAt. This option permit to read it. */
|
||||
public class FilterValue extends QueryOption {
|
||||
public final List<String> filterValue;
|
||||
|
@ -1,8 +1,10 @@
|
||||
package org.kar.archidata.dataAccess;
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.List;
|
||||
|
||||
import org.kar.archidata.dataAccess.CountInOut;
|
||||
|
||||
public class GroupBy extends QueryOption {
|
||||
protected final List<String> childs;
|
||||
|
@ -1,7 +1,10 @@
|
||||
package org.kar.archidata.dataAccess;
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
import org.kar.archidata.dataAccess.CountInOut;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
|
||||
public class Limit extends QueryOption {
|
||||
protected final long limit;
|
||||
|
@ -1,8 +1,10 @@
|
||||
package org.kar.archidata.dataAccess;
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.List;
|
||||
|
||||
import org.kar.archidata.dataAccess.CountInOut;
|
||||
|
||||
public class OrderBy extends QueryOption {
|
||||
protected final List<OrderItem> childs;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.kar.archidata.dataAccess;
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
public class OrderItem {
|
||||
public enum Order {
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** Option that permit to access to a table structure with an other name that is define in the structure. Note: Internal use for link tables (see:
|
||||
* org.kar.archidata.dataAccess.addOn.model.LinkTable). */
|
||||
public class OverrideTableName extends QueryOption {
|
||||
|
@ -0,0 +1,3 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
public class QueryOption {}
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** By default some element are not read like createAt and UpdatedAt. This option permit to read it. */
|
||||
public class ReadAllColumn extends QueryOption {
|
||||
public ReadAllColumn() {}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.kar.archidata.dataAccess.options;
|
||||
|
||||
import org.kar.archidata.dataAccess.QueryOption;
|
||||
|
||||
/** Internal option that permit to transmit the Key when updating the ManyToMany values (first step). */
|
||||
public class TransmitKey extends QueryOption {
|
||||
private final Object key;
|
||||
|
Loading…
Reference in New Issue
Block a user