use of org.entando.entando.aps.system.services.api.model.ServiceParameterInfo in project entando-core by entando.
the class ApiServiceInterface method createServiceInfo.
protected ServiceInfo createServiceInfo(ApiService service, String langCode, String defaultLangCode) {
String description = service.getDescription().getProperty(langCode);
if (null == description || description.trim().length() == 0) {
description = service.getDescription().getProperty(defaultLangCode);
}
ServiceInfo smallService = new ServiceInfo(service.getKey(), description, service.getTag());
String[] freeParameters = service.getFreeParameters();
if (null != freeParameters && freeParameters.length > 0) {
for (int i = 0; i < freeParameters.length; i++) {
String freeParameter = freeParameters[i];
ApiMethodParameter apiParameter = service.getMaster().getParameter(freeParameter);
if (null != apiParameter) {
ServiceParameterInfo spi = new ServiceParameterInfo(apiParameter);
ApsProperties serviceParameters = service.getParameters();
String defaultValue = (null != serviceParameters) ? serviceParameters.getProperty(freeParameter) : null;
if (null != defaultValue) {
spi.setDefaultValue(defaultValue);
spi.setRequired(false);
}
smallService.addParameter(spi);
}
}
}
return smallService;
}
Aggregations