use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ApiServiceAction method newService.
/**
* Create of new api service.
*
* @return The result code.
*/
public String newService() {
try {
if (null != this.getResourceCode()) {
String[] sections = this.getResourceCode().split(":");
if (sections.length == 2) {
this.setNamespace(sections[0]);
this.setResourceName(sections[1]);
} else {
this.setResourceName(sections[0]);
}
}
String check = this.checkMasterMethod(this.getNamespace(), this.getResourceName());
if (null != check) {
return check;
}
ApiMethod masterMethod = this.getMethod(this.getNamespace(), this.getResourceName());
if (null != this.getWidgetTypeCode() && null != masterMethod.getRelatedWidget()) {
WidgetType type = this.getWidgetTypeManager().getWidgetType(this.getWidgetTypeCode());
if (null != type && type.isLogic()) {
ApsProperties parameters = this.extractParametersFromWidgetProperties(masterMethod.getRelatedWidget(), type.getConfig());
this.setApiParameterValues(parameters);
}
}
this.setApiParameters(masterMethod.getParameters());
this.setStrutsAction(ApsAdminSystemConstants.ADD);
this.setServiceKey(this.buildTempKey(masterMethod.getResourceName()));
} catch (Throwable t) {
_logger.error("error in newService", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class CurrentUserProfileAction method addLabelGroups.
protected void addLabelGroups(String key, String defaultValue) throws ApsSystemException {
try {
ApsProperties properties = new ApsProperties();
Lang defaultLang = super.getLangManager().getDefaultLang();
properties.put(defaultLang.getCode(), defaultValue);
this.getI18nManager().addLabelGroup(key, properties);
} catch (Throwable t) {
_logger.error("Error adding label groups - key '{}'", key, t);
// ApsSystemUtils.logThrowable(t, this, "addLabelGroups");
throw new RuntimeException("Error adding label groups - key '" + key + "'", t);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class PageAction method addPublishedContents.
protected void addPublishedContents(Widget[] widgets, Collection<Content> contents) {
try {
if (widgets != null) {
for (Widget widget : widgets) {
ApsProperties config = (null != widget) ? widget.getConfig() : null;
if (null == config || config.isEmpty()) {
continue;
}
String extracted = config.getProperty("contentId");
this.addContent(contents, extracted);
String contentsParam = config.getProperty("contents");
List<Properties> properties = (null != contentsParam) ? RowContentListHelper.fromParameterToContents(contentsParam) : null;
if (null == properties || properties.isEmpty()) {
continue;
}
for (int j = 0; j < properties.size(); j++) {
Properties widgProp = properties.get(j);
String extracted2 = widgProp.getProperty("contentId");
this.addContent(contents, extracted2);
}
}
}
} catch (Throwable t) {
String msg = "Error extracting published contents on page";
_logger.error("Error extracting published contents on page", t);
throw new RuntimeException(msg, t);
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentListViewerWidgetAction method validateFilters.
protected void validateFilters() {
WidgetType type = this.getWidget().getType();
ApsProperties config = this.getWidget().getConfig();
if (null != config && null != type && type.hasParameter("categories") && type.hasParameter("maxElemForItem") && type.hasParameter("maxElements") && StringUtils.isNotEmpty(config.getProperty("contentType")) && StringUtils.isEmpty(config.getProperty("categories")) && StringUtils.isEmpty(config.getProperty("maxElemForItem")) && StringUtils.isEmpty(config.getProperty("maxElements"))) {
this.addFieldError("categories", this.getText("error.widget.listViewer.parameters.invalid"));
}
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class ContentListViewerWidgetAction method createValuedShowlet.
@Override
protected void createValuedShowlet() throws Exception {
try {
super.createValuedShowlet();
ApsProperties config = this.getWidget().getConfig();
this.extractFiltersProperties(config);
this.extractUserFiltersProperties(config);
this.extractCategories(config);
} catch (Throwable t) {
_logger.error("Error creating user filter", t);
throw new ApsSystemException("Error creating user filter", t);
}
}
Aggregations