use of gov.ca.cwds.drools.DroolsService in project api-core by ca-cwds.
the class ClientResultReadAuthorizerTest method init.
@Before
public void init() {
MockitoAnnotations.initMocks(this);
final DroolsService droolsService = new DroolsService();
final DroolsAuthorizationService droolsAuthorizationService = new DroolsAuthorizationService(droolsService);
testSubject = new ClientResultReadAuthorizer(droolsAuthorizationService, new ClientResultAuthorizationDroolsConfiguration());
testSubject.setCountyDeterminationService(clientCountyDeterminationServiceMock);
}
use of gov.ca.cwds.drools.DroolsService in project api-core by ca-cwds.
the class SubstituteCareProviderCreateAuthorizerTest method init.
@Before
public void init() {
MockitoAnnotations.initMocks(this);
final DroolsService droolsService = new DroolsService();
final DroolsAuthorizationService droolsAuthorizationService = new DroolsAuthorizationService(droolsService);
testSubject = new SubstituteCareProviderCreateAuthorizer(droolsAuthorizationService, new SubstituteCareProviderAuthorizationDroolsConfiguration());
}
use of gov.ca.cwds.drools.DroolsService in project api-core by ca-cwds.
the class ClientAbstractReadAuthorizerTest method init.
@Before
public void init() {
MockitoAnnotations.initMocks(this);
final DroolsService droolsService = new DroolsService();
final DroolsAuthorizationService droolsAuthorizationService = new DroolsAuthorizationService(droolsService);
final ClientAbstractAuthorizationDroolsConfiguration droolsConfiguration = new ClientAbstractAuthorizationDroolsConfiguration();
testSubject = new ClientAbstractReadAuthorizer(droolsAuthorizationService, droolsConfiguration);
testSubject.setSensitivityDeterminationService(clientSensitivityDeterminationService);
testSubject.setCountyDeterminationService(clientCountyDeterminationService);
}
use of gov.ca.cwds.drools.DroolsService in project api-core by ca-cwds.
the class PlacementHomeCreateAuthorizerTest method init.
@Before
public void init() {
MockitoAnnotations.initMocks(this);
final DroolsService droolsService = new DroolsService();
final DroolsAuthorizationService droolsAuthorizationService = new DroolsAuthorizationService(droolsService);
testSubject = new PlacementHomeCreateAuthorizer(droolsAuthorizationService, new PlacementHomeAuthorizationDroolsConfiguration());
}
use of gov.ca.cwds.drools.DroolsService in project api-core by ca-cwds.
the class DroolsValidator method isValid.
@Override
public boolean isValid(T obj, ConstraintValidatorContext context) {
if (obj == null) {
return true;
}
DroolsConfiguration<T> configuration = getConfiguration();
Object validatedFact = configuration.getValidatedFact(obj);
DroolsService droolsService = InjectorHolder.INSTANCE.getInstance(DroolsService.class);
Set<IssueDetails> detailsList = null;
try {
detailsList = droolsService.performBusinessRules(configuration, validatedFact);
} catch (DroolsException e) {
LOGGER.warn(e.getMessage(), e);
throw new RuntimeException(String.format(DroolsErrorMessages.CANT_PERFORM_BUSINESS_VALIDATION, configuration.getAgendaGroup()));
}
if (detailsList.isEmpty()) {
return true;
} else {
context.disableDefaultConstraintViolation();
detailsList.forEach((details -> context.buildConstraintViolationWithTemplate(marshallData(details)).addPropertyNode("").addConstraintViolation()));
return false;
}
}
Aggregations