Skip to content

Commit b562db0

Browse files
committed
11.7.18 Release
1 parent a8e5293 commit b562db0

1 file changed

Lines changed: 54 additions & 44 deletions

File tree

netlib/OpenEdge/Web/DataObject/MappedOperation.cls

Lines changed: 54 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* *************************************************************************************************************************
2-
Copyright (c) 2016-2018, 2021 by Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
2+
Copyright (c) 2016-2018, 2021, 2023 by Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
33
************************************************************************************************************************** */
44
/*------------------------------------------------------------------------
55
File : MappedOperation
6-
Purpose :
7-
Syntax :
8-
Description :
6+
Purpose :
7+
Syntax :
8+
Description :
99
Author(s) : pjudge
1010
Created : Wed May 18 13:40:31 EDT 2016
11-
Notes :
11+
Notes :
1212
----------------------------------------------------------------------*/
1313
block-level on error undo, throw.
1414

@@ -34,67 +34,67 @@ using Progress.Lang.AppError.
3434
class OpenEdge.Web.DataObject.MappedOperation:
3535
// Use a variable since we need the value to be CASE-SENSITIVE
3636
define private variable mServiceUri as character case-sensitive no-undo.
37-
37+
3838
/* (key value) The relative URI for this operation. */
3939
define public property ServiceURI as character no-undo
4040
get():
4141
return mServiceUri.
4242
end get.
43-
43+
4444
/* (key value) The HTTP method for the operation */
4545
define public property Method as MethodEnum no-undo get. private set.
46-
46+
4747
/* (data value) The MIME type of the response */
4848
define public property ContentType as character no-undo get. private set.
49-
49+
5050
/* (optional) A collection of HTTP headers to set for this operation. */
5151
define public property Headers as HttpHeaderCollection no-undo
5252
get.
5353
private set.
54-
54+
5555
/* (data value) The HTTP status code to use for the response */
5656
define public property StatusCode as integer no-undo get. private set.
57-
57+
5858
/* (data value) The kind of operation: CLS, PROC, FILE, VOID */
5959
define public property TargetType as character no-undo get. private set.
60-
61-
/* (data value) The target name (class, procedure, filename) */
60+
61+
/* (data value) The target name (class, procedure, filename) */
6262
define public property TargetName as character no-undo get. private set.
63-
63+
6464
/* (data value) The expected ABL type of the target */
6565
define public property EntityType as class Progress.Lang.Class no-undo get. private set.
66-
66+
6767
/* (data value) For non-file operations, the function/procedure/method name */
6868
define public property TargetFunction as character no-undo get. private set.
69-
69+
7070
/* (Mandatory) The parameters for this operation. may be empty/0 */
7171
define public property Parameters as IList no-undo get. private set.
72-
72+
7373
/* (optional) The return-value definition */
7474
define public property ReturnValue as OperationParameter no-undo get. set.
75-
75+
7676
/* (optional) Options for the method call. */
7777
define public property Options as OperationOptions no-undo get. private set.
78-
78+
7979
/* (optional) A map of schema holders for the arguments (incl. return) for this operation */
8080
define public property Schemas as IStringKeyedMap no-undo get. private set.
81-
81+
8282
/* (optional) An easy/human-readable name for this operation */
8383
define public property Name as character no-undo get. set.
84-
84+
8585
/* (optional) A collection of HTTP cookies to set for this operation. */
8686
define public property Cookies as CookieCollection no-undo
8787
get.
8888
private set.
89-
90-
/* (optional) Access control list for this operation. Typically one or more ROLES that will be evaluated
89+
90+
/* (optional) Access control list for this operation. Typically one or more ROLES that will be evaluated
9191
against the current user. */
9292
define public property AccessControl as character extent no-undo
9393
get.
9494
set.
95-
95+
9696
/* Constructor
97-
97+
9898
@param character The service URI
9999
@param MethodEnum The HTTP method
100100
@param character The content-type to return
@@ -124,9 +124,9 @@ class OpenEdge.Web.DataObject.MappedOperation:
124124
piStatusCode,
125125
new List() ).
126126
end constructor.
127-
127+
128128
/* Constructor
129-
129+
130130
@param character The service URI
131131
@param MethodEnum The HTTP method
132132
@param character The content-type to return
@@ -154,21 +154,21 @@ class OpenEdge.Web.DataObject.MappedOperation:
154154
Assert:NotNull(pcTargetName, 'Target name').
155155
Assert:NotNull(poParams, 'Operation parameters').
156156
Assert:IsPositive(piStatusCode, 'Status code').
157-
157+
158158
if not OperationHandlerRegistry:Registry:Has(pTargetType) then
159159
undo, throw new AppError(substitute('Unsupported target type "&1" for operation "&3 &2"',
160160
pTargetType,
161161
pcServiceURI,
162-
string(poMethod) ),
162+
string(poMethod) ),
163163
0).
164-
164+
165165
// we don't validate the TargetFunction in any way because that is specific to the operation
166166
// handler and its operation.
167-
167+
168168
assign this-object:mServiceURI = '/':u + trim(pcServiceURI, '/':u)
169169
this-object:Method = poMethod
170170
this-object:ContentType = pcContentType
171-
this-object:TargetType = pTargetType
171+
this-object:TargetType = pTargetType
172172
this-object:TargetName = pcTargetName
173173
this-object:TargetFunction = pcTargetFunction
174174
this-object:StatusCode = piStatusCode
@@ -181,7 +181,7 @@ class OpenEdge.Web.DataObject.MappedOperation:
181181
assign this-object:Options = poOptions.
182182
else
183183
assign this-object:Options = new OperationOptions().
184-
184+
185185
// Set the target type. Default to PLO or IHandleHolder
186186
if OpenEdge.Core.String:IsNullOrEmpty(pEntityType) then
187187
case pTargetType:
@@ -194,23 +194,23 @@ class OpenEdge.Web.DataObject.MappedOperation:
194194
end case.
195195
else
196196
assign this-object:EntityType = Progress.Lang.Class:GetClass(pEntityType).
197-
end method.
198-
197+
end constructor.
198+
199199
method override public character ToString():
200200
define variable params as character no-undo.
201201
define variable delim as character no-undo.
202202
define variable iter as IIterator no-undo.
203-
203+
204204
assign iter = this-object:Parameters:Iterator()
205205
delim = '':u
206206
.
207207
do while iter:HasNext():
208208
assign params = params
209-
+ delim
209+
+ delim
210210
+ '[':u + iter:Next():ToString() + ']':u
211211
delim = ',':u.
212212
end.
213-
213+
214214
return substitute('&1_&2: &3 &4: ;target: &5 name:&6, type-of:&7':u,
215215
this-object:GetClass():TypeName,
216216
int64(this-object),
@@ -228,21 +228,31 @@ class OpenEdge.Web.DataObject.MappedOperation:
228228
params,
229229
this-object:Cookies:Size ).
230230
end method.
231-
231+
232232
/* Returns a schema handle for a named schema for this operation (only).
233-
233+
234234
@param character The schema name
235235
@return handle A schema handle. UNKNOWN if the schema cannot be found */
236236
method public handle GetSchema(input pSchemaName as character):
237237
define variable hSchema as handle no-undo.
238-
238+
239239
Assert:NotNull(pSchemaName, 'Schema name').
240-
240+
241241
// is there an operation schema already?
242242
if this-object:Schemas:ContainsKey(pSchemaName) then
243243
assign hSchema = cast(this-object:Schemas:Get(pSchemaName), IHandleHolder):Value.
244-
244+
245245
return hSchema.
246246
end method. // GetSchema()
247-
247+
248+
/* Returns TRUE if there is a named schema for this operation (only).
249+
250+
@param character The schema name
251+
@return logical TRUE if the schema exists for this operation, FALSE otherwise */
252+
method public logical HasSchema(input pSchemaName as character):
253+
Assert:NotNull(pSchemaName, 'Schema name').
254+
255+
return this-object:Schemas:ContainsKey(pSchemaName).
256+
end method.
257+
248258
end class.

0 commit comments

Comments
 (0)