Namespace: Consultingwerk.OERA.RestResource
Class 
RestEntitiesWebHandler Copy to Clipboard
Parent classes:
Inherits: Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler

File:RestEntitiesWebHandler
Purpose:Web handler to access RESTful Business Entities
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Tue Jul 25 14:57:44 CEST 2017
Notes:Date Values in Query strings are expected to be retrieved
a DATE STRINGS in the date-format of the AppServer, e.g.
http://localhost:8820/web/Entities/Customers/1/Orders?OrderDate=18/11/2008
when filtering based on ISO dates is demanded, like this
http://localhost:8820/web/Entities/Customers/1/Orders?OrderDate=2008-11-18
please set the following entry in .restapplicationsettings
"RestfulEntitiesFilterIsoDates": "true",
/* Mike Fechner, Consultingwerk Ltd. 13.09.2017
Preprocessor variables for SmartComponentLibrary, WinKit and SmartFramework
based on Consultingwerk/packages.i now



Top Method Summary
Options Name Purpose
# AddBufferFields (handle, JsonObject, IRestAddress, character) Adds the Buffer Fields to the given JSON Object
# AddIdField (JsonObject, handle, character) Adds the id property
# AddResponseDataset (JsonObject, character, handle[]) Adds a dataset to the JSON response
# Consultingwerk.OERA.RestResource.BufferFieldSubstitue AddressToSubstitute (character) Parses an address pattern and returns the SUBSTITUTE() parameters
# AssignParameterPropertiesFromQueryString (Object, IWebRequest) Assigns properties of the parameter object from the QUERY_STRING
# AssignParameterPropertiesFromRequestEntity (Object, Object) Assigns properties of the parameter object from the request payload
# AssignPropertyValue (Object, Property, character) Assigns a property value form a string value
# Progress.Json.ObjectModel.JsonConstruct BuildCollectionResponse (handle, IWebRequest, IRestRequest, character, character) Returns the response JsonArray for a collection record
# Progress.Json.ObjectModel.JsonObject BuildRecordResponse (handle, IWebRequest, IRestRequest) Returns the response JsonObject for a single record
# CheckFieldAuthorization (handle, JsonObject) Checks for field authorization during update
# Consultingwerk.OERA.IFetchDataRequest FetchDataRequestFromRestRequest (IRestRequest, IWebRequest, logical, handle) Builds an FetchDataRequest from the current Rest Request
# Consultingwerk.OERA.IFetchDataRequest FetchDataRequestFromRestRequest (IRestRequest, IWebRequest, logical, handle, character, character) Builds an FetchDataRequest from the current Rest Request
# CHARACTER FilterString (character, character, handle) Builds a query string based on the URI Query String
# INTEGER HandleDelete (IWebRequest) Handles the DELETE request
# HandleError (Error, IHttpResponse) Handels an error. The error is written into the logfile and returned to the client in the body.
Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
# INTEGER HandleGet (IWebRequest) Handles the GET request
# INTEGER HandleNotAllowedMethod (IWebRequest) Handler for unsupported methods. The request being serviced and an optional status code is returned. A zero or null value means this method will deal with all errors.
Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
# INTEGER HandleNotImplemented (IWebRequest) Handler for unknown methods. The request being serviced and an optional status code is returned. A zero or null value means this method will deal with all errors.
Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
# INTEGER HandlePatch (IWebRequest) Handles the PATCH request
# INTEGER HandlePost (IWebRequest) Handles the POST request
# INTEGER HandlePut (IWebRequest) Handles the PUT request
# Consultingwerk.Framework.Collections.CharacterDictionary InitalizeRestrictedFields (character) Queries the Field Authorization Provider and returns a CharacterDictionary of restricted fields (Hidden)
# Progress.Json.ObjectModel.JsonConstruct InitializeJsonParameterObject (IRestRequest, IWebRequest) Initializes the JSON Parameter Object instance
# Progress.Lang.Object InitializeParameterObject (IRestRequest, IWebRequest, Object) Creates and initializes the Parameter Object instance
# InitializeRequestArguments (IRestRequest, IWebRequest, Method, handle, handle, handle, handle, handle, Object) Initializes the JSON Parameter Object instance
# Progress.Lang.Object InvokeMethod (IRestRequest, IWebRequest) Invokes a method of a Business Task or Business Entity
# LogRequestDetail (IWebRequest) Logs details about the current web handler request
Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
# LogRequestEnd (IWebRequest, IHttpResponse) Logs details about the end of current web handler request
Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
+ ProcessHttpResponse (IHttpResponse, IHttpRequest, IRestRequest) Tests if the invoked service supports the HTTP response processing and invokes the UpdateHttpResponse method
# ProcessLinks (JsonObject, handle, IWebRequest, IRestRequest) Processes the Links
# ProcessRelations (JsonObject, handle, IRestRequest, IWebRequest) Processes the child relations of the given record
# CHARACTER ProcessSortString (character, character) Processes the Sort String
# CHARACTER ResourceUri (handle, IWebRequest, character, IRestRequest) Returns a Resource URI for the given record
# CHARACTER UrlPrefix (IWebRequest) Returns the UrlPrefix (hostname, port and /web/Entities)
# LOGICAL VerifyMethodSignature (Parameter[]) Verifies if the method signature is compatible to the Service Interface
# WriteResponse (IHttpResponse) Writes the HttpResponse to the stream
Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler

Top Constructor Summary
Options Name Purpose
+ RestEntitiesWebHandler () Constructor for the RestEntitiesWebHandler class


Method Detail
Top

PROTECTED AddBufferFields (handle, JsonObject, IRestAddress, character)

Purpose: Adds the Buffer Fields to the given JSON Object
Notes:

Parameters:
phBuffer HANDLE
The handle of the Buffer
poRecord Progress.Json.ObjectModel.JsonObject
The JsonObject to add the fields to
poRestAddress Consultingwerk.OERA.RestResource.IRestAddress
The IRestAddress instance describing the format of the current record
pcFields CHARACTER
The fields as provided by the consumer
Top

PROTECTED AddIdField (JsonObject, handle, character)

Purpose: Adds the id property
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The JsonObject to add the id property to
phBuffer HANDLE
The handle of the buffer to obtain values from
pcFields CHARACTER
The list of fields to use for the id property value
Top

PROTECTED AddResponseDataset (JsonObject, character, handle[])

Purpose: Adds a dataset to the JSON response
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The response JSON to add the dataset to
pcDatasetName CHARACTER
The name of the Dataset to add to the response
phDatasets HANDLE
The handles of the Datasets
Top

PROTECTED Consultingwerk.OERA.RestResource.BufferFieldSubstitue AddressToSubstitute (character)

Purpose: Parses an address pattern and returns the
SUBSTITUTE() parameters
Notes:

Parameters:
pcAddress CHARACTER
The URI address pattern
Returns Consultingwerk.OERA.RestResource.BufferFieldSubstitue
The BufferFieldSubstitute instance
Top

PROTECTED AssignParameterPropertiesFromQueryString (Object, IWebRequest)

Purpose: Assigns properties of the parameter object from the QUERY_STRING
Notes:

Parameters:
poParameter Progress.Lang.Object
The reference to the instance of the parameter object
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance
Top

PROTECTED AssignParameterPropertiesFromRequestEntity (Object, Object)

Purpose: Assigns properties of the parameter object from the request payload
Notes:

Parameters:
poParameter Progress.Lang.Object
The reference to the instance of the parameter object
poEntity Progress.Lang.Object
The Request Entity
Top

PROTECTED AssignPropertyValue (Object, Property, character)

Purpose: Assigns a property value form a string value
Notes:

Parameters:
poObject Progress.Lang.Object
The reference to the object instance who's property should be assigned
poProperty Progress.Reflect.Property
The reference to the Progress.Reflect.Property instance
pcValue CHARACTER
The character value
Top

PROTECTED Progress.Json.ObjectModel.JsonConstruct BuildCollectionResponse (handle, IWebRequest, IRestRequest, character, character)

Purpose: Returns the response JsonArray for a collection record
Notes:

Parameters:
phDataset HANDLE
The dataset that contains the response records
poRequest OpenEdge.Web.IWebRequest
The IWebRequest
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The REST Request instance representing the current request
pcQuerySort CHARACTER
The query sort
pcFields CHARACTER
The fields parameter provided by the consumer
Returns Progress.Json.ObjectModel.JsonConstruct
The JSON Response entity
Top

PROTECTED Progress.Json.ObjectModel.JsonObject BuildRecordResponse (handle, IWebRequest, IRestRequest)

Purpose: Returns the response JsonObject for a single record
Notes:

Parameters:
phDataset HANDLE
The dataset that contains the response records
poRequest OpenEdge.Web.IWebRequest
The IWebRequest
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The REST Request instance representing the current request
Returns Progress.Json.ObjectModel.JsonObject
The JSON Response entity
Top

PROTECTED CheckFieldAuthorization (handle, JsonObject)

Purpose: Checks for field authorization during update
Notes:

Parameters:
phBuffer HANDLE
Then handle of the buffer
poJson Progress.Json.ObjectModel.JsonObject
The JSON Entity
Top

PROTECTED Consultingwerk.OERA.IFetchDataRequest FetchDataRequestFromRestRequest (IRestRequest, IWebRequest, logical, handle)

Purpose: Builds an FetchDataRequest from the current Rest Request
Notes:

Parameters:
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance for the current request
poWebRequest OpenEdge.Web.IWebRequest
The IWebRequest instance of the current request
plAddQueryString LOGICAL
Add the ?QueryString values to the query
phBuffer HANDLE
The handle of the query buffer
Returns Consultingwerk.OERA.IFetchDataRequest
The IFetchDataRequest instance
Top

PROTECTED Consultingwerk.OERA.IFetchDataRequest FetchDataRequestFromRestRequest (IRestRequest, IWebRequest, logical, handle, character, character)

Purpose: Builds an FetchDataRequest from the current Rest Request
Notes:

Parameters:
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance for the current request
poWebRequest OpenEdge.Web.IWebRequest
The IWebRequest instance of the current request
plAddQueryString LOGICAL
Add the ?QueryString values to the query
phBuffer HANDLE
The handle of the query buffer
pcQuerySort CHARACTER
The query sort string (OUTPUT)
pcFields CHARACTER
The consumer provided field list (OUTPUT)
Returns Consultingwerk.OERA.IFetchDataRequest
The IFetchDataRequest instance
Top

PROTECTED CHARACTER FilterString (character, character, handle)

Purpose: Builds a query string based on the URI Query String
Notes:

Parameters:
pcQueryString CHARACTER
The URI Query String
pcTable CHARACTER
The name of the table
phBuffer HANDLE
The handle of the buffer to determine field names based on serializable-name
Returns CHARACTER
The query string based on the URI Query String
Top

PROTECTED INTEGER HandleDelete (IWebRequest)

Purpose: Handles the DELETE request
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The web request
Returns INTEGER
The http status code
Top

PROTECTED HandleError (Error, IHttpResponse)

Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
Purpose: Handels an error. The error is written into the logfile and returned
to the client in the body.
Notes:

Parameters:
poError Progress.Lang.Error
An instance of a Progress.Lang.Error
poResponse OpenEdge.Net.HTTP.IHttpResponse
The Response instance returned to the client
Top

PROTECTED INTEGER HandleGet (IWebRequest)

Purpose: Handles the GET request
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The web request
Returns INTEGER
The http status code
Top

PROTECTED INTEGER HandleNotAllowedMethod (IWebRequest)

Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
Purpose: Handler for unsupported methods. The request being serviced and
an optional status code is returned. A zero or null value means
this method will deal with all errors.
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance representing the call
Returns INTEGER
StatusCode of the response sent to the client
Top

PROTECTED INTEGER HandleNotImplemented (IWebRequest)

Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
Purpose: Handler for unknown methods. The request being serviced and an
optional status code is returned. A zero or null value means
this method will deal with all errors.
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance representing the call
Returns INTEGER
StatusCode of the response sent to the client
Top

PROTECTED INTEGER HandlePatch (IWebRequest)

Purpose: Handles the PATCH request
Notes: Updates the provided properties of the given resource

Parameters:
poRequest OpenEdge.Web.IWebRequest
The web request
Returns INTEGER
The http status code
Top

PROTECTED INTEGER HandlePost (IWebRequest)

Purpose: Handles the POST request
Notes: Creates a new record in a collection

Parameters:
poRequest OpenEdge.Web.IWebRequest
The web request
Returns INTEGER
The http status code
Top

PROTECTED INTEGER HandlePut (IWebRequest)

Purpose: Handles the PUT request
Notes: Update a single resource

Parameters:
poRequest OpenEdge.Web.IWebRequest
The web request
Returns INTEGER
The http status code
Top

PROTECTED Consultingwerk.Framework.Collections.CharacterDictionary InitalizeRestrictedFields (character)

Purpose: Queries the Field Authorization Provider and returns
a CharacterDictionary of restricted fields (Hidden)
Notes:

Parameters:
pcTables CHARACTER
The comma delimited list of tables
Returns Consultingwerk.Framework.Collections.CharacterDictionary
The CharacterDictionary of restricted fields
Top

PROTECTED Progress.Json.ObjectModel.JsonConstruct InitializeJsonParameterObject (IRestRequest, IWebRequest)

Purpose: Initializes the JSON Parameter Object instance
Notes: Supports JsonObject, JsonArray and JsonContruct

Parameters:
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance describing the method to be invoked
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance describing the client request
Returns Progress.Json.ObjectModel.JsonConstruct
The parameter object instance
Top

PROTECTED Progress.Lang.Object InitializeParameterObject (IRestRequest, IWebRequest, Object)

Purpose: Creates and initializes the Parameter Object instance
Notes:

Parameters:
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance describing the method to be invoked
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instnace describing the client request
poEntity Progress.Lang.Object
The Request Entity or "parameter" property
Returns Progress.Lang.Object
The parameter object instance
Top

PROTECTED InitializeRequestArguments (IRestRequest, IWebRequest, Method, handle, handle, handle, handle, handle, Object)

Purpose: Initializes the JSON Parameter Object instance
Notes:

Parameters:
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance describing the method to be invoked
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instnace describing the client request
poMethod Progress.Reflect.Method
The Progress.Reflect.Method for the method to be called
phDataset1 HANDLE
OUTPUT The handle of the first ProDataset
phDataset2 HANDLE
OUTPUT The handle of the second ProDataset
phDataset3 HANDLE
OUTPUT The handle of the third ProDataset
phDataset4 HANDLE
OUTPUT The handle of the fourth ProDataset
phDataset5 HANDLE
OUTPUT The handle of the fifth ProDataset
poParameter Progress.Lang.Object
OUTPUT The parameter object instance
Top

PROTECTED Progress.Lang.Object InvokeMethod (IRestRequest, IWebRequest)

Purpose: Invokes a method of a Business Task or Business Entity
Notes:

Parameters:
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance describing the method to be invoked
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instnace describing the client request
Returns Progress.Lang.Object
The response entity
Top

PROTECTED LogRequestDetail (IWebRequest)

Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
Purpose: Logs details about the current web handler request
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance representing the call
Top

PROTECTED LogRequestEnd (IWebRequest, IHttpResponse)

Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
Purpose: Logs details about the end of current web handler request
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance representing the call
poResponse OpenEdge.Net.HTTP.IHttpResponse
The http reponse generated
Top

PUBLIC ProcessHttpResponse (IHttpResponse, IHttpRequest, IRestRequest)

Purpose: Tests if the invoked service supports the HTTP response processing
and invokes the UpdateHttpResponse method
Notes:

Parameters:
poResponse OpenEdge.Net.HTTP.IHttpResponse
The IHttpResponse to be returned to the resource requester
poRequest OpenEdge.Net.HTTP.IHttpRequest
The IHttpRequest issues by the consumer
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest (processed by the RestEntitiesWebHandler) representing the current request
Top

PROTECTED ProcessLinks (JsonObject, handle, IWebRequest, IRestRequest)

Purpose: Processes the Links
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The JsonObject to add the links to
phBuffer HANDLE
The parent record buffer
poRequest OpenEdge.Web.IWebRequest
The IWebRequest
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The REST Request instance representing the current request
Top

PROTECTED ProcessRelations (JsonObject, handle, IRestRequest, IWebRequest)

Purpose: Processes the child relations of the given record
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The Json of the parent record
phBuffer HANDLE
The handle of the parent record
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The REST Request instance representing the current request
poRequest OpenEdge.Web.IWebRequest
The IWebRequest instance describing the current web request
Top

PROTECTED CHARACTER ProcessSortString (character, character)

Purpose: Processes the Sort String
Notes:

Parameters:
pcSort CHARACTER
The sort string, e.g. +City,-Name
pcTableName CHARACTER
The name of the table
Returns CHARACTER
The resulting query sort expression
Top

PROTECTED CHARACTER ResourceUri (handle, IWebRequest, character, IRestRequest)

Purpose: Returns a Resource URI for the given record
Notes: A resource URI is only valid, when all data-items are > ""

Parameters:
phBuffer HANDLE
The handle of the buffer that contains the data for this resource
poRequest OpenEdge.Web.IWebRequest
The web request
pcAddress CHARACTER
The address string
poRestRequest Consultingwerk.OERA.RestResource.IRestRequest
The IRestRequest instance representing the
Returns CHARACTER
The resource URI
Top

PROTECTED CHARACTER UrlPrefix (IWebRequest)

Purpose: Returns the UrlPrefix (hostname, port and /web/Entities)
Notes:

Parameters:
poRequest OpenEdge.Web.IWebRequest
The web request
Returns CHARACTER
The Url Prefix
Top

PROTECTED LOGICAL VerifyMethodSignature (Parameter[])

Purpose: Verifies if the method signature is compatible to the Service Interface
Notes:

Parameters:
poParameters Progress.Reflect.Parameter
The method's Parameter list
Returns LOGICAL
Logical value indicating if the method signature is supported by the Service Interface
Top

PROTECTED WriteResponse (IHttpResponse)

Inherited from Consultingwerk.OERA.JsdoGenericService.WebHandler.SmartWebHandler
Purpose: Writes the HttpResponse to the stream
Notes: Does handle OpenEdge.Core.String seperatly due to (PSC00348040)

Parameters:
poResponse OpenEdge.Net.HTTP.IHttpResponse
The Response instance to write


Constructor Detail
Top

PUBLIC RestEntitiesWebHandler ()

Purpose: Constructor for the RestEntitiesWebHandler class
Notes:



©2006-2020 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       04.02.2020 23:14:52