fixed check for mandatory fields

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/catalogue-ws@148252 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-05-03 09:48:42 +00:00
parent 5c30c76701
commit 1e5a5593ac
4 changed files with 6 additions and 14 deletions

View File

@ -23,10 +23,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -3,7 +3,6 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="catalogue-ws"/>
<property name="java-output-path" value="/catalogue-ws/target/classes"/>
</wb-module>

View File

@ -183,8 +183,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- SA Plugin -->

View File

@ -570,11 +570,11 @@ public class CatalogueUtils {
int upperBound = hasVocabulary ? (metadataField.getVocabulary().isMultiSelection() ? Integer.MAX_VALUE : 1) : 1;
if(fieldsMandatoryUpperBoundMap.containsKey(metadataFieldName)){
try{
upperBound = Math.addExact(upperBound, fieldsMandatoryUpperBoundMap.get(metadataFieldName));
}catch(ArithmeticException e){
long tempSum = upperBound + fieldsMandatoryUpperBoundMap.get(metadataFieldName);
if(tempSum > Integer.MAX_VALUE)
upperBound = Integer.MAX_VALUE;
}
else
upperBound = (int) tempSum;
}
fieldsMandatoryUpperBoundMap.put(metadataFieldName, upperBound);
@ -706,7 +706,7 @@ public class CatalogueUtils {
boolean hasControlledVocabulary = metadataField.getVocabulary() != null;
String value = fieldToValidate.getValue();
String key = fieldToValidate.getKey();
// replace key by prepending the qualified name of the category, if needed
fieldToValidate.setQualifiedKey(metadataField.getCategoryFieldQName());
@ -772,7 +772,7 @@ public class CatalogueUtils {
case Boolean:
if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) {
}else
throw new Exception("Field with key '" + key + "' doesn't seem a valid boolean value!");