use of com.hack23.cia.service.api.action.application.CreateApplicationEventRequest in project cia by Hack23.
the class AbstractBusinessServiceImpl method inputValidation.
protected final V inputValidation(final T serviceRequest) {
final Set<ConstraintViolation<T>> validateRequest = validateRequest(serviceRequest);
if (!validateRequest.isEmpty()) {
final CreateApplicationEventRequest eventRequest = createApplicationEventForService(serviceRequest);
final V response = handleInputViolations(eventRequest, validateRequest, createErrorResponse());
createApplicationEventService.processService(eventRequest);
return response;
} else {
return null;
}
}
use of com.hack23.cia.service.api.action.application.CreateApplicationEventRequest in project cia by Hack23.
the class ComplianceCheckServiceImpl method createApplicationEventForService.
@Override
protected CreateApplicationEventRequest createApplicationEventForService(final ComplianceCheckRequest serviceRequest) {
final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest();
eventRequest.setEventGroup(ApplicationEventGroup.USER);
eventRequest.setApplicationOperation(ApplicationOperationType.READ);
eventRequest.setActionName(ComplianceCheckRequest.class.getSimpleName());
eventRequest.setSessionId(serviceRequest.getSessionId());
return eventRequest;
}
use of com.hack23.cia.service.api.action.application.CreateApplicationEventRequest in project cia by Hack23.
the class DisableGoogleAuthenticatorCredentialService method processService.
@Override
@Secured({ "ROLE_USER", "ROLE_ADMIN" })
public DisableGoogleAuthenticatorCredentialResponse processService(final DisableGoogleAuthenticatorCredentialRequest serviceRequest) {
final DisableGoogleAuthenticatorCredentialResponse inputValidation = inputValidation(serviceRequest);
if (inputValidation != null) {
return inputValidation;
}
LOGGER.info("{}:{}", serviceRequest.getClass().getSimpleName(), serviceRequest.getSessionId());
final CreateApplicationEventRequest eventRequest = createApplicationEventForService(serviceRequest);
final UserAccount userAccount = getUserAccountFromSecurityContext();
final DisableGoogleAuthenticatorCredentialResponse response = new DisableGoogleAuthenticatorCredentialResponse(ServiceResult.SUCCESS);
if (userAccount != null) {
eventRequest.setUserId(userAccount.getUserId());
final UserAccount updateUserAccount = userDAO.load(userAccount.getHjid());
updateUserAccount.setGoogleAuthKey(null);
updateUserAccount.setGoogleAuthVerificationCode(null);
updateUserAccount.setGoogleAuthScratchCodes(null);
userDAO.merge(updateUserAccount);
}
eventRequest.setApplicationMessage(response.getResult().toString());
createApplicationEventService.processService(eventRequest);
return response;
}
use of com.hack23.cia.service.api.action.application.CreateApplicationEventRequest in project cia by Hack23.
the class DocumentWordCountService method processService.
@Override
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_ANONYMOUS" })
public DocumentWordCountResponse processService(final DocumentWordCountRequest serviceRequest) {
final DocumentWordCountResponse inputValidation = inputValidation(serviceRequest);
if (inputValidation != null) {
return inputValidation;
}
LOGGER.info("{}:{}", serviceRequest.getClass().getSimpleName(), serviceRequest.getDocumentId());
final CreateApplicationEventRequest eventRequest = createApplicationEventForService(serviceRequest);
final UserAccount userAccount = getUserAccountFromSecurityContext();
if (userAccount != null) {
eventRequest.setUserId(userAccount.getUserId());
}
final DocumentWordCountResponse response = new DocumentWordCountResponse(ServiceResult.SUCCESS);
final DocumentContentData documentContentData = documentContentDataDAO.findFirstByProperty(DocumentContentData_.id, serviceRequest.getDocumentId());
if (documentContentData == null) {
response.setWordCountMap(new HashMap<>());
} else {
response.setWordCountMap(wordCounter.calculateWordCount(documentContentData, serviceRequest.getMaxResults()));
}
eventRequest.setApplicationMessage(response.getResult().toString());
createApplicationEventService.processService(eventRequest);
return response;
}
use of com.hack23.cia.service.api.action.application.CreateApplicationEventRequest in project cia by Hack23.
the class DocumentWordCountService method createApplicationEventForService.
@Override
protected CreateApplicationEventRequest createApplicationEventForService(final DocumentWordCountRequest serviceRequest) {
final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest();
eventRequest.setEventGroup(ApplicationEventGroup.USER);
eventRequest.setApplicationOperation(ApplicationOperationType.READ);
eventRequest.setActionName(DocumentWordCountRequest.class.getSimpleName());
eventRequest.setSessionId(serviceRequest.getSessionId());
return eventRequest;
}
Aggregations