Kenmegne
7 days ago 494d349fb67be74da49caae2794fda702f595fb4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * 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.fdxgenerator.annotations;
 
import com.megatim.fdxgenerator.model.FichierValidation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
 
/**
 *
 * @author STEPHANIE
 */
public class KeyToDecryptValidator implements  ConstraintValidator<KeyToDecryptConstraint, FichierValidation>{
 
    @Override
    public boolean isValid(FichierValidation t, ConstraintValidatorContext cvc) {
        if(t.isProtege())
            return t.getKeyToEncrypt() != null && !t.getKeyToEncrypt().isEmpty() &&
                    t.getKeyToEncrypt().equals(t.getKeyConfirmation());
        else return true;
    }
    
}