Class JSonClient
- java.lang.Object
-
- coop.intergal.espresso.presutec.utils.JSonClient
-
public class JSonClient extends Object
A very simple, self-contained demo REST client that exercises an Espresso Logic API.
You will need the following jars:- httpclient-4.x.x.jar
- httpcore-4.x.x.jar
- commons-logging-1.1.1.jar
- jackson-core-2.x.x.jar
- jackson-databind-2.x.x.jar
- jackson-annotations-2.x.x.jar
- See Also:
- Using https
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringAPI_KEYprotected static StringMY_API_KEY
-
Constructor Summary
Constructors Constructor Description JSonClient()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.JsonNodedelete(com.fasterxml.jackson.databind.JsonNode object, String preConfParam)static com.fasterxml.jackson.databind.JsonNodedelete(String resource, String preConfParam)voidfillKeepJson(String resource, String filter, boolean useCache, String preConfParam)static com.fasterxml.jackson.databind.JsonNodeget(String url, String preConfParam)static com.fasterxml.jackson.databind.JsonNodeget(String resource, String filter, boolean useCache, String preConfParam)static com.fasterxml.jackson.databind.JsonNodeget(String resource, String filter, boolean useCache, String preConfParam, String pagesize)static StringgetBaseURL()static com.fasterxml.jackson.databind.JsonNodegetColumnsFromTable(String resourceName, String subResourceName, boolean cache, String preConfParam)static StringgetDataType(String resourceName, String field, String childName, boolean cache, String preConfParam)static StringgetDataTypeFromTable(String resourceName, String field, boolean cache, String preConfParam)static StringgetFKFromTable(String table, String childTableName, String preConfParam)static Hashtable<String,String>getHt()static StringgetIdentOfResource(String resourceName, boolean cache, String preConfParam)static Hashtable<String,com.fasterxml.jackson.databind.JsonNode>getParents()static Hashtable<String,Hashtable<String,com.fasterxml.jackson.databind.JsonNode>>getParentsResource()static StringgetPKTable(String table, String preConfParam)static Hashtable<String,Hashtable<String,String>>getResourceHtPK()static StringgetResourceTableName()StringgetResult()intgetRowCount()static InputStreamgetStream(String url, String preConfParam)static StringgetTableNameRoot()StringgetValueFromRow(String field, int rowNumber)StringgetValueFromRow(String node, String field, int rowNumber)StringgetValueFromRow(String node1, String node2, String field, int rowNumber)static voidkeepFKinHT(String resourceName, String subResourceName, boolean cache, String preConfParam)static voidkeepJoinConditionSubResources(com.fasterxml.jackson.databind.JsonNode resource)static voidmain(String[] args)static com.fasterxml.jackson.databind.JsonNodepost(String resource, com.fasterxml.jackson.databind.JsonNode object, String preConfParam)static com.fasterxml.jackson.databind.JsonNodeput(String resource, com.fasterxml.jackson.databind.JsonNode object, String preConfParam)static voidputParentsInCache(String resourceName, boolean cache, String preConfParam)static voidsetApiKeyHeader(String apiKey)static voidsetBaseURL(String baseURL)static voidsetResourceTableName(String resourceTableName)static voidsetTableNameRoot(String tableNameRoot)
-
-
-
Method Detail
-
get
public static com.fasterxml.jackson.databind.JsonNode get(String resource, String filter, boolean useCache, String preConfParam) throws Exception
- Throws:
Exception
-
get
public static com.fasterxml.jackson.databind.JsonNode get(String resource, String filter, boolean useCache, String preConfParam, String pagesize) throws Exception
- Throws:
Exception
-
getStream
public static InputStream getStream(String url, String preConfParam) throws Exception
- Throws:
Exception
-
getBaseURL
public static String getBaseURL()
-
get
public static com.fasterxml.jackson.databind.JsonNode get(String url, String preConfParam) throws Exception
- Throws:
Exception
-
put
public static com.fasterxml.jackson.databind.JsonNode put(String resource, com.fasterxml.jackson.databind.JsonNode object, String preConfParam) throws Exception
- Throws:
Exception
-
post
public static com.fasterxml.jackson.databind.JsonNode post(String resource, com.fasterxml.jackson.databind.JsonNode object, String preConfParam) throws Exception
- Throws:
Exception
-
delete
public static com.fasterxml.jackson.databind.JsonNode delete(com.fasterxml.jackson.databind.JsonNode object, String preConfParam) throws Exception- Throws:
Exception
-
delete
public static com.fasterxml.jackson.databind.JsonNode delete(String resource, String preConfParam) throws Exception
- Throws:
Exception
-
getFKFromTable
public static String getFKFromTable(String table, String childTableName, String preConfParam)
-
getDataType
public static String getDataType(String resourceName, String field, String childName, boolean cache, String preConfParam) throws Exception
- Throws:
Exception
-
getIdentOfResource
public static String getIdentOfResource(String resourceName, boolean cache, String preConfParam)
-
getDataTypeFromTable
public static String getDataTypeFromTable(String resourceName, String field, boolean cache, String preConfParam)
-
getColumnsFromTable
public static com.fasterxml.jackson.databind.JsonNode getColumnsFromTable(String resourceName, String subResourceName, boolean cache, String preConfParam)
-
keepFKinHT
public static void keepFKinHT(String resourceName, String subResourceName, boolean cache, String preConfParam)
-
keepJoinConditionSubResources
public static void keepJoinConditionSubResources(com.fasterxml.jackson.databind.JsonNode resource)
-
putParentsInCache
public static void putParentsInCache(String resourceName, boolean cache, String preConfParam)
-
getParentsResource
public static Hashtable<String,Hashtable<String,com.fasterxml.jackson.databind.JsonNode>> getParentsResource()
-
getTableNameRoot
public static String getTableNameRoot()
-
setTableNameRoot
public static void setTableNameRoot(String tableNameRoot)
-
fillKeepJson
public void fillKeepJson(String resource, String filter, boolean useCache, String preConfParam)
-
getRowCount
public int getRowCount()
-
getValueFromRow
public String getValueFromRow(String node1, String node2, String field, int rowNumber)
-
getResult
public String getResult()
-
setApiKeyHeader
public static void setApiKeyHeader(String apiKey)
-
setBaseURL
public static void setBaseURL(String baseURL)
-
getResourceTableName
public static String getResourceTableName()
-
setResourceTableName
public static void setResourceTableName(String resourceTableName)
-
-