[FORMAT] error while formating
This commit is contained in:
parent
dbe1b469f6
commit
0fe769a203
@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/** In case of the update parameter with String input to detect null element. */
|
/** In case of the update parameter with String input to detect null element. */
|
||||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface AsyncType {
|
public @interface AsyncType {
|
||||||
Class<?> value();
|
Class<?> value();
|
||||||
|
@ -93,6 +93,7 @@ public class DataResource {
|
|||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileData(final UUID uuid) {
|
public static String getFileData(final UUID uuid) {
|
||||||
final String stringUUID = uuid.toString();
|
final String stringUUID = uuid.toString();
|
||||||
final String part1 = stringUUID.substring(0, 2);
|
final String part1 = stringUUID.substring(0, 2);
|
||||||
@ -108,6 +109,7 @@ public class DataResource {
|
|||||||
filePath += part3;
|
filePath += part3;
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileMetaData(final UUID uuid) {
|
public static String getFileMetaData(final UUID uuid) {
|
||||||
return getFileData(uuid) + ".json";
|
return getFileData(uuid) + ".json";
|
||||||
}
|
}
|
||||||
@ -317,8 +319,8 @@ public class DataResource {
|
|||||||
return Response.status(404).entity("{\"error\":\"media Does not exist: " + id + "\"}").type("application/json").build();
|
return Response.status(404).entity("{\"error\":\"media Does not exist: " + id + "\"}").type("application/json").build();
|
||||||
}
|
}
|
||||||
if (value.mimeType.contentEquals("image/jpeg") || value.mimeType.contentEquals("image/png")
|
if (value.mimeType.contentEquals("image/jpeg") || value.mimeType.contentEquals("image/png")
|
||||||
// || value.mimeType.contentEquals("image/webp")
|
// || value.mimeType.contentEquals("image/webp")
|
||||||
) {
|
) {
|
||||||
// reads input image
|
// reads input image
|
||||||
final BufferedImage inputImage = ImageIO.read(inputFile);
|
final BufferedImage inputImage = ImageIO.read(inputFile);
|
||||||
final int scaledWidth = 250;
|
final int scaledWidth = 250;
|
||||||
|
@ -889,13 +889,8 @@ public class DataAccess {
|
|||||||
if (generatedKeys.next()) {
|
if (generatedKeys.next()) {
|
||||||
if (primaryKeyField.getType() == UUID.class) {
|
if (primaryKeyField.getType() == UUID.class) {
|
||||||
// uniqueSQLUUID = generatedKeys.getObject(1, UUID.class);
|
// uniqueSQLUUID = generatedKeys.getObject(1, UUID.class);
|
||||||
/*
|
/* final Object obj = generatedKeys.getObject(1); final BigInteger bigint = (BigInteger) generatedKeys.getObject(1); uniqueSQLUUID = UuidUtils.asUuid(bigint); final UUID
|
||||||
final Object obj = generatedKeys.getObject(1);
|
* generatedUUID = (UUID) generatedKeys.getObject(1); System.out.println("UUID généré: " + generatedUUID); */
|
||||||
final BigInteger bigint = (BigInteger) generatedKeys.getObject(1);
|
|
||||||
uniqueSQLUUID = UuidUtils.asUuid(bigint);
|
|
||||||
final UUID generatedUUID = (UUID) generatedKeys.getObject(1);
|
|
||||||
System.out.println("UUID généré: " + generatedUUID);
|
|
||||||
*/
|
|
||||||
final Object obj = generatedKeys.getObject(1);
|
final Object obj = generatedKeys.getObject(1);
|
||||||
final byte[] tmpid = generatedKeys.getBytes(1);
|
final byte[] tmpid = generatedKeys.getBytes(1);
|
||||||
uniqueSQLUUID = UuidUtils.asUuid(tmpid);
|
uniqueSQLUUID = UuidUtils.asUuid(tmpid);
|
||||||
|
@ -199,6 +199,7 @@ public class DataFactoryTsApi {
|
|||||||
}
|
}
|
||||||
return ((AsyncType) annotation[0]).value();
|
return ((AsyncType) annotation[0]).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> apiAnnotationGetAsyncType(final Method element) throws Exception {
|
public static Class<?> apiAnnotationGetAsyncType(final Method element) throws Exception {
|
||||||
final Annotation[] annotation = element.getDeclaredAnnotationsByType(AsyncType.class);
|
final Annotation[] annotation = element.getDeclaredAnnotationsByType(AsyncType.class);
|
||||||
if (annotation.length == 0) {
|
if (annotation.length == 0) {
|
||||||
@ -265,7 +266,7 @@ public class DataFactoryTsApi {
|
|||||||
returnTypeModel = method.getReturnType();
|
returnTypeModel = method.getReturnType();
|
||||||
}
|
}
|
||||||
boolean isUnmanagedReturnType = false;
|
boolean isUnmanagedReturnType = false;
|
||||||
if (returnTypeModel == Response.class ) {
|
if (returnTypeModel == Response.class) {
|
||||||
isUnmanagedReturnType = true;
|
isUnmanagedReturnType = true;
|
||||||
returnTypeModel = Void.class;
|
returnTypeModel = Void.class;
|
||||||
}
|
}
|
||||||
@ -551,16 +552,14 @@ public class DataFactoryTsApi {
|
|||||||
myWriter = new FileWriter(pathPackage + File.separator + "index.ts");
|
myWriter = new FileWriter(pathPackage + File.separator + "index.ts");
|
||||||
myWriter.write(index.toString());
|
myWriter.write(index.toString());
|
||||||
myWriter.close();
|
myWriter.close();
|
||||||
final InputStream ioStream = DataFactoryTsApi.class
|
final InputStream ioStream = DataFactoryTsApi.class.getClassLoader().getResourceAsStream("rest-tools.ts");
|
||||||
.getClassLoader()
|
|
||||||
.getResourceAsStream("rest-tools.ts");
|
|
||||||
if (ioStream == null) {
|
if (ioStream == null) {
|
||||||
throw new IllegalArgumentException("rest-tools.ts is not found");
|
throw new IllegalArgumentException("rest-tools.ts is not found");
|
||||||
}
|
}
|
||||||
final BufferedReader buffer = new BufferedReader(new InputStreamReader(ioStream));
|
final BufferedReader buffer = new BufferedReader(new InputStreamReader(ioStream));
|
||||||
myWriter = new FileWriter(pathPackage + File.separator + "rest-tools.ts");
|
myWriter = new FileWriter(pathPackage + File.separator + "rest-tools.ts");
|
||||||
String line;
|
String line;
|
||||||
while( (line = buffer.readLine()) != null) {
|
while ((line = buffer.readLine()) != null) {
|
||||||
myWriter.write(line);
|
myWriter.write(line);
|
||||||
myWriter.write("\n");
|
myWriter.write("\n");
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
final boolean createIfNotExist, final boolean createDrop, final int fieldId) throws Exception {
|
final boolean createIfNotExist, final boolean createDrop, final int fieldId) throws Exception {
|
||||||
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, JsonValue.class);
|
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, JsonValue.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id, new OverrideTableName(tableName));
|
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id, new OverrideTableName(tableName));
|
||||||
@ -174,6 +175,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers.add(remoteKey);
|
data.covers.add(remoteKey);
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id, new OverrideTableName(tableName));
|
||||||
@ -188,6 +190,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers.add(remoteKey);
|
data.covers.add(remoteKey);
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id, new OverrideTableName(tableName));
|
||||||
@ -202,6 +205,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers.add(remoteKey);
|
data.covers.add(remoteKey);
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id, new OverrideTableName(tableName));
|
||||||
@ -218,6 +222,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers = newList;
|
data.covers = newList;
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id, new OverrideTableName(tableName));
|
||||||
@ -234,6 +239,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers = newList;
|
data.covers = newList;
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id, new OverrideTableName(tableName));
|
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id, new OverrideTableName(tableName));
|
||||||
@ -250,6 +256,7 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers = newList;
|
data.covers = newList;
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final Long id, final String column, final UUID remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final Long id, final String column, final UUID remoteKey) throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongUUID data = DataAccess.get(TableCoversLongUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversLongUUID data = DataAccess.get(TableCoversLongUUID.class, id, new OverrideTableName(tableName));
|
||||||
@ -266,22 +273,9 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
data.covers = newList;
|
data.covers = newList;
|
||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
/*
|
/* public static <TYPE> void addLink(final Class<TYPE> clazz, final Object localKey, final String column, final Object remoteKey) throws Exception { final String tableName =
|
||||||
public static <TYPE> void addLink(final Class<TYPE> clazz, final Object localKey, final String column, final Object remoteKey) throws Exception {
|
* AnnotationTools.getTableName(clazz); final TYPE data = DataAccess.get(clazz, localKey); // TODO: add filter of the "column" // find the field column: // add the remoteKey in the list: // post
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
* new data in the DB final String linkTableName = generateLinkTableName(this.tableName, this.column); final LinkTable insertElement = new LinkTable(this.localKey, this.remoteKey);
|
||||||
final TYPE data = DataAccess.get(clazz, localKey); // TODO: add filter of the "column"
|
* DataAccess.insert(insertElement, new OverrideTableName(linkTableName)); } */
|
||||||
|
|
||||||
// find the field column:
|
|
||||||
|
|
||||||
// add the remoteKey in the list:
|
|
||||||
|
|
||||||
|
|
||||||
// post new data in the DB
|
|
||||||
|
|
||||||
final String linkTableName = generateLinkTableName(this.tableName, this.column);
|
|
||||||
final LinkTable insertElement = new LinkTable(this.localKey, this.remoteKey);
|
|
||||||
DataAccess.insert(insertElement, new OverrideTableName(linkTableName));
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,8 @@ public class DataTools {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <CLASS_TYPE, ID_TYPE> Response uploadCover(final Class<CLASS_TYPE> clazz, final ID_TYPE id, String fileName, final InputStream fileInputStream, final FormDataContentDisposition fileMetaData) {
|
public static <CLASS_TYPE, ID_TYPE> Response uploadCover(final Class<CLASS_TYPE> clazz, final ID_TYPE id, String fileName, final InputStream fileInputStream,
|
||||||
|
final FormDataContentDisposition fileMetaData) {
|
||||||
try {
|
try {
|
||||||
// correct input string stream :
|
// correct input string stream :
|
||||||
fileName = multipartCorrection(fileName);
|
fileName = multipartCorrection(fileName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user