Search in sources :

Example 71 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class I18nManagerIntegrationTest method testGetLabelGroup.

public void testGetLabelGroup() throws Throwable {
    ApsProperties labelsProp = _i18nManager.getLabelGroup("PAGE_TITLE");
    assertNotNull(labelsProp);
    assertEquals(2, labelsProp.size());
    assertTrue(labelsProp.containsKey("it"));
    assertTrue(labelsProp.containsKey("en"));
    labelsProp = _i18nManager.getLabelGroup("userprofile_PFL_fullname");
    assertNotNull(labelsProp);
    assertEquals(1, labelsProp.size());
    assertTrue(labelsProp.containsKey("it"));
    assertFalse(labelsProp.containsKey("en"));
    labelsProp = _i18nManager.getLabelGroup("not-exists");
    assertNull(labelsProp);
}
Also used : ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 72 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class I18nManagerTest method testUpdateLabels.

@Test
public void testUpdateLabels() throws Throwable {
    String key = "TEST_KEY";
    ApsProperties labels = createLabel("prova", "test");
    i18nManager.updateLabelGroup(key, labels);
    Mockito.verify(cacheWrapper, Mockito.times(1)).updateLabelGroup(key, labels);
}
Also used : ApsProperties(com.agiletec.aps.util.ApsProperties) Test(org.junit.Test)

Example 73 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class I18nManagerTest method createLabel.

public static ApsProperties createLabel(String it, String en) {
    ApsProperties labelOne = new ApsProperties();
    labelOne.put("it", it);
    labelOne.put("en", en);
    return labelOne;
}
Also used : ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 74 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class I18nManagerTest method testAddLabelGroup.

@Test
public void testAddLabelGroup() throws Throwable {
    String key = "TEST_KEY";
    ApsProperties labels = createLabel("prova", "test");
    i18nManager.addLabelGroup(key, labels);
    Mockito.verify(cacheWrapper, Mockito.times(1)).addLabelGroup(key, labels);
}
Also used : ApsProperties(com.agiletec.aps.util.ApsProperties) Test(org.junit.Test)

Example 75 with ApsProperties

use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.

the class DataObjectListHelper method extractContentsId.

protected List<String> extractContentsId(IDataObjectListTagBean bean, RequestContext reqCtx) throws ApsSystemException {
    List<String> contentsId = null;
    try {
        List<UserFilterOptionBean> userFilters = bean.getUserFilterOptions();
        Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
        ApsProperties config = (null != widget) ? widget.getConfig() : null;
        if (null == bean.getDataType() && null != config) {
            bean.setContentType(config.getProperty(WIDGET_PARAM_CONTENT_TYPE));
        }
        if (null == bean.getDataType()) {
            throw new ApsSystemException("Tipo contenuto non definito");
        }
        if (null == bean.getCategory() && null != config && null != config.getProperty(SHOWLET_PARAM_CATEGORY)) {
            bean.setCategory(config.getProperty(SHOWLET_PARAM_CATEGORY));
        }
        this.addWidgetFilters(bean, config, WIDGET_PARAM_FILTERS, reqCtx);
        if (null != userFilters && userFilters.size() > 0) {
            for (int i = 0; i < userFilters.size(); i++) {
                UserFilterOptionBean userFilter = userFilters.get(i);
                EntitySearchFilter filter = userFilter.getEntityFilter();
                if (null != filter) {
                    bean.addFilter(filter);
                }
            }
        }
        String[] categories = this.getCategories(bean.getCategories(), config, userFilters);
        Collection<String> userGroupCodes = this.getAllowedGroups(reqCtx);
        boolean orCategoryFilterClause = this.extractOrCategoryFilterClause(config);
        contentsId = this.getDataObjectManager().loadDataObjectsId(bean.getDataType(), categories, orCategoryFilterClause, bean.getFilters(), userGroupCodes);
    } catch (Throwable t) {
        _logger.error("Error extracting contents id", t);
        throw new ApsSystemException("Error extracting contents id", t);
    }
    return contentsId;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) ApsProperties(com.agiletec.aps.util.ApsProperties) EntitySearchFilter(com.agiletec.aps.system.common.entity.model.EntitySearchFilter)

Aggregations

ApsProperties (com.agiletec.aps.util.ApsProperties)146 Widget (com.agiletec.aps.system.services.page.Widget)62 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)34 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)29 HashMap (java.util.HashMap)17 IPage (com.agiletec.aps.system.services.page.IPage)16 Lang (com.agiletec.aps.system.services.lang.Lang)14 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)10 Properties (java.util.Properties)9 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)9 List (java.util.List)8 RestServerError (org.entando.entando.aps.system.exception.RestServerError)8 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)7 Page (com.agiletec.aps.system.services.page.Page)6 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)6 NavigatorExpression (com.agiletec.aps.system.services.page.widget.NavigatorExpression)6 ArrayList (java.util.ArrayList)6 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)6 IWidgetTypeManager (org.entando.entando.aps.system.services.widgettype.IWidgetTypeManager)6 ValidationGenericException (org.entando.entando.web.common.exceptions.ValidationGenericException)6