use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestApiWidgetTypeInterface method testUpdateJaxbWidgetType.
public void testUpdateJaxbWidgetType() throws Throwable {
ApsProperties titles = new ApsProperties();
titles.setProperty("en", "English title");
titles.setProperty("it", "Italian title");
this.testInvokeUpdateJaxbNoLogicWidgetType("login_form", titles, true, null, true);
this.testInvokeUpdateJaxbNoLogicWidgetType("login_form", titles, true, "Gui of login_form", true);
}
use of com.agiletec.aps.util.ApsProperties 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);
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class JAXBWidgetType method getNewWidgetType.
public WidgetType getNewWidgetType(IWidgetTypeManager widgetTypeManager) {
WidgetType type = new WidgetType();
type.setCode(this.getCode());
type.setTitles(this.getTitles());
List<WidgetTypeParameter> parameters = this.getTypeParameters();
if (null != parameters && !parameters.isEmpty()) {
type.setTypeParameters(parameters);
type.setAction("configSimpleParameter");
} else {
ApsProperties configuration = this.getConfig();
String parentTypeCode = this.getParentTypeCode();
if (null != parentTypeCode && null != configuration && !configuration.isEmpty()) {
WidgetType parentType = widgetTypeManager.getWidgetType(parentTypeCode);
type.setParentType(parentType);
type.setConfig(configuration);
}
}
type.setMainGroup(this.getMainGroup());
// type.setLocked(this.isLocked());
type.setPluginCode(this.getPluginCode());
return type;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class WidgetTypeDAO method createWidgetTypeFromResultSet.
protected WidgetType createWidgetTypeFromResultSet(ResultSet res) throws ApsSystemException {
WidgetType widgetType = new WidgetType();
String code = null;
try {
code = res.getString(1);
widgetType.setCode(code);
String xmlTitles = res.getString(2);
ApsProperties titles = new ApsProperties();
titles.loadFromXml(xmlTitles);
widgetType.setTitles(titles);
String xml = res.getString(3);
if (null != xml && xml.trim().length() > 0) {
WidgetTypeDOM showletTypeDom = new WidgetTypeDOM(xml, this.getLangManager().getLangs());
widgetType.setTypeParameters(showletTypeDom.getParameters());
widgetType.setAction(showletTypeDom.getAction());
}
widgetType.setPluginCode(res.getString(4));
widgetType.setParentTypeCode(res.getString(5));
String config = res.getString(6);
if (null != config && config.trim().length() > 0) {
ApsProperties defaultConfig = new ApsProperties();
defaultConfig.loadFromXml(config);
widgetType.setConfig(defaultConfig);
}
if ((null != widgetType.getConfig() && null == widgetType.getParentTypeCode())) {
throw new ApsSystemException("Default configuration found in the type '" + code + "' with no parent type assigned");
}
int isLocked = res.getInt(7);
widgetType.setLocked(isLocked == 1);
String mainGroup = res.getString(8);
if (null != mainGroup && mainGroup.trim().length() > 0) {
widgetType.setMainGroup(mainGroup.trim());
}
String configUi = res.getString(9);
if (StringUtils.isNotEmpty(configUi)) {
widgetType.setConfigUi(configUi);
}
String bundleId = res.getString(10);
if (StringUtils.isNotEmpty(bundleId)) {
widgetType.setBundleId(bundleId);
}
} catch (Throwable t) {
logger.error("Error parsing the Widget Type '{}'", code, t);
throw new ApsSystemException("Error in the parsing in the Widget Type '" + code + "'", t);
}
return widgetType;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class WidgetTypeAction method extractWidgetTypeConfig.
private ApsProperties extractWidgetTypeConfig(List<WidgetTypeParameter> parameters) throws Exception {
ApsProperties config = new ApsProperties();
for (int i = 0; i < parameters.size(); i++) {
WidgetTypeParameter param = parameters.get(i);
String paramName = param.getName();
String value = this.getRequest().getParameter(paramName);
if (value != null && value.trim().length() > 0) {
config.setProperty(paramName, value);
}
}
return config;
}
Aggregations