use of com.hack23.cia.model.external.worldbank.countries.impl.CountryElement in project cia by Hack23.
the class AdminCountryPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout content = createPanelContent();
final String pageId = getPageId(parameters);
final int pageNr = getPageNr(parameters);
getMenuItemFactory().createMainPageMenuBar(menuBar);
LabelFactory.createHeader2Label(content, ADMIN_COUNTRY);
final DataContainer<CountryElement, Long> dataContainer = getApplicationManager().getDataContainer(CountryElement.class);
final List<CountryElement> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, CountryElement_.countryName);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemNestedPropertiesGrid(content, CountryElement.class, pageOrderBy, COUNTRY2, null, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
if (pageId != null && !pageId.isEmpty()) {
final CountryElement country = dataContainer.load(Long.valueOf(pageId));
if (country != null) {
getFormFactory().addFormPanelTextFields(content, country, CountryElement.class, AS_LIST);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_COUNTRY_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.model.external.worldbank.countries.impl.CountryElement in project cia by Hack23.
the class WorldbankCountryElementWorkConsumerImplITest method onMessageSuccessTest.
/**
* On message success test.
*
* @throws JMSException
* the JMS exception
*/
@Test
@Transactional
public void onMessageSuccessTest() throws JMSException {
final ObjectMessage message = mock(ObjectMessage.class);
when(message.getObject()).thenReturn(new CountryElement());
messsageListener.onMessage(message);
verify(message, atLeastOnce()).getObject();
}
use of com.hack23.cia.model.external.worldbank.countries.impl.CountryElement in project cia by Hack23.
the class WorldBankCountryWorkGeneratorImpl method generateWorkOrders.
@Override
public void generateWorkOrders() {
try {
final List<CountryElement> countryList = worldbankCountryApi.getCountries();
final Map<String, String> currentSaved = getImportService().getWorldBankCountryMap();
for (final CountryElement countryElement : countryList) {
if (countryElement.getCapitalCity() != null && countryElement.getCapitalCity().length() > 0 && !currentSaved.containsKey(countryElement.getIso2Code())) {
getJmsSender().send(countryElementWorkdestination, countryElement);
}
}
} catch (final DataFailureException exception) {
LOGGER.warn("jms", exception);
}
}
Aggregations