/*
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
*/
|
package com.megatim.fdxconvert.model.constraint;
|
|
import com.megatim.fdxconvert.pojo.Decryptage;
|
import javax.validation.ConstraintValidator;
|
import javax.validation.ConstraintValidatorContext;
|
|
/**
|
*
|
* @author STEPHANIE
|
*/
|
public class KeyToDecryptValidator implements ConstraintValidator<KeyToDecryptConstraint, Decryptage>{
|
|
@Override
|
public boolean isValid(Decryptage t, ConstraintValidatorContext cvc) {
|
System.out.println("Protege = "+t.isProtege());
|
if(t.isProtege())
|
return t.getKeyToDecrypt()!= null && !t.getKeyToDecrypt().isEmpty() &&
|
t.getKeyToDecrypt().equals(t.getKeyConfirmation());
|
else return true;
|
|
}
|
|
}
|