return clazz.isAssignableFrom(arg0);
}
public void validate(Object arg0, Errors arg1)
{
User ws = (User) arg0;
if (ws.getTypeDef().equals(User.TYPENORMAL))
{
ValidationUtils.rejectIfEmptyOrWhitespace(arg1,
"normalAuth.username", "error.form.ws.username.mandatory",
"Username is mandatory");
ValidationUtils.rejectIfEmptyOrWhitespace(arg1,
"normalAuth.password", "error.form.ws.password.mandatory",
"Password is mandatory");
}
else
{
ValidationUtils.rejectIfEmptyOrWhitespace(arg1,
"specialAuth.token", "error.form.ws.token.mandatory",
"Token is mandatory");
ValidationUtils.rejectIfEmptyOrWhitespace(arg1,
"specialAuth.fromIP", "error.form.ws.fromip.mandatory",
"Single IP is mandatory");
Long froms = null;
Long tos = null;
if (ws.getFromIP() != null && !ws.getFromIP().isEmpty())
{
if (!validator.isValidInet4Address(ws.getFromIP()))
{
arg1.reject("specialAuth.fromIP", "from IP not well formed");
}
else
{
try
{
froms = AddressUtils.ipToLong(InetAddress.getByName(ws.getFromIP()));
}
catch (UnknownHostException e)
{
arg1.reject("specialAuth.fromIP",
"Unknown host exception");
}
}
if (ws.getToIP() != null && !ws.getToIP().isEmpty())
{
if (!validator.isValidInet4Address(ws.getToIP()))
{
arg1.reject("specialAuth.ToIP", "to IP not well formed");
}
else
{
try
{
tos = AddressUtils.ipToLong(InetAddress.getByName(ws.getToIP()));
}
catch (UnknownHostException e)
{
arg1.reject("specialAuth.toIP",