Search in sources :

Example 1 with RefreshDataViewsRequest

use of com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest in project cia by Hack23.

the class RefreshDataViewsClickListener method buttonClick.

@Override
public void buttonClick(final ClickEvent event) {
    final RefreshDataViewsRequest serviceRequest = new RefreshDataViewsRequest();
    serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    ApplicationMangerAccess.getApplicationManager().asyncService(serviceRequest);
    Notification.show(REFRESH_VIEWS_STARTED);
}
Also used : RefreshDataViewsRequest(com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest)

Example 2 with RefreshDataViewsRequest

use of com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest in project cia by Hack23.

the class RefreshDataViewsService method createApplicationEventForService.

@Override
protected CreateApplicationEventRequest createApplicationEventForService(final RefreshDataViewsRequest serviceRequest) {
    final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest();
    eventRequest.setEventGroup(ApplicationEventGroup.ADMIN);
    eventRequest.setApplicationOperation(ApplicationOperationType.UPDATE);
    eventRequest.setActionName(RefreshDataViewsRequest.class.getSimpleName());
    eventRequest.setSessionId(serviceRequest.getSessionId());
    return eventRequest;
}
Also used : RefreshDataViewsRequest(com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest) CreateApplicationEventRequest(com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)

Example 3 with RefreshDataViewsRequest

use of com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest in project cia by Hack23.

the class RefreshDataViewsService method processService.

@Override
@Secured({ "ROLE_ADMIN" })
public RefreshDataViewsResponse processService(final RefreshDataViewsRequest serviceRequest) {
    final RefreshDataViewsResponse inputValidation = inputValidation(serviceRequest);
    if (inputValidation != null) {
        return inputValidation;
    }
    final CreateApplicationEventRequest eventRequest = createApplicationEventForService(serviceRequest);
    final UserAccount userAccount = getUserAccountFromSecurityContext();
    if (userAccount != null) {
        eventRequest.setUserId(userAccount.getUserId());
    }
    final RefreshDataViewsResponse response = new RefreshDataViewsResponse(ServiceResult.SUCCESS);
    viewDataManager.refreshViews();
    eventRequest.setApplicationMessage(response.getResult().toString());
    createApplicationEventService.processService(eventRequest);
    return response;
}
Also used : CreateApplicationEventRequest(com.hack23.cia.service.api.action.application.CreateApplicationEventRequest) RefreshDataViewsResponse(com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse) UserAccount(com.hack23.cia.model.internal.application.user.impl.UserAccount) Secured(org.springframework.security.access.annotation.Secured)

Example 4 with RefreshDataViewsRequest

use of com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest in project cia by Hack23.

the class RefreshDataViewsServiceITest method Test.

/**
 * Test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void Test() throws Exception {
    setAuthenticatedAdminuser();
    final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
    final RefreshDataViewsRequest serviceRequest = new RefreshDataViewsRequest();
    serviceRequest.setSessionId(createSessionRequest.getSessionId());
    final RefreshDataViewsResponse response = (RefreshDataViewsResponse) applicationManager.service(serviceRequest);
    assertNotNull(EXPECT_A_RESULT, response);
    assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
}
Also used : RefreshDataViewsRequest(com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest) CreateApplicationSessionRequest(com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest) RefreshDataViewsResponse(com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse) Test(org.junit.Test) AbstractServiceFunctionalIntegrationTest(com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)

Aggregations

RefreshDataViewsRequest (com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest)3 RefreshDataViewsResponse (com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse)2 CreateApplicationEventRequest (com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)2 UserAccount (com.hack23.cia.model.internal.application.user.impl.UserAccount)1 CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)1 AbstractServiceFunctionalIntegrationTest (com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)1 Test (org.junit.Test)1 Secured (org.springframework.security.access.annotation.Secured)1