Search in sources :

Example 1 with LanguageData

use of com.hack23.cia.model.internal.application.system.impl.LanguageData in project cia by Hack23.

the class ConfigurationManagerImpl method getUserConfiguration.

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public UserConfiguration getUserConfiguration(final String url, final String locale) {
    final Agency agency = agencyDAO.getAll().get(0);
    Portal usePortal = null;
    final LanguageData languageData = findLanguage(locale);
    for (final Portal portal : agency.getPortals()) {
        if (usePortal == null && PortalType.DEFAULT == portal.getPortalType() || url.contains(portal.getPortalName())) {
            usePortal = portal;
        }
    }
    return new UserConfigurationImpl(agency, usePortal, languageData);
}
Also used : Agency(com.hack23.cia.model.internal.application.system.impl.Agency) LanguageData(com.hack23.cia.model.internal.application.system.impl.LanguageData) Portal(com.hack23.cia.model.internal.application.system.impl.Portal) Secured(org.springframework.security.access.annotation.Secured)

Example 2 with LanguageData

use of com.hack23.cia.model.internal.application.system.impl.LanguageData in project cia by Hack23.

the class AdminLanguagePageModContentFactoryImpl 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_LANGUAGE);
    final DataContainer<LanguageData, Long> dataContainer = getApplicationManager().getDataContainer(LanguageData.class);
    final List<LanguageData> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, LanguageData_.languageName);
    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
    getGridFactory().createBasicBeanItemGrid(content, LanguageData.class, pageOrderBy, LANGUAGE_DATA, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
    if (pageId != null && !pageId.isEmpty()) {
        final LanguageData languageData = dataContainer.load(Long.valueOf(pageId));
        if (languageData != null) {
            getFormFactory().addFormPanelTextFields(content, languageData, LanguageData.class, AS_LIST);
        }
    }
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_LANGUAGE_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
    return content;
}
Also used : LanguageData(com.hack23.cia.model.internal.application.system.impl.LanguageData) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

LanguageData (com.hack23.cia.model.internal.application.system.impl.LanguageData)2 Secured (org.springframework.security.access.annotation.Secured)2 Agency (com.hack23.cia.model.internal.application.system.impl.Agency)1 Portal (com.hack23.cia.model.internal.application.system.impl.Portal)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1