[DEV] uopdate release 0.1.4

This commit is contained in:
Edouard DUPIN 2022-12-30 09:01:57 +01:00
parent f4ec9e8d82
commit 23d53fdfd7
7 changed files with 24 additions and 109 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>kangaroo-and-rabbit</groupId> <groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId> <artifactId>archidata</artifactId>
<version>0.1.3</version> <version>0.1.4</version>
<properties> <properties>
<jaxrs.version>2.1</jaxrs.version> <jaxrs.version>2.1</jaxrs.version>
<jersey.version>2.32</jersey.version> <jersey.version>2.32</jersey.version>

View File

@ -552,10 +552,16 @@ public class SqlWrapper {
return getWhere(clazz, key, "=", value); return getWhere(clazz, key, "=", value);
} }
public static <T> T getWhere(Class<T> clazz, String key, String operator, Object value, boolean full ) throws Exception {
return getWhere(clazz, key, operator, value, null, null, null, full);
}
public static <T> T getWhere(Class<T> clazz, String key, String operator, Object value ) throws Exception { public static <T> T getWhere(Class<T> clazz, String key, String operator, Object value ) throws Exception {
return getWhere(clazz, key, operator, value, null, null, null); return getWhere(clazz, key, operator, value, null, null, null, false);
} }
public static <T> T getWhere(Class<T> clazz, String key, String operator, Object value, String key2, String operator2, Object value2 ) throws Exception { public static <T> T getWhere(Class<T> clazz, String key, String operator, Object value, String key2, String operator2, Object value2 ) throws Exception {
return getWhere(clazz, key, operator, value, key2, operator2, value2, false);
}
public static <T> T getWhere(Class<T> clazz, String key, String operator, Object value, String key2, String operator2, Object value2, boolean full ) throws Exception {
DBEntry entry = new DBEntry(GlobalConfiguration.dbConfig); DBEntry entry = new DBEntry(GlobalConfiguration.dbConfig);
T out = null; T out = null;
// real add in the BDD: // real add in the BDD:
@ -575,12 +581,12 @@ public class SqlWrapper {
continue; continue;
} }
boolean createTime = elem.getDeclaredAnnotationsByType(SQLCreateTime.class).length != 0; boolean createTime = elem.getDeclaredAnnotationsByType(SQLCreateTime.class).length != 0;
if (createTime) { if (!full && createTime) {
continue; continue;
} }
String name = elem.getName(); String name = elem.getName();
boolean updateTime = elem.getDeclaredAnnotationsByType(SQLUpdateTime.class).length != 0; boolean updateTime = elem.getDeclaredAnnotationsByType(SQLUpdateTime.class).length != 0;
if (updateTime) { if (!full && updateTime) {
continue; continue;
} }
count++; count++;
@ -639,12 +645,12 @@ public class SqlWrapper {
continue; continue;
} }
boolean createTime = elem.getDeclaredAnnotationsByType(SQLCreateTime.class).length != 0; boolean createTime = elem.getDeclaredAnnotationsByType(SQLCreateTime.class).length != 0;
if (createTime) { if (!full && createTime) {
continue; continue;
} }
String name = elem.getName(); String name = elem.getName();
boolean updateTime = elem.getDeclaredAnnotationsByType(SQLUpdateTime.class).length != 0; boolean updateTime = elem.getDeclaredAnnotationsByType(SQLUpdateTime.class).length != 0;
if (updateTime) { if (!full && updateTime) {
continue; continue;
} }
//this.name = rs.getString(iii++); //this.name = rs.getString(iii++);
@ -785,7 +791,7 @@ public class SqlWrapper {
return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")); return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
} }
public static <T> List<T> gets(Class<T> clazz, boolean fool) throws Exception { public static <T> List<T> gets(Class<T> clazz, boolean full) throws Exception {
System.out.println("request get " + clazz.getCanonicalName() + " start @" + getCurrentTimeStamp()); System.out.println("request get " + clazz.getCanonicalName() + " start @" + getCurrentTimeStamp());
DBEntry entry = new DBEntry(GlobalConfiguration.dbConfig); DBEntry entry = new DBEntry(GlobalConfiguration.dbConfig);
List<T> out = new ArrayList<>(); List<T> out = new ArrayList<>();
@ -805,7 +811,7 @@ public class SqlWrapper {
for (Field elem : clazz.getFields()) { for (Field elem : clazz.getFields()) {
boolean notRead = elem.getDeclaredAnnotationsByType(SQLNotRead.class).length != 0; boolean notRead = elem.getDeclaredAnnotationsByType(SQLNotRead.class).length != 0;
if (!fool && notRead) { if (!full && notRead) {
autoClasify[indexAutoClasify++] = StateLoad.DISABLE; autoClasify[indexAutoClasify++] = StateLoad.DISABLE;
continue; continue;
} }
@ -899,7 +905,7 @@ public class SqlWrapper {
boolean notRead = elem.getDeclaredAnnotationsByType(SQLNotRead.class).length != 0; boolean notRead = elem.getDeclaredAnnotationsByType(SQLNotRead.class).length != 0;
*/ */
boolean notRead = autoClasify[indexAutoClasify] == StateLoad.DISABLE; boolean notRead = autoClasify[indexAutoClasify] == StateLoad.DISABLE;
if (!fool && notRead) { if (!full && notRead) {
indexAutoClasify++; indexAutoClasify++;
continue; continue;
} }

View File

@ -277,19 +277,18 @@ public class DataResource {
build(); build();
} }
String filePathName = ConfigBaseVariable.getMediaDataFolder() + File.separator + id + File.separator + "data"; String filePathName = ConfigBaseVariable.getMediaDataFolder() + File.separator + id + File.separator + "data";
File inputFile = new File(filePathName);
if (!inputFile.exists()) {
return Response.status(404).
entity("{\"error\":\"media Does not exist: " + id + "\"}").
type("application/json").
build();
}
if ( value.mimeType.contentEquals("image/jpeg") if ( value.mimeType.contentEquals("image/jpeg")
|| value.mimeType.contentEquals("image/png") || value.mimeType.contentEquals("image/png")
// || value.mimeType.contentEquals("image/webp") // || value.mimeType.contentEquals("image/webp")
) { ) {
// reads input image // reads input image
//System.out.println("Read path: " + filePathName);
File inputFile = new File(filePathName);
if (!inputFile.exists()) {
return Response.status(500).
entity("Internal Error: Media is NOT FOUNDABLE: " + id).
type("text/plain").
build();
}
BufferedImage inputImage = ImageIO.read(inputFile); BufferedImage inputImage = ImageIO.read(inputFile);
int scaledWidth = 250; int scaledWidth = 250;
int scaledHeight = (int)((float)inputImage.getHeight() / (float)inputImage.getWidth() * (float) scaledWidth); int scaledHeight = (int)((float)inputImage.getHeight() / (float)inputImage.getWidth() * (float) scaledWidth);

View File

@ -1,12 +0,0 @@
package org.kar.archidata.model;
public enum State {
// User has remove his account
REMOVED,
// User has been blocked his account
BLOCKED,
// generic user
USER,
// Administrator
ADMIN
}

View File

@ -1,36 +0,0 @@
package org.kar.archidata.model;
/*
CREATE TABLE `user` (
`id` bigint NOT NULL COMMENT 'table ID' AUTO_INCREMENT PRIMARY KEY,
`login` varchar(128) COLLATE 'utf8_general_ci' NOT NULL COMMENT 'login of the user',
`email` varchar(512) COLLATE 'utf8_general_ci' NOT NULL COMMENT 'email of the user',
`lastConnection` datetime NOT NULL COMMENT 'last connection time',
`admin` enum("TRUE", "FALSE") NOT NULL DEFAULT 'FALSE',
`blocked` enum("TRUE", "FALSE") NOT NULL DEFAULT 'FALSE',
`removed` enum("TRUE", "FALSE") NOT NULL DEFAULT 'FALSE'
) AUTO_INCREMENT=10;
*/
public class UserExtern {
public Long id;
public String login;
public boolean admin;
public UserExtern(User other) {
this.id = other.id;
this.login = other.login;
this.admin = other.admin;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", login='" + login + '\'' +
", admin=" + admin +
'}';
}
}

View File

@ -1,42 +0,0 @@
package org.kar.archidata.model;
/*
CREATE TABLE `user` (
`id` bigint NOT NULL COMMENT 'table ID' AUTO_INCREMENT PRIMARY KEY,
`login` varchar(128) COLLATE 'utf8_general_ci' NOT NULL COMMENT 'login of the user',
`email` varchar(512) COLLATE 'utf8_general_ci' NOT NULL COMMENT 'email of the user',
`lastConnection` datetime NOT NULL COMMENT 'last connection time',
`admin` enum("TRUE", "FALSE") NOT NULL DEFAULT 'FALSE',
`blocked` enum("TRUE", "FALSE") NOT NULL DEFAULT 'FALSE',
`removed` enum("TRUE", "FALSE") NOT NULL DEFAULT 'FALSE'
) AUTO_INCREMENT=10;
*/
public class UserPerso {
public Long id;
public String login;
public boolean admin;
public boolean blocked;
public boolean removed;
public UserPerso(User other) {
this.id = other.id;
this.login = other.login;
this.admin = other.admin;
this.blocked = other.blocked;
this.removed = other.removed;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", login='" + login + '\'' +
", admin=" + admin +
", blocked=" + blocked +
", removed=" + removed +
'}';
}
}

View File

@ -70,7 +70,7 @@ public class ConfigBaseVariable {
public static String getSSOAddress() { public static String getSSOAddress() {
if (ssoAdress == null) { if (ssoAdress == null) {
//return "http://sso_host/api/"; //return "http://sso_host/api/";
return "http://192.168.1.156/karauth/api/"; return "http://192.168.1.156/karso/api/";
} }
return ssoAdress; return ssoAdress;
} }