public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static HelpBean |
createHelpContentsForStockDataEndpoint() |
static HelpBean |
createHelpContentsForStocksEndpoint() |
static String |
generateCsvContents(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockBean> stockBeans)
Generates the CSV resources for the given collection of StockBean instances
|
static String |
generateCsvTimeseries(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockData> stockDataCollection)
Generates the CSV resources for the given collection of StockData instances
|
static String |
generateHtmlContents(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockBean> stockBeans,
Collection<org.apache.commons.lang3.tuple.Pair<String,String>> parameters)
Generates an HTML page with the given StockBeans.
|
static String |
generateHtmlContents(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockData> stockData,
String stockUUID,
Collection<org.apache.commons.lang3.tuple.Pair<String,String>> parameters)
Generates an HTML page with the given StockData that are associated to the stock with the given UUID.
|
static String |
generateN3Contens(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockBean> stockBeans)
Generates the N3 serialization of the given StockBean collection
|
static String |
generateN3Timeseries(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockData> stockDataCollection)
Generates the N3 serialization of the given StockData collection
|
static String |
generateRandomUrn()
Generates a random URN, using a UUID (e.g.
|
static ResponseFormatType |
getResponseFormatType(String responseParameter,
String acceptHeader)
Identifies which is the response format type.
|
static String |
normalizeParameter(String originalParameter)
Normalizes the give parameter by removing special characters.
|
static Collection<String> |
normalizeTimeSeries(String originalParameter)
Normalizes timeseries parameter values, so that their labels can be found in the Knowledge Base.
|
static ErrorBean |
validateDatabaseSource(String databaseSourceParam)
Validates the given database source.
|
static ErrorBean |
validateQueryParameters(Collection<String> expectedParameters,
Collection<String> receivedParameters)
Validates that the set containing the parameters belongs to the set of the expected ones
|
static ErrorBean |
validateTimeseriesTypes(String timeseriesTypesConact)
Validates the given timeseries types (given as a comma-separated string).
|
public static ErrorBean validateQueryParameters(Collection<String> expectedParameters, Collection<String> receivedParameters)
expectedParameters - The set with the expected parametersreceivedParameters - the set with the given parameterspublic static ErrorBean validateTimeseriesTypes(String timeseriesTypesConact)
timeseriesTypesConact - the comma-separated string with the timeseries typespublic static ErrorBean validateDatabaseSource(String databaseSourceParam)
databaseSourceParam - the value of the database source that was given as inputpublic static String normalizeParameter(String originalParameter)
originalParameter - the original parameter that will be normalizedpublic static Collection<String> normalizeTimeSeries(String originalParameter)
originalParameter - the original timeseries parameter values stringpublic static HelpBean createHelpContentsForStocksEndpoint()
public static HelpBean createHelpContentsForStockDataEndpoint()
public static String generateHtmlContents(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockBean> stockBeans, Collection<org.apache.commons.lang3.tuple.Pair<String,String>> parameters)
stockBeans - the collection of StockBeansparameters - the given parameters in the form of label - parameter valuepublic static String generateHtmlContents(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockData> stockData, String stockUUID, Collection<org.apache.commons.lang3.tuple.Pair<String,String>> parameters)
stockUUID - the UUID of the stock that contain the given stockDatastockData - the collection of StockDataparameters - the given parameters in the form of label - parameter valuepublic static String generateCsvContents(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockBean> stockBeans)
stockBeans - the collection of StockBean instancespublic static String generateCsvTimeseries(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockData> stockDataCollection)
stockDataCollection - the collection of StockData instancespublic static String generateN3Contens(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockBean> stockBeans)
stockBeans - a collection of StockBean instancespublic static String generateN3Timeseries(Collection<gr.forth.ics.isl.grsfservicescore.model.beans.StockData> stockDataCollection)
stockDataCollection - a collection of StockData instancespublic static ResponseFormatType getResponseFormatType(String responseParameter, String acceptHeader)
responseParameter - the responseFormatType as expressed from the user in the parameter list (i.e. json, xml, html)acceptHeader - the mime type of response as defined in the accept header of the requestpublic static String generateRandomUrn()
Copyright © 2018 Institute of Computer Science - FORTH-ICS. All rights reserved.