Search in sources :

Example 1 with PathSummary

use of com.webcohesion.enunciate.api.PathSummary in project enunciate by stoicflame.

the class AnnotationBasedResourceGroupImpl method getPaths.

@Override
public List<PathSummary> getPaths() {
    HashMap<String, PathSummary> paths = new HashMap<String, PathSummary>();
    for (Resource resource : this.resources) {
        PathSummary pathSummary = paths.get(resource.getPath());
        if (pathSummary == null) {
            pathSummary = new PathSummaryImpl(resource.getPath(), new TreeSet<String>(), resource.getStyles());
            paths.put(resource.getPath(), pathSummary);
        }
        for (Method method : resource.getMethods()) {
            pathSummary.getMethods().add(method.getHttpMethod());
        }
    }
    ArrayList<PathSummary> pathSummaries = new ArrayList<PathSummary>(paths.values());
    Collections.sort(pathSummaries, new PathSummaryComparator(sortStrategy));
    return pathSummaries;
}
Also used : PathSummaryComparator(com.webcohesion.enunciate.util.PathSummaryComparator) PathSummary(com.webcohesion.enunciate.api.PathSummary) Resource(com.webcohesion.enunciate.api.resources.Resource) Method(com.webcohesion.enunciate.api.resources.Method)

Example 2 with PathSummary

use of com.webcohesion.enunciate.api.PathSummary in project enunciate by stoicflame.

the class ResourceClassResourceGroupImpl method getPaths.

@Override
public List<PathSummary> getPaths() {
    HashMap<String, PathSummary> summaries = new HashMap<String, PathSummary>();
    for (Resource resource : this.resources) {
        Set<String> methods = new TreeSet<String>();
        for (Method method : resource.getMethods()) {
            methods.add(method.getHttpMethod());
        }
        PathSummary summary = summaries.get(resource.getPath());
        if (summary == null) {
            summary = new PathSummaryImpl(resource.getPath(), methods, resource.getStyles());
            summaries.put(resource.getPath(), summary);
        } else {
            summary.getMethods().addAll(methods);
        }
    }
    ArrayList<PathSummary> pathSummaries = new ArrayList<PathSummary>(summaries.values());
    Collections.sort(pathSummaries, new PathSummaryComparator(controllerClass.getContext().getPathSortStrategy()));
    return pathSummaries;
}
Also used : PathSummaryComparator(com.webcohesion.enunciate.util.PathSummaryComparator) PathSummary(com.webcohesion.enunciate.api.PathSummary) Resource(com.webcohesion.enunciate.api.resources.Resource) Method(com.webcohesion.enunciate.api.resources.Method)

Example 3 with PathSummary

use of com.webcohesion.enunciate.api.PathSummary in project enunciate by stoicflame.

the class ResourceClassResourceGroupImpl method getPaths.

@Override
public List<PathSummary> getPaths() {
    HashMap<String, PathSummary> summaries = new HashMap<String, PathSummary>();
    for (Resource resource : this.resources) {
        Set<String> methods = new TreeSet<String>();
        for (Method method : resource.getMethods()) {
            methods.add(method.getHttpMethod());
        }
        PathSummary summary = summaries.get(resource.getPath());
        if (summary == null) {
            summary = new PathSummaryImpl(resource.getPath(), methods, resource.getStyles());
            summaries.put(resource.getPath(), summary);
        } else {
            summary.getMethods().addAll(methods);
        }
    }
    ArrayList<PathSummary> pathSummaries = new ArrayList<PathSummary>(summaries.values());
    Collections.sort(pathSummaries, new PathSummaryComparator(resourceClass.getContext().getPathSortStrategy()));
    return pathSummaries;
}
Also used : PathSummaryComparator(com.webcohesion.enunciate.util.PathSummaryComparator) PathSummary(com.webcohesion.enunciate.api.PathSummary) Resource(com.webcohesion.enunciate.api.resources.Resource) Method(com.webcohesion.enunciate.api.resources.Method) ResourceMethod(com.webcohesion.enunciate.modules.jaxrs.model.ResourceMethod)

Example 4 with PathSummary

use of com.webcohesion.enunciate.api.PathSummary in project enunciate by stoicflame.

the class AnnotationBasedResourceGroupImpl method getPaths.

@Override
public List<PathSummary> getPaths() {
    HashMap<String, PathSummary> paths = new HashMap<String, PathSummary>();
    for (Resource resource : this.resources) {
        PathSummary pathSummary = paths.get(resource.getPath());
        if (pathSummary == null) {
            pathSummary = new PathSummaryImpl(resource.getPath(), new TreeSet<String>(), resource.getStyles());
            paths.put(resource.getPath(), pathSummary);
        }
        for (Method method : resource.getMethods()) {
            pathSummary.getMethods().add(method.getHttpMethod());
        }
    }
    ArrayList<PathSummary> pathSummaries = new ArrayList<PathSummary>(paths.values());
    Collections.sort(pathSummaries, new PathSummaryComparator(sortStrategy));
    return pathSummaries;
}
Also used : PathSummaryComparator(com.webcohesion.enunciate.util.PathSummaryComparator) PathSummary(com.webcohesion.enunciate.api.PathSummary) Resource(com.webcohesion.enunciate.api.resources.Resource) Method(com.webcohesion.enunciate.api.resources.Method)

Aggregations

PathSummary (com.webcohesion.enunciate.api.PathSummary)4 Method (com.webcohesion.enunciate.api.resources.Method)4 Resource (com.webcohesion.enunciate.api.resources.Resource)4 PathSummaryComparator (com.webcohesion.enunciate.util.PathSummaryComparator)4 ResourceMethod (com.webcohesion.enunciate.modules.jaxrs.model.ResourceMethod)1