All Downloads are FREE. Search and download functionalities are using the official Maven repository.

core.dynamic.resources.ResourceDocumentBuilder Maven / Gradle / Ivy

Go to download

Epikos is a Rest Serivce framework which can be extend to develop any other Rest API/Services. For more detail please checkout github (https://github.com/epikosrest/epikos.git)

There is a newer version: 0.0.7.8.1
Show newest version
package core.dynamic.resources;

import org.glassfish.jersey.server.model.Resource;

import java.util.List;

/**
 * Created by nitina on 5/14/16.
 */
public class ResourceDocumentBuilder {

    private StringBuilder resourceDocument;
    private StringBuilder resourceInvalidApiDocument;
    public static final String docHeader = "Resource API Documents

API Doc

"; public static final String docFooter = "
Resource Path Resource Method Resource Consume Type Resource Produces Type
"; public ResourceDocumentBuilder(){ resourceDocument = new StringBuilder(); resourceInvalidApiDocument = new StringBuilder(); } /*** * Create Table view of API documents * @param resourceList */ public void addResourceValidInformation(List resourceList,String serviceURI){ resourceDocument.append(docHeader); for(Resource resource : resourceList){ addResourceValidInformation(resource,serviceURI); } } private void addResourceValidInformation(Resource resource,String serviceURI){ resourceDocument.append(""); resourceDocument.append(serviceURI + resource.getPath()); resourceDocument.append(""); resourceDocument.append(resource.getResourceMethods().get(0).getHttpMethod()); resourceDocument.append(""); resourceDocument.append(resource.getResourceMethods().get(0).getConsumedTypes().get(0).toString()); resourceDocument.append(""); resourceDocument.append(resource.getResourceMethods().get(0).getProducedTypes().get(0).toString()); resourceDocument.append(""); } public void addResourceInvalidInformation(String invalidInfo){ resourceInvalidApiDocument.append(""); resourceInvalidApiDocument.append(invalidInfo); resourceInvalidApiDocument.append(""); } public void updateResourceInvalidInformation(String invalidInfo){ resourceInvalidApiDocument.append("
"); resourceInvalidApiDocument.append("" + invalidInfo + ""); resourceInvalidApiDocument.append(""); } public void addResourceDocInvalidInfo(String invalidInfo){ resourceDocument.append(docHeader); resourceDocument.append(""); resourceDocument.append(invalidInfo); resourceDocument.append(""); resourceDocument.append(docFooter); } public String getResourceDocument() { if(resourceInvalidApiDocument.length()>0){ return resourceDocument.toString() + resourceInvalidApiDocument.toString() + docFooter; } return resourceDocument.toString() +docFooter; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy