Search in sources :

Example 31 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestDataObjectListHelper method getShowletForTest.

private Widget getShowletForTest(String showletTypeCode, ApsProperties config) throws Throwable {
    WidgetType type = this._showletTypeManager.getWidgetType(showletTypeCode);
    Widget widget = new Widget();
    widget.setType(type);
    if (null != config) {
        widget.setConfig(config);
    }
    return widget;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Example 32 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class DataObjectMapperCacheWrapperTest method createMockWidget.

private Widget createMockWidget() {
    Widget widget = new Widget();
    WidgetType type = new WidgetType();
    type.setCode("type");
    WidgetTypeParameter param1 = new WidgetTypeParameter();
    param1.setName("dataId");
    WidgetTypeParameter param2 = new WidgetTypeParameter();
    param2.setName("testParam");
    List<WidgetTypeParameter> params = Arrays.asList(new WidgetTypeParameter[] { param1, param2 });
    type.setTypeParameters(params);
    widget.setType(type);
    ApsProperties props = new ApsProperties();
    props.put("dataId", "id1");
    props.put("testParam", "test");
    widget.setConfig(props);
    return widget;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) WidgetTypeParameter(org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 33 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestApiWidgetTypeInterface method testJaxbWidgetType.

private void testJaxbWidgetType(String widgetTypeCode) throws Throwable {
    WidgetType widgetType = this._widgetTypeManager.getWidgetType(widgetTypeCode);
    JAXBWidgetType jaxbWidgetType = this.getJaxbWidgetType(widgetType);
    String body = this.getMarshalledObject(jaxbWidgetType);
    assertNotNull(body);
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Example 34 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestApiWidgetTypeInterface method addMockWidget.

private void addMockWidget(String widgetTypeCode) throws Throwable {
    WidgetType type = new WidgetType();
    type.setCode(widgetTypeCode);
    ApsProperties titles = new ApsProperties();
    titles.setProperty("en", "English title");
    titles.setProperty("it", "Italian title");
    type.setTitles(titles);
    this._widgetTypeManager.addWidgetType(type);
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 35 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestApiWidgetTypeInterface method testInvokeAddJaxbWidgetType.

private void testInvokeAddJaxbWidgetType(String newWidgetTypeCode, String widgetToClone, String customSingleGui, boolean expectedSuccess) throws Throwable {
    WidgetType widgetType = this._widgetTypeManager.getWidgetType(widgetToClone);
    assertNotNull(widgetType);
    WidgetType newWidgetType = widgetType.clone();
    assertNull(this._widgetTypeManager.getWidgetType(newWidgetTypeCode));
    newWidgetType.setCode(newWidgetTypeCode);
    try {
        JAXBWidgetType jaxbWidgetType = this.getJaxbWidgetType(newWidgetType);
        if (null != customSingleGui) {
            jaxbWidgetType.setGui(customSingleGui);
        }
        this._apiWidgetTypeInterface.addWidgetType(jaxbWidgetType);
        if (!expectedSuccess) {
            fail();
        }
        WidgetType extractedWidgetType = this._widgetTypeManager.getWidgetType(newWidgetTypeCode);
        assertNotNull(extractedWidgetType);
        assertEquals(newWidgetType.getConfig(), extractedWidgetType.getConfig());
        assertEquals(newWidgetType.getMainGroup(), extractedWidgetType.getMainGroup());
        assertEquals(newWidgetType.getTitles(), extractedWidgetType.getTitles());
        assertEquals(newWidgetType.getTypeParameters(), extractedWidgetType.getTypeParameters());
        assertFalse(extractedWidgetType.isLocked());
    } catch (ApiException ae) {
        if (expectedSuccess) {
            fail();
        }
    } catch (Throwable t) {
        throw t;
    } finally {
        List<String> codes = this._guiFragmentManager.getGuiFragmentCodesByWidgetType(newWidgetTypeCode);
        if (null != codes) {
            for (int i = 0; i < codes.size(); i++) {
                String code = codes.get(i);
                this._guiFragmentManager.deleteGuiFragment(code);
            }
        }
        this._widgetTypeManager.deleteWidgetType(newWidgetTypeCode);
    }
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApiException(org.entando.entando.aps.system.services.api.model.ApiException)

Aggregations

WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)70 ApsProperties (com.agiletec.aps.util.ApsProperties)33 Widget (com.agiletec.aps.system.services.page.Widget)20 IPage (com.agiletec.aps.system.services.page.IPage)11 GuiFragment (org.entando.entando.aps.system.services.guifragment.GuiFragment)10 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)9 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)5 WidgetTypeParameter (org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)5 ActionSupport (com.opensymphony.xwork2.ActionSupport)4 IManager (com.agiletec.aps.system.common.IManager)3 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)3 Lang (com.agiletec.aps.system.services.lang.Lang)3 List (java.util.List)3 JAXBGuiFragment (org.entando.entando.aps.system.services.guifragment.api.JAXBGuiFragment)3 IWidgetTypeManager (org.entando.entando.aps.system.services.widgettype.IWidgetTypeManager)3 ILangManager (com.agiletec.aps.system.services.lang.ILangManager)2 SelectItem (com.agiletec.aps.util.SelectItem)2 Properties (java.util.Properties)2 ApiMethod (org.entando.entando.aps.system.services.api.model.ApiMethod)2