use of org.entando.entando.aps.system.services.api.model.ApiResource in project entando-core by entando.
the class ApiServiceCacheWrapper method buildApiGetMethods.
protected List<ApiMethod> buildApiGetMethods(Map<String, ApiResource> resources) {
List<ApiMethod> apiGETMethods = new ArrayList<>();
List<ApiResource> resourceList = new ArrayList<>(resources.values());
for (int i = 0; i < resourceList.size(); i++) {
ApiResource apiResource = resourceList.get(i);
if (null != apiResource.getGetMethod()) {
apiGETMethods.add(apiResource.getGetMethod());
}
}
return apiGETMethods;
}
use of org.entando.entando.aps.system.services.api.model.ApiResource in project entando-core by entando.
the class AbstractApiFinderAction method getResourceFlavoursMapping.
private Map<String, List<ApiResource>> getResourceFlavoursMapping(List<String> pluginCodes) throws Throwable {
Map<String, List<ApiResource>> finalMapping = new HashMap<String, List<ApiResource>>();
try {
Map<String, ApiResource> masterResources = this.getApiCatalogManager().getResources();
Iterator<ApiResource> resourcesIter = masterResources.values().iterator();
while (resourcesIter.hasNext()) {
ApiResource apiResource = resourcesIter.next();
if (this.includeIntoMapping(apiResource)) {
List<ApiResource> resources = finalMapping.get(apiResource.getSectionCode());
if (null == resources) {
resources = new ArrayList<ApiResource>();
finalMapping.put(apiResource.getSectionCode(), resources);
}
resources.add(apiResource);
String pluginCode = apiResource.getPluginCode();
if (null != pluginCode && !pluginCodes.contains(pluginCode)) {
pluginCodes.add(pluginCode);
}
}
}
Collections.sort(pluginCodes);
} catch (Throwable t) {
_logger.error("Error extracting resource Flavours mapping", t);
// ApsSystemUtils.logThrowable(t, this, "getResourceFlavoursMapping");
throw new RuntimeException("Error extracting resource Flavours mapping", t);
}
return finalMapping;
}
use of org.entando.entando.aps.system.services.api.model.ApiResource in project entando-core by entando.
the class AbstractApiFinderAction method addResourceGroup.
private void addResourceGroup(String groupCode, Map<String, List<ApiResource>> mapping, List<List<ApiResource>> group) {
List<ApiResource> singleGroup = mapping.get(groupCode);
if (null != singleGroup) {
BeanComparator comparator = new BeanComparator("resourceName");
Collections.sort(singleGroup, comparator);
group.add(singleGroup);
}
}
use of org.entando.entando.aps.system.services.api.model.ApiResource in project entando-core by entando.
the class ApiResourceAction method resetAllMethodStatus.
public String resetAllMethodStatus() {
try {
ApiResource resource = this.getApiResource();
this.resetMethodStatus(resource.getGetMethod());
this.resetMethodStatus(resource.getPostMethod());
this.resetMethodStatus(resource.getPutMethod());
this.resetMethodStatus(resource.getDeleteMethod());
} catch (Throwable t) {
_logger.error("Error resetting all method status", t);
// ApsSystemUtils.logThrowable(t, this, "resetAllMethodStatus", "Error resetting all method status");
return FAILURE;
}
return SUCCESS;
}
use of org.entando.entando.aps.system.services.api.model.ApiResource in project entando-core by entando.
the class TestApiI18nLabelInterface method testGetLabel.
protected JAXBI18nLabel testGetLabel(MediaType mediaType, String username, String key) throws Throwable {
ApiResource contentResource = this.getApiCatalogManager().getResource("core", "i18nlabel");
ApiMethod getMethod = contentResource.getGetMethod();
Properties properties = super.createApiProperties(username, "en", mediaType);
properties.put("key", key);
Object result = this.getResponseBuilder().createResponse(getMethod, properties);
assertNotNull(result);
ApiI18nLabelInterface apiLabelInterface = (ApiI18nLabelInterface) this.getApplicationContext().getBean("ApiI18nLabelInterface");
Object singleResult = apiLabelInterface.getLabel(properties);
assertNotNull(singleResult);
String toString = this.marshall(singleResult, mediaType);
InputStream stream = new ByteArrayInputStream(toString.getBytes());
JAXBI18nLabel jaxbLabel = (JAXBI18nLabel) UnmarshalUtils.unmarshal(super.getApplicationContext(), JAXBI18nLabel.class, stream, mediaType);
assertNotNull(jaxbLabel);
return jaxbLabel;
}
Aggregations