use of org.entando.entando.aps.system.services.api.model.ApiMethodRelatedWidget in project entando-core by entando.
the class ApiCatalogManager method getRelatedWidgetMethods.
@Override
public Map<String, ApiMethod> getRelatedWidgetMethods() throws ApsSystemException {
Map<String, ApiMethod> mapping = new HashMap<String, ApiMethod>();
try {
List<ApiMethod> masterMethods = this.getMasterMethods(ApiMethod.HttpMethod.GET);
for (int i = 0; i < masterMethods.size(); i++) {
ApiMethod apiMethod = masterMethods.get(i);
ApiMethodRelatedWidget relatedWidget = apiMethod.getRelatedWidget();
if (null != relatedWidget) {
String widgetCode = relatedWidget.getWidgetCode();
if (mapping.containsKey(widgetCode)) {
ApiMethod alreadyMapped = mapping.get(widgetCode);
logger.error("There is more than one method related whith widget '{}' - Actual mapped '{}'; other method '{}'", widgetCode, alreadyMapped.getResourceName(), apiMethod.getResourceName());
} else {
mapping.put(widgetCode, apiMethod.clone());
}
}
}
} catch (Throwable t) {
logger.error("Error loading related widget methods", t);
throw new ApsSystemException("Error loading related widget methods", t);
}
return mapping;
}
use of org.entando.entando.aps.system.services.api.model.ApiMethodRelatedWidget in project entando-core by entando.
the class ApiCatalogManager method getRelatedMethod.
@Override
public ApiMethod getRelatedMethod(String showletCode) throws ApsSystemException {
List<ApiMethod> masterMethods = this.getMasterMethods(ApiMethod.HttpMethod.GET);
for (int i = 0; i < masterMethods.size(); i++) {
ApiMethod apiMethod = masterMethods.get(i);
ApiMethodRelatedWidget relatedWidget = apiMethod.getRelatedWidget();
if (null != relatedWidget && relatedWidget.getWidgetCode().equals(showletCode)) {
return apiMethod.clone();
}
}
return null;
}
Aggregations