use of com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest in project cia by Hack23.
the class UpdateSearchIndexClickListener method buttonClick.
@Override
public void buttonClick(final ClickEvent event) {
final UpdateSearchIndexRequest serviceRequest = new UpdateSearchIndexRequest();
serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
ApplicationMangerAccess.getApplicationManager().asyncService(serviceRequest);
Notification.show(UPDATE_SEARCH_INDEX_STARTED);
}
use of com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest in project cia by Hack23.
the class UpdateSearchIndexService method createApplicationEventForService.
@Override
protected CreateApplicationEventRequest createApplicationEventForService(final UpdateSearchIndexRequest serviceRequest) {
final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest();
eventRequest.setEventGroup(ApplicationEventGroup.ADMIN);
eventRequest.setApplicationOperation(ApplicationOperationType.UPDATE);
eventRequest.setActionName(UpdateSearchIndexRequest.class.getSimpleName());
eventRequest.setSessionId(serviceRequest.getSessionId());
return eventRequest;
}
use of com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest in project cia by Hack23.
the class UpdateSearchIndexService method processService.
@Override
@Secured({ "ROLE_ADMIN" })
public UpdateSearchIndexResponse processService(final UpdateSearchIndexRequest serviceRequest) {
final UpdateSearchIndexResponse inputValidation = inputValidation(serviceRequest);
if (inputValidation != null) {
return inputValidation;
}
final CreateApplicationEventRequest eventRequest = createApplicationEventForService(serviceRequest);
final UserAccount userAccount = getUserAccountFromSecurityContext();
if (userAccount != null) {
LOGGER.info("{} started:{}", serviceRequest.getClass().getSimpleName(), userAccount.getEmail());
eventRequest.setUserId(userAccount.getUserId());
}
UpdateSearchIndexResponse response;
try {
searchIndexer.updateSearchIndex();
response = new UpdateSearchIndexResponse(ServiceResult.SUCCESS);
} catch (final InterruptedException e) {
LOGGER.warn("Update Index failed", e);
Thread.currentThread().interrupt();
response = new UpdateSearchIndexResponse(ServiceResult.FAILURE);
}
eventRequest.setApplicationMessage(response.getResult().toString());
createApplicationEventService.processService(eventRequest);
return response;
}
use of com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest in project cia by Hack23.
the class UpdateSearchIndexServiceITest method Test.
/**
* Test.
*
* @throws Exception
* the exception
*/
@Test
public void Test() throws Exception {
setAuthenticatedAdminuser();
final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
final UpdateSearchIndexRequest serviceRequest = new UpdateSearchIndexRequest();
serviceRequest.setSessionId(createSessionRequest.getSessionId());
final UpdateSearchIndexResponse response = (UpdateSearchIndexResponse) applicationManager.service(serviceRequest);
assertNotNull(EXPECT_A_RESULT, response);
}
Aggregations