Search in sources :

Example 1 with RefreshDataViewsResponse

use of com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse 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 2 with RefreshDataViewsResponse

use of com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse 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

RefreshDataViewsResponse (com.hack23.cia.service.api.action.admin.RefreshDataViewsResponse)2 UserAccount (com.hack23.cia.model.internal.application.user.impl.UserAccount)1 RefreshDataViewsRequest (com.hack23.cia.service.api.action.admin.RefreshDataViewsRequest)1 CreateApplicationEventRequest (com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)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