refs #200: Create accouting-lib library
https://support.d4science.org/issues/200 Fixing data model git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115234 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a9da7ea865
commit
d2174296d6
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.accounting.datamodel.validators;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -43,7 +44,7 @@ public class ValidIPValidator implements FieldValidator<ValidLong>{
|
|||
}
|
||||
|
||||
public boolean isValid(Object toValidate) {
|
||||
if(toValidate instanceof String){
|
||||
if(toValidate instanceof String || toValidate instanceof Serializable){
|
||||
return isIpAddress((String) toValidate);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -12,6 +12,10 @@ public class ValidIntegerValidator implements FieldValidator<ValidLong>{
|
|||
if(toValidate instanceof Integer){
|
||||
return true;
|
||||
}
|
||||
Integer integerObj = Integer.getInteger((String) toValidate);
|
||||
if(integerObj!=null){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ public class ValidLongValidator implements FieldValidator<ValidLong>{
|
|||
if(toValidate instanceof Long){
|
||||
return true;
|
||||
}
|
||||
Long longObj = Long.getLong((String) toValidate);
|
||||
if(longObj!=null){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@ public class ValidOperationResultValidator implements FieldValidator<ValidOperat
|
|||
}
|
||||
if(toValidate instanceof String || toValidate instanceof Serializable){
|
||||
try {
|
||||
OperationResult.valueOf((String) toValidate);
|
||||
return true;
|
||||
OperationResult operationResult = OperationResult.valueOf((String) toValidate);
|
||||
if(operationResult !=null){
|
||||
return true;
|
||||
}
|
||||
}catch(Exception e){}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue