public class RestClassV8 extends java.lang.Object implements RestPluginProcess, SwaggerListVariables, SwaggerFullList, RestPluginConvertResult, SwaggerResponses
http://en.wikipedia.org/wiki/Representational_state_transfer
Modifier and Type | Class and Description |
---|---|
protected static class |
RestClassV8.FieldInfo |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HEADER_MIN_CACHE_PERIOD |
static java.lang.String |
PARAMETER_CURSOR_ID |
static java.lang.String |
PARAMETER_FIELDS |
static java.lang.String |
PARAMETER_KEY |
static java.lang.String |
PARAMETER_QUERY |
static java.lang.String |
PARAMETER_TOUCH |
static java.lang.String |
PARAMETER_VALUES |
Constructor and Description |
---|
RestClassV8() |
Modifier and Type | Method and Description |
---|---|
RestServerResponse |
convertResult(RestDefinition rd,
WebClient client,
ContentType type,
java.lang.Object value)
Convert the result
|
void |
describeResponse(WebClient client,
RestDefinition rd,
Method method,
JSONObject responses,
JSONObject operationObj,
java.lang.String restPath,
JSONObject definitions)
describe the response format.
|
protected DBClassConcrete |
findClass(RestDefinition rd,
WebClient client) |
protected RestDefinition |
getClassRD(RestDefinition restDefinition) |
protected java.lang.String |
getRawPath(java.lang.String param,
RestDefinition rd) |
DBResult<RestDefinitionVariable> |
listSwaggerVariables(Login login,
RestDefinition rd,
Method method,
int mandatoryPathVariableDepth) |
protected java.lang.String |
makeCachePeriod(WebClient client,
RestDefinition rd) |
protected java.lang.String[] |
makeDefaultFields(WebClient client,
RestDefinition rd,
DBClassConcrete dbClass) |
protected java.lang.String[] |
makeFieldList(WebClient client,
RestDefinition rd,
DBClassConcrete dbClass) |
protected java.lang.String |
makeHref(RestDefinition rd,
DBClassConcrete dbClass) |
protected static java.lang.String |
makeJsonKey(java.lang.String key) |
protected java.lang.String |
makeKeyParameter(WebClient client,
RestDefinition rd) |
protected java.lang.String |
makePath(RestDefinition rd,
DBClassConcrete dbClass) |
protected java.lang.String |
makeQuery(WebClient client,
RestDefinition rd) |
static java.lang.Object |
makeValue(DataSource ds,
DBField field,
java.lang.Object value)
http://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
|
protected static java.util.List<RestClassV8.FieldInfo> |
parseFields(DBClass dbClass,
java.lang.String[] fields) |
static java.util.HashMap<java.lang.String,java.lang.String> |
parseValues(java.lang.String values) |
java.lang.Object |
restCreate(WebClient client,
RestDefinition rd,
MutableDataSource mds)
HTTP POST calls the the Create ReST service.
|
java.lang.Object |
restDelete(WebClient client,
RestDefinition rd,
MutableDataSource mds)
HTTP DELETE calls the the Delete ReST service.
|
java.lang.Object |
restRetrieve(WebClient client,
RestDefinition rd,
ReadOnlyDataSource rds)
HTTP GET calls the the Retrieval ReST service.
|
java.lang.Object |
restUpdate(WebClient client,
RestDefinition rd,
MutableDataSource mds)
HTTP PUT calls the the Update ReST service.
|
java.lang.String[] |
swaggerFullList(Login login,
RestDefinition rd,
Method method,
RestDefinitionVariable v,
java.lang.String[] list) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createArrayProperty, createBooleanProperty, createIntegerProperty, createNumberProperty, createObjectProperty, createStringProperty, getStandardProperty
public static final java.lang.String PARAMETER_KEY
public static final java.lang.String PARAMETER_FIELDS
public static final java.lang.String PARAMETER_VALUES
public static final java.lang.String PARAMETER_QUERY
public static final java.lang.String PARAMETER_CURSOR_ID
public static final java.lang.String HEADER_MIN_CACHE_PERIOD
public static final java.lang.String PARAMETER_TOUCH
@Nonnull @CheckReturnValue protected DBClassConcrete findClass(@Nonnull RestDefinition rd, @Nullable WebClient client) throws ExceptionResponse
ExceptionResponse
@CheckReturnValue @Nonnull protected RestDefinition getClassRD(@Nonnull RestDefinition restDefinition) throws java.lang.Exception
java.lang.Exception
public java.lang.Object restRetrieve(@Nullable WebClient client, @Nullable RestDefinition rd, @Nonnull ReadOnlyDataSource rds) throws java.lang.Exception
RestPluginProcess
restRetrieve
in interface RestPluginProcess
client
- the client. Null means check only of opsrd
- the definitionrds
- the data source to usejava.lang.UnsupportedOperationException
- if this method is NOT supported.java.lang.Exception
- an error has occurred.@CheckReturnValue @Nonnull protected java.lang.String[] makeDefaultFields(@Nullable WebClient client, @Nonnull RestDefinition rd, @Nonnull DBClassConcrete dbClass) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue @Nonnull protected java.lang.String[] makeFieldList(@Nullable WebClient client, @Nonnull RestDefinition rd, @Nonnull DBClassConcrete dbClass) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue @Nonnull protected java.lang.String makeKeyParameter(@Nullable WebClient client, @Nonnull RestDefinition rd) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue @Nonnull protected java.lang.String makeCachePeriod(@Nullable WebClient client, @Nonnull RestDefinition rd) throws java.lang.Exception
java.lang.Exception
@CheckReturnValue @Nonnull protected java.lang.String makePath(@Nonnull RestDefinition rd, @Nonnull DBClassConcrete dbClass)
@CheckReturnValue @Nonnull protected java.lang.String makeHref(@Nonnull RestDefinition rd, @Nonnull DBClassConcrete dbClass)
@CheckReturnValue @Nonnull protected java.lang.String makeQuery(@Nullable WebClient client, @Nonnull RestDefinition rd) throws java.lang.Exception
java.lang.Exception
@Nonnull @CheckReturnValue protected static java.util.List<RestClassV8.FieldInfo> parseFields(@Nonnull DBClass dbClass, @Nonnull java.lang.String[] fields) throws InvalidPathException
InvalidPathException
protected static java.lang.String makeJsonKey(java.lang.String key)
@CheckReturnValue @Nullable public static java.lang.Object makeValue(@Nonnull DataSource ds, @Nonnull DBField field, @Nullable java.lang.Object value) throws java.lang.Exception
ds
- The datasourcefield
- The fieldvalue
- the valuejava.lang.Exception
- a serious problem.@Nonnull @CheckReturnValue public java.lang.Object restCreate(@Nullable WebClient client, @Nullable RestDefinition rd, @Nonnull MutableDataSource mds) throws java.lang.Exception
RestPluginProcess
restCreate
in interface RestPluginProcess
client
- the client. Null means check only of opsrd
- the definitionmds
- the data source to usejava.lang.UnsupportedOperationException
- if this method is NOT supported.ExceptionResponse
- an error has occurred.java.lang.Exception
protected java.lang.String getRawPath(@Nonnull java.lang.String param, @Nonnull RestDefinition rd)
@Nonnull @CheckReturnValue public static java.util.HashMap<java.lang.String,java.lang.String> parseValues(@Nullable java.lang.String values) throws java.lang.Exception
java.lang.Exception
@Nonnull @CheckReturnValue public java.lang.Object restUpdate(@Nullable WebClient client, @Nullable RestDefinition rd, @Nonnull MutableDataSource mds) throws java.lang.Exception
RestPluginProcess
restUpdate
in interface RestPluginProcess
client
- the client. Null means check only of opsrd
- the definitionmds
- the data source to usejava.lang.UnsupportedOperationException
- if this method is NOT supported.ExceptionResponse
- an error has occurred.java.lang.Exception
@Nonnull @CheckReturnValue public java.lang.Object restDelete(@Nullable WebClient client, @Nullable RestDefinition rd, @Nonnull MutableDataSource mds) throws java.lang.Exception
RestPluginProcess
restDelete
in interface RestPluginProcess
client
- the client. Null means check only of opsrd
- the definitionmds
- the data source to use.java.lang.UnsupportedOperationException
- if this method is NOT supported.ExceptionResponse
- an error has occurred.java.lang.Exception
@Nonnull @CheckReturnValue public DBResult<RestDefinitionVariable> listSwaggerVariables(@Nonnull Login login, @Nonnull RestDefinition rd, @Nonnull Method method, int mandatoryPathVariableDepth) throws java.lang.Exception
listSwaggerVariables
in interface SwaggerListVariables
java.lang.Exception
@Nonnull @CheckReturnValue public java.lang.String[] swaggerFullList(@Nonnull Login login, @Nonnull RestDefinition rd, @Nonnull Method method, @Nonnull RestDefinitionVariable v, @Nonnull java.lang.String[] list) throws java.lang.Exception
swaggerFullList
in interface SwaggerFullList
java.lang.Exception
@Nonnull @CheckReturnValue public RestServerResponse convertResult(RestDefinition rd, WebClient client, ContentType type, java.lang.Object value) throws java.lang.Exception
RestPluginConvertResult
convertResult
in interface RestPluginConvertResult
rd
- the definitionclient
- the clienttype
- the target typevalue
- the value to be converted.java.lang.Exception
- a serious problem.public void describeResponse(WebClient client, RestDefinition rd, Method method, JSONObject responses, JSONObject operationObj, java.lang.String restPath, JSONObject definitions) throws java.lang.Exception
SwaggerResponses
describe the response format. Check https://swagger.io/docs/specification/describing-responses/ for details
sample:
{
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/class_v8_GET"
}
},
"404": {
"description": "Not found"
}
}
describeResponse
in interface SwaggerResponses
client
- web clientrd
- rest definitionmethod
- methodresponses
- JSONObject that holds the responsesoperationObj
- the operation json for this service, such as GET /v8/class/Person/{_key} and GET /v8/class/Person are two different operation jsonrestPath
- rest path such as /v8/class/{className}/{_key}definitions
- $ref definition JSONObjectjava.lang.Exception
- a serious problem.stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.