Compare commits

..

No commits in common. "3e81673d38f44136368f830d7fba0081e1c352b4" and "e071d3dbf7c6696fbc9fea6888079a279fb3ee5b" have entirely different histories.

4 changed files with 50 additions and 55 deletions

View File

@ -134,8 +134,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (maxValueDecimal != null) {
final long maxValue = Long.parseLong(maxValueDecimal.value());
final boolean inclusive = maxValueDecimal.inclusive();
final String exceptionComment = "Value too height max=" + maxValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -150,10 +148,12 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Long elemTyped = (Long) elem;
if (inclusive) {
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
} else if (elemTyped >= maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
@ -161,8 +161,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (minValueDecimal != null) {
final long minValue = Long.parseLong(minValueDecimal.value());
final boolean inclusive = minValueDecimal.inclusive();
final String exceptionComment = "Value too low min=" + minValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -177,17 +175,18 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Long elemTyped = (Long) elem;
if (inclusive) {
if (elemTyped < minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
} else if (elemTyped <= minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
final Max maxValue = AnnotationTools.getConstraintsMax(field);
if (maxValue != null) {
final Long maxValueTmp = maxValue.value();
final String exceptionComment = "Value too height max=" + maxValueTmp + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -201,14 +200,14 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Long elemTyped = (Long) elem;
if (elemTyped > maxValueTmp) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValueTmp);
}
});
}
final Min minValue = AnnotationTools.getConstraintsMin(field);
if (minValue != null) {
final Long minValueTmp = minValue.value();
final String exceptionComment = "Value too low min=" + minValueTmp + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -222,7 +221,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Long elemTyped = (Long) elem;
if (elemTyped < minValueTmp) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValueTmp);
}
});
}
@ -231,8 +231,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (maxValueDecimal != null) {
final int maxValue = Integer.parseInt(maxValueDecimal.value());
final boolean inclusive = maxValueDecimal.inclusive();
final String exceptionComment = "Value too height max=" + maxValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -247,11 +245,13 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Integer elemTyped = (Integer) elem;
if (inclusive) {
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
} else if (elemTyped >= maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
@ -259,8 +259,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (minValueDecimal != null) {
final int minValue = Integer.parseInt(minValueDecimal.value());
final boolean inclusive = minValueDecimal.inclusive();
final String exceptionComment = "Value too low min=" + minValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -275,17 +273,18 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Integer elemTyped = (Integer) elem;
if (inclusive) {
if (elemTyped < minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
} else if (elemTyped <= minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
final Max maxValueRoot = AnnotationTools.getConstraintsMax(field);
if (maxValueRoot != null) {
final int maxValue = (int) maxValueRoot.value();
final String exceptionComment = "Value too height max=" + maxValue + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -299,14 +298,14 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Integer elemTyped = (Integer) elem;
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
final Min minValueRoot = AnnotationTools.getConstraintsMin(field);
if (minValueRoot != null) {
final int minValue = (int) minValueRoot.value();
final String exceptionComment = "Value too low min=" + minValue + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -320,7 +319,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Integer elemTyped = (Integer) elem;
if (elemTyped < minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
@ -331,8 +331,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (maxValueDecimal != null) {
final float maxValue = Float.parseFloat(maxValueDecimal.value());
final boolean inclusive = maxValueDecimal.inclusive();
final String exceptionComment = "Value too height max=" + maxValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -347,10 +345,12 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Float elemTyped = (Float) elem;
if (inclusive) {
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
} else if (elemTyped >= maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
@ -358,8 +358,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (minValueDecimal != null) {
final float minValue = Float.parseFloat(minValueDecimal.value());
final boolean inclusive = minValueDecimal.inclusive();
final String exceptionComment = "Value too low min=" + minValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -374,17 +372,18 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Float elemTyped = (Float) elem;
if (inclusive) {
if (elemTyped < minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
} else if (elemTyped <= minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
final Max maxValueRoot = AnnotationTools.getConstraintsMax(field);
if (maxValueRoot != null) {
final float maxValue = maxValueRoot.value();
final String exceptionComment = "Value too height max=" + maxValue + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -399,14 +398,14 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Float elemTyped = (Float) elem;
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
final Min minValueRoot = AnnotationTools.getConstraintsMin(field);
if (minValueRoot != null) {
final float minValue = minValueRoot.value();
final String exceptionComment = "Value too low min=" + minValue + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -420,7 +419,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Float elemTyped = (Float) elem;
if (elemTyped < minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
@ -429,8 +429,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (maxValueDecimal != null) {
final double maxValue = Float.parseFloat(maxValueDecimal.value());
final boolean inclusive = maxValueDecimal.inclusive();
final String exceptionComment = "Value too height max=" + maxValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -445,10 +443,12 @@ public class CheckJPA<T> implements CheckFunctionInterface {
final Double elemTyped = (Double) elem;
if (inclusive) {
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
} else if (elemTyped >= maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
@ -456,8 +456,6 @@ public class CheckJPA<T> implements CheckFunctionInterface {
if (minValueDecimal != null) {
final double minValue = Float.parseFloat(minValueDecimal.value());
final boolean inclusive = minValueDecimal.inclusive();
final String exceptionComment = "Value too low min=" + minValue
+ (inclusive ? " (inclusive)" : " (exclusive)");
add(fieldName,
(
final DBAccess ioDb,
@ -476,14 +474,14 @@ public class CheckJPA<T> implements CheckFunctionInterface {
"Value too Low min: " + minValue);
}
} else if (elemTyped <= minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
final Max maxValueRoot = AnnotationTools.getConstraintsMax(field);
if (maxValueRoot != null) {
final double maxValue = maxValueRoot.value();
final String exceptionComment = "Value too height max=" + maxValue + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -497,14 +495,14 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Double elemTyped = (Double) elem;
if (elemTyped > maxValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too height max: " + maxValue);
}
});
}
final Min minValueRoot = AnnotationTools.getConstraintsMin(field);
if (minValueRoot != null) {
final double minValue = minValueRoot.value();
final String exceptionComment = "Value too low min=" + minValue + " (inclusive)";
add(fieldName,
(
final DBAccess ioDb,
@ -518,7 +516,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Double elemTyped = (Double) elem;
if (elemTyped < minValue) {
throw new InputException(baseName + fieldName, exceptionComment);
throw new InputException(baseName + fieldName,
"Value too Low min: " + minValue);
}
});
}
@ -722,7 +721,7 @@ public class CheckJPA<T> implements CheckFunctionInterface {
for (int iii = 0; iii < elements.length; iii++) {
if (elements[iii] == null) {
throw new InputException(baseName + fieldName + '[' + iii + ']',
"Collection can not contain NULL item");
"This collection can not conatain NULL item");
}
}
});
@ -746,7 +745,7 @@ public class CheckJPA<T> implements CheckFunctionInterface {
}
final Collection<?> tmpCollection = (Collection<?>) tmpData;
if (tmpCollection.isEmpty()) {
throw new InputException(baseName + fieldName, "Collection can not be empty");
throw new InputException(baseName + fieldName, "Can not be empty");
}
});
}
@ -771,8 +770,7 @@ public class CheckJPA<T> implements CheckFunctionInterface {
condCheckers.get(0).toCondition());
}
if (other != null) {
throw new InputException(baseName + fieldName,
"The field is already exist in the DB");
throw new InputException(baseName + fieldName, "Name already exist in the DB");
}
});
}

View File

@ -68,6 +68,7 @@ public class MySecurityContext implements SecurityContext {
}
// get associated Roles:
final PartRight rightPart = getRightOfRoleInGroup(group, role);
LOGGER.info("detect : {}", rightPart);
if (PartRight.READ_WRITE.equals(rightPart)) {
return true;
}

View File

@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Size;
@Table(name = "data")
@DataIfNotExists
@ -15,11 +14,9 @@ import jakarta.validation.constraints.Size;
public class Data extends OIDGenericDataSoftDelete {
@Column(length = 128, nullable = false)
@Schema(description = "Sha512 of the data")
@Size(max = 512)
public String sha512;
@Column(length = 128, nullable = false)
@Schema(description = "Mime -type of the media")
@Size(max = 512)
public String mimeType;
@Column(nullable = false)
@Schema(description = "Size in Byte of the data")

View File

@ -51,7 +51,6 @@ public class User extends GenericDataSoftDelete {
@Nullable
public Boolean blocked = false;
@Column(length = 512)
@Size(max = 512)
public String blockedReason;
@Schema(description = "List of Id of the specific covers")