use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class ManageUserAccountServiceITest method manageUserAccountSuccessUnLockTest.
@Test
public void manageUserAccountSuccessUnLockTest() throws Exception {
setAuthenticatedAnonymousUser();
final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
final RegisterUserRequest createAccountRequest = new RegisterUserRequest();
createAccountRequest.setCountry("Sweden");
createAccountRequest.setUsername(UUID.randomUUID().toString());
createAccountRequest.setEmail(createAccountRequest.getUsername() + "@email.com");
createAccountRequest.setUserpassword("Userpassword1!");
createAccountRequest.setUserType(UserType.PRIVATE);
createAccountRequest.setSessionId(createSessionRequest.getSessionId());
final RegisterUserResponse response = (RegisterUserResponse) applicationManager.service(createAccountRequest);
assertNotNull("Expect a result", response);
assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, response.getResult());
setAuthenticatedAdminuser();
final DataContainer<UserAccount, Long> userContainer = applicationManager.getDataContainer(UserAccount.class);
final List<UserAccount> firstCreatedUsed = userContainer.getAllBy(UserAccount_.username, createAccountRequest.getUsername());
assertEquals(1, firstCreatedUsed.size());
final ManageUserAccountRequest deleteAccountRequest = new ManageUserAccountRequest();
deleteAccountRequest.setSessionId(createSessionRequest.getSessionId());
deleteAccountRequest.setAccountOperation(AccountOperation.UNLOCK);
deleteAccountRequest.setUserAcountId(firstCreatedUsed.get(0).getUserId());
final ManageUserAccountResponse deleteAccountResponse = (ManageUserAccountResponse) applicationManager.service(deleteAccountRequest);
assertNotNull(EXPECT_A_RESULT, deleteAccountResponse);
assertEquals(EXPECT_SUCCESS, ServiceResult.SUCCESS, deleteAccountResponse.getResult());
final List<UserAccount> allByAfterDelete = userContainer.getAllBy(UserAccount_.username, createAccountRequest.getUsername());
assertEquals(1, allByAfterDelete.size());
assertEquals(allByAfterDelete.get(0).getUserLockStatus(), UserLockStatus.UNLOCKED);
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class MinistryDataSeriesFactoryImpl method createMinistryChartTimeSeriesCurrent.
@Override
public DataSeries createMinistryChartTimeSeriesCurrent() {
DataSeries dataSeries = new DataSeries();
final DataContainer<ViewRiksdagenMinistry, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenMinistry.class);
for (final ViewRiksdagenMinistry data : dataContainer.getAll()) {
if (data.isActive()) {
dataSeries = dataSeries.newSeries().add(data.getNameId(), data.getCurrentMemberSize());
}
}
return dataSeries;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class MinistryDataSeriesFactoryImpl method createMinistryChartTimeSeriesAll.
@Override
public DataSeries createMinistryChartTimeSeriesAll() {
DataSeries dataSeries = new DataSeries();
final DataContainer<ViewRiksdagenMinistry, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenMinistry.class);
for (final ViewRiksdagenMinistry data : dataContainer.getAll()) {
dataSeries = dataSeries.newSeries().add(data.getNameId(), data.getTotalAssignments());
}
return dataSeries;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PartyDataSeriesFactoryImpl method createChartTimeSeriesCurrentGovernmentByParty.
@Override
public DataSeries createChartTimeSeriesCurrentGovernmentByParty() {
DataSeries dataSeries = new DataSeries();
final DataContainer<ViewRiksdagenParty, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenParty.class);
final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
partySummarydataContainer.getAll();
for (final ViewRiksdagenParty data : dataContainer.getAll()) {
final ViewRiksdagenPartySummary summary = partySummarydataContainer.load(data.getPartyId());
if (summary != null && summary.isActive()) {
dataSeries = dataSeries.newSeries().add(data.getPartyName(), summary.getTotalActiveGovernment());
}
}
return dataSeries;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PartyDataSeriesFactoryImpl method createPartyChartTimeSeriesCurrent.
@Override
public DataSeries createPartyChartTimeSeriesCurrent() {
DataSeries dataSeries = new DataSeries();
final DataContainer<ViewRiksdagenPartySummary, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
for (final ViewRiksdagenPartySummary data : dataContainer.getAllOrderBy(ViewRiksdagenPartySummary_.currentAssignments)) {
if (data != null && data.isActiveParliament()) {
dataSeries = dataSeries.newSeries().add(getPartyName(data.getParty()), data.getTotalActiveParliament());
}
}
return dataSeries;
}
Aggregations