Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
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
26
27
28
29
package com.megatim.fdxconsultation.core.impl.helper;
 
import com.megatim.fdxcommons.model.pojo.DataInMemory;
import com.megatim.fdxcommons.tools.exceptions.ApplicationForbidenException;
import com.megatim.fdxconsultation.core.ifaces.helper.RoutingChecker;
import javax.enterprise.context.Dependent;
 
/**
 *
 * @author lenovo
 */
@Dependent
public class RoutingCheckerImpl implements RoutingChecker {
 
    @Override
    public void stopIfNotProducer(String codeTypeFichier, DataInMemory dataInMemory, String codeParticipant) {
        if (!dataInMemory.getTypeFichierToParticipantsEnvoi().get(codeTypeFichier).contains(codeParticipant)) {
            throw new ApplicationForbidenException("Impossible de continuer la requête car le participant " + codeParticipant + " n'est pas producteur du type de fichier " + codeTypeFichier);
        }
    }
 
    @Override
    public void stopIfNotConsumer(String codeTypeFichier, DataInMemory dataInMemory, String codeParticipant) {
        if (!dataInMemory.getTypeFichierToParticipantsReception().get(codeTypeFichier).contains(codeParticipant)) {
            throw new ApplicationForbidenException("Impossible de continuer la requête car le participant " + codeParticipant + " n'est pas consommateur du type de fichier " + codeTypeFichier);
        }
    }
 
}