3821c.4384j.patch
rules/include/common-progress.rules 2021-04-23 12:06:35 +0000 | ||
---|---|---|
10068 | 10068 |
<rule>ovrdNames.put("net.http.filter.ifilterevents", "IFilterEvents")</rule> |
10069 | 10069 |
<rule>ovrdNames.put("reflect.constructor", "LegacyConstructor")</rule> |
10070 | 10070 |
<rule>ovrdNames.put("reflect.method", "Legacy4GLMethod")</rule> |
10071 |
<rule>ovrdNames.put("logging.isupportlogging", "ISupportLogging")</rule> |
|
10072 |
<rule>ovrdNames.put("web.webrequest", "RemoteWebRequest")</rule> |
|
10071 | 10073 |
|
10072 | 10074 |
</function> |
10073 | 10075 |
|
src/com/goldencode/p2j/oo/core/ByteBucket.java 2021-03-25 08:48:03 +0000 | ||
---|---|---|
16 | 16 |
** 007 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
17 | 17 |
** signature. |
18 | 18 |
** ME 20210310 Use object variables defined out of block for methods that returns objects. |
19 |
** ME 20210325 Move assert inside block else initInput returns an invalid `object`. |
|
19 | 20 |
*/ |
20 | 21 | |
21 | 22 |
/* |
... | ... | |
924 | 925 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL) |
925 | 926 |
public void putString(final object<? extends LegacyString> _data) |
926 | 927 |
{ |
927 |
Assert.notNull(_data, new character("String data")); |
|
928 | 928 |
object<? extends LegacyString> data = TypeFactory.initInput(_data); |
929 | 929 | |
930 | 930 |
internalProcedure(this, "PutString", new Block((Body) () -> { |
931 |
Assert.notNull(data, new character("String data")); |
|
932 |
|
|
931 | 933 |
putString(data.ref().getValue(), new longchar(data.ref().getEncoding())); |
932 | 934 |
})); |
933 | 935 |
} |
src/com/goldencode/p2j/oo/core/collections/LegacyCollection.java 2021-03-25 06:52:49 +0000 | ||
---|---|---|
10 | 10 |
** |
11 | 11 |
** 003 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
12 | 12 |
** signature. |
13 |
** 004 ME 20210325 Decrement object reference when removed from collection. |
|
13 | 14 |
*/ |
14 | 15 | |
15 | 16 |
/* |
... | ... | |
342 | 343 | |
343 | 344 |
return function(this, "Remove", logical.class, new Block((Body) () -> { |
344 | 345 |
object<? extends _BaseObject_> match = _find(p1); |
346 |
if (match._isValid()) |
|
347 |
{ |
|
348 |
ObjectOps.decrement(match.ref()); |
|
349 |
} |
|
345 | 350 |
|
346 | 351 |
returnNormal(match._isValid() && objects.remove(match)); |
347 | 352 |
})); |
... | ... | |
360 | 365 |
{ |
361 | 366 |
LegacyCollection other = ObjectOps.cast(p1, LegacyCollection.class).ref(); |
362 | 367 |
|
363 |
List<?> matches = other.objects.stream().map(o -> _find(o)).filter(o -> o._isValid()).collect(Collectors.toList()); |
|
368 |
List<object> matches = other.objects.stream().map(o -> _find(o)).filter(o -> o._isValid()).collect(Collectors.toList()); |
|
369 |
|
|
370 |
matches.forEach(o -> { |
|
371 |
ObjectOps.decrement(o.ref()); |
|
372 |
}); |
|
364 | 373 |
|
365 | 374 |
returnNormal(objects.removeAll(matches)); |
366 | 375 |
} |
src/com/goldencode/p2j/oo/core/collections/LegacyMap.java 2021-03-25 07:05:29 +0000 | ||
---|---|---|
11 | 11 |
** ME 20210205 Removed getMap method from interface definition, this is FWD specific. |
12 | 12 |
** 003 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
13 | 13 |
** signature. |
14 |
** 004 ME 20210325 Increment/decrement object references (key/value) when added/removed. |
|
14 | 15 |
*/ |
15 | 16 | |
16 | 17 |
/* |
... | ... | |
339 | 340 |
if (poKey.ref().equals(this)) |
340 | 341 |
undoThrow(AppError.newInstance(new character("A Map cannot have itself as key."))); |
341 | 342 | |
343 |
ObjectOps.increment(poKey.ref()); |
|
344 |
if (poValue._isValid()) |
|
345 |
{ |
|
346 |
ObjectOps.increment(poValue.ref()); |
|
347 |
} |
|
348 |
|
|
342 | 349 |
object obj = map.put(poKey, poValue); |
343 | 350 | |
344 | 351 |
if (obj == null) |
... | ... | |
381 | 388 |
if (!poKey.isValid().booleanValue()) |
382 | 389 |
returnNormal(new object()); |
383 | 390 | |
391 |
ObjectOps.decrement(poKey.ref()); |
|
392 |
|
|
384 | 393 |
object obj = map.remove(poKey); |
385 | ||
394 |
|
|
395 |
if (obj != null && obj._isValid()) |
|
396 |
ObjectOps.decrement(obj.ref()); |
|
397 |
|
|
386 | 398 |
if (obj != null) |
387 | 399 |
size--; |
388 | 400 |
|
... | ... | |
407 | 419 | |
408 | 420 |
while (iterator.hasNext().booleanValue()) |
409 | 421 |
{ |
410 |
map.remove(iterator.next_());
|
|
422 |
remove(iterator.next_()); |
|
411 | 423 |
} |
412 | 424 |
} |
413 | 425 |
})); |
src/com/goldencode/p2j/oo/net/MultipartEntity.java 2021-03-30 06:59:26 +0000 | ||
---|---|---|
12 | 12 |
** 20201123 Assert positive index on remove (OE 12.2). |
13 | 13 |
** 005 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
14 | 14 |
** signature. |
15 |
** 006 ME 20210303 Increment/decrement object references for entity parts. |
|
15 | 16 |
*/ |
16 | 17 | |
17 | 18 |
/* |
... | ... | |
313 | 314 |
public void clearParts() |
314 | 315 |
{ |
315 | 316 |
internalProcedure(this, "ClearParts", new Block((Body) () -> { |
317 |
this.parts.forEach(p -> ObjectOps.decrement(p.entity)); |
|
316 | 318 |
this.parts.clear(); |
317 | 319 |
})); |
318 | 320 |
} |
... | ... | |
389 | 391 |
{ |
390 | 392 |
Assert.isPositive(n, new character("Part num")); |
391 | 393 |
|
392 |
boolean found = this.parts.removeIf(p -> p.num == n.intValue());
|
|
394 |
Optional<OrderedPart> found = this.parts.stream().filter(p -> p.num == n.intValue()).findFirst();
|
|
393 | 395 | |
394 |
if (found) |
|
396 |
if (found.isPresent())
|
|
395 | 397 |
{ |
398 |
OrderedPart part = found.get(); |
|
399 |
|
|
400 |
this.parts.remove(part); |
|
401 |
ObjectOps.decrement(part.entity); |
|
402 |
|
|
396 | 403 |
// if removed reorder all parts that comes after (the OE way) |
397 | 404 |
List<OrderedPart> past = this.parts.stream().filter(p -> p.num > n.intValue()) |
398 | 405 |
.sorted((p1, p2) -> p1.num - p2.num).collect(Collectors.toList()); |
... | ... | |
404 | 411 |
} |
405 | 412 |
} |
406 | 413 | |
407 |
returnNormal(new logical(found)); |
|
414 |
returnNormal(new logical(found.isPresent()));
|
|
408 | 415 |
})); |
409 | 416 |
} |
410 | 417 | |
... | ... | |
431 | 438 |
Assert.isPositive(partNum, new character("Part num")); |
432 | 439 |
Assert.notNull(entity, new character("Entity")); |
433 | 440 |
|
441 |
ObjectOps.increment(entity); |
|
442 |
|
|
434 | 443 |
Optional<OrderedPart> part = parts.stream().filter(p -> p.num == partNum.intValue()).findFirst(); |
435 | 444 |
|
436 | 445 |
if(part.isPresent()) { |
446 |
ObjectOps.decrement(part.get().entity); |
|
447 |
|
|
437 | 448 |
part.get().entity = entity; |
438 | 449 |
} else { |
439 | 450 |
parts.add(new OrderedPart(partNum.intValue(), entity)); |
src/com/goldencode/p2j/oo/net/http/HttpHeaderCollection.java 2021-03-29 13:27:35 +0000 | ||
---|---|---|
12 | 12 |
** 005 CA 20210113 Renamed clear() to clear_(), to follow NameConverter's rules. |
13 | 13 |
** 006 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
14 | 14 |
** signature. |
15 |
** 007 ME 20210329 Increment/decrement object references on add/remove. |
|
15 | 16 |
*/ |
16 | 17 | |
17 | 18 |
/* |
... | ... | |
140 | 141 |
{ |
141 | 142 |
internalProcedure(this, "Clear", new Block((Body) () -> |
142 | 143 |
{ |
144 |
headers.values().forEach(h -> { |
|
145 |
if (h!=null && h._isValid()) |
|
146 |
ObjectOps.decrement(h.ref()); |
|
147 |
}); |
|
143 | 148 |
headers.clear(); |
144 | 149 |
})); |
145 | 150 |
} |
... | ... | |
240 | 245 |
internalProcedure(this, "Put", new Block((Body) () -> |
241 | 246 |
{ |
242 | 247 |
Assert.notNull(p1, new character("Http Header")); |
243 |
if (ObjectOps.typeOf(p1, NullHeader.class).booleanValue()) |
|
248 |
if (!ObjectOps.typeOf(p1, NullHeader.class).booleanValue())
|
|
244 | 249 |
{ |
245 |
return; |
|
250 |
object<? extends HttpHeader> old = headers.put(p1.ref().getName(), p1); |
|
251 |
ObjectOps.increment(p1.ref()); |
|
252 |
|
|
253 |
if (old != null && old._isValid()) |
|
254 |
ObjectOps.decrement(old.ref()); |
|
246 | 255 |
} |
247 |
headers.put(p1.ref().getName(), p1); |
|
248 | 256 |
})); |
249 | 257 |
} |
250 | 258 | |
... | ... | |
289 | 297 |
internalProcedure(this, "Put", new Block((Body) () -> |
290 | 298 |
{ |
291 | 299 |
Assert.notNull(p1, new character("Header collection")); |
292 |
this.headers.putAll(p1.ref().headers);
|
|
300 |
p1.ref().headers.values().forEach(this::put);
|
|
293 | 301 |
})); |
294 | 302 |
} |
295 | 303 | |
... | ... | |
310 | 318 |
internalProcedure(this, "Remove", new Block((Body) () -> |
311 | 319 |
{ |
312 | 320 |
Assert.notNullOrEmpty(p1, new character("Header name")); |
313 |
headers.remove(p1); |
|
321 |
object<? extends HttpHeader> old = headers.remove(p1); |
|
322 |
if (old != null && old._isValid()) |
|
323 |
ObjectOps.decrement(old.ref()); |
|
314 | 324 |
})); |
315 | 325 |
} |
316 | 326 |
src/com/goldencode/p2j/oo/net/http/filter/payload/JsonBodyWriter.java 2021-03-25 07:26:35 +0000 | ||
---|---|---|
12 | 12 |
** 004 ME 20210210 Fix/extend implementation as of OE12.2. |
13 | 13 |
** 005 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
14 | 14 |
** signature. |
15 |
** 006 ME 20210324 Moved legacy error serialization in JsonExport. |
|
15 | 16 |
*/ |
16 | 17 | |
17 | 18 |
/* |
... | ... | |
76 | 77 |
import static com.goldencode.p2j.util.BlockManager.onBlockLevel; |
77 | 78 |
import static com.goldencode.p2j.util.BlockManager.returnNormal; |
78 | 79 |
import static com.goldencode.p2j.util.BlockManager.undoThrow; |
79 |
import static com.goldencode.p2j.util.CompareOps._isLessThanOrEqual; |
|
80 |
import static com.goldencode.p2j.util.CompareOps.isEqual; |
|
81 |
import static com.goldencode.p2j.util.CompareOps.isUnknown; |
|
82 |
import static com.goldencode.p2j.util.logical._and; |
|
83 |
import static com.goldencode.p2j.util.logical._not; |
|
84 |
import static com.goldencode.p2j.util.logical.and; |
|
85 | ||
86 |
import org.apache.commons.lang3.StringUtils; |
|
87 | 80 | |
88 | 81 |
import com.goldencode.p2j.oo.common.support.IcharacterHolder; |
89 | 82 |
import com.goldencode.p2j.oo.common.support.IhandleHolder; |
... | ... | |
97 | 90 |
import com.goldencode.p2j.oo.io.*; |
98 | 91 |
import com.goldencode.p2j.oo.json.objectmodel.*; |
99 | 92 |
import com.goldencode.p2j.oo.lang.*; |
100 |
import com.goldencode.p2j.persist.TargetData; |
|
93 |
import com.goldencode.p2j.persist.TargetData; |
|
94 |
import com.goldencode.p2j.persist.serial.JsonExport; |
|
101 | 95 |
import com.goldencode.p2j.persist.serial.Serializator; |
102 | 96 |
import com.goldencode.p2j.util.*; |
103 | 97 |
import com.goldencode.p2j.util.BlockManager.Action; |
... | ... | |
289 | 283 |
} |
290 | 284 |
else if (ObjectOps.typeOf(poData, LegacyError.class).booleanValue()) |
291 | 285 |
{ |
292 |
returnNormal(write(this.writeError(ObjectOps.cast(poData, LegacyError.class))));
|
|
286 |
returnNormal(write(JsonExport.serializeError(ObjectOps.cast(poData, LegacyError.class))));
|
|
293 | 287 |
} |
294 | 288 |
else if (ObjectOps.typeOf(poData, IcharacterHolder.class).booleanValue()) |
295 | 289 |
{ |
... | ... | |
436 | 430 |
returnNormal(write(oJson)); |
437 | 431 |
} |
438 | 432 |
})); |
439 |
} |
|
440 |
|
|
441 |
/** |
|
442 |
* Write error. |
|
443 |
* |
|
444 |
* @param error error to be written. |
|
445 |
*/ |
|
446 |
private object<? extends JsonObject> writeError(object<? extends LegacyError> _poError) |
|
447 |
{ |
|
448 |
|
|
449 |
object<? extends LegacyError> poError = TypeFactory.initInput(_poError); |
|
450 |
object<? extends JsonObject> oResponse = TypeFactory.object(JsonObject.class); |
|
451 |
object<? extends JsonObject> oError = TypeFactory.object(JsonObject.class); |
|
452 |
object<? extends JsonArray> oErrorList = TypeFactory.object(JsonArray.class); |
|
453 |
integer iLoop = TypeFactory.integer(); |
|
454 |
|
|
455 |
Assert.notNull(poError, new character("Error")); |
|
456 |
oResponse.assign(ObjectOps.newInstance(JsonObject.class)); |
|
457 |
oErrorList.assign(ObjectOps.newInstance(JsonArray.class)); |
|
458 |
|
|
459 |
if ((ObjectOps.typeOf(poError, AppError.class)).booleanValue()) |
|
460 |
{ |
|
461 |
oResponse.ref().add(new character("_retVal"), ObjectOps.cast(poError, AppError.class).ref().getReturnValue()); |
|
462 |
} |
|
463 |
|
|
464 |
oResponse.ref().add(new character("_errors"), oErrorList); |
|
465 |
|
|
466 |
for (int i = 0; i < _poError.ref().getNumMessages().intValue(); i++) |
|
467 |
{ |
|
468 |
iLoop.assign(i + 1); |
|
469 |
|
|
470 |
oError.assign(ObjectOps.newInstance(JsonObject.class)); |
|
471 |
oErrorList.ref().add_2(oError); |
|
472 |
oError.ref().add(new character("_errorMsg"), poError.ref().getMessage(iLoop)); |
|
473 |
oError.ref().add(new character("_errorNum"), poError.ref().getMessageNum(iLoop)); |
|
474 |
} |
|
475 |
|
|
476 |
if ((SessionUtils.isDebugAlert()).booleanValue()) |
|
477 |
{ |
|
478 |
oResponse.ref().add(new character("_type"), poError.ref().getLegacyClass().ref().getTypeName()); |
|
479 |
|
|
480 |
if (!poError.ref().getCallStack().isUnknown()) |
|
481 |
{ |
|
482 |
oErrorList.assign(ObjectOps.newInstance(JsonArray.class)); |
|
483 |
oResponse.ref().add(new character("_stack"), oErrorList); |
|
484 |
|
|
485 |
String[] callStack = TextOps.entries(poError.ref().getCallStack().getValue(), "\\n"); |
|
486 |
|
|
487 |
for (int i = 0; i < callStack.length; i++) |
|
488 |
{ |
|
489 |
oErrorList.ref().add(new character(callStack[i])); |
|
490 |
} |
|
491 |
} |
|
492 |
|
|
493 |
} |
|
494 |
|
|
495 |
// TODO: accessing any method in LegacyClass throws NPE |
|
496 |
// ProcedureManager.CalleeInfoImpl.push #5351 |
|
497 |
// oProp.assign(poError.ref().getLegacyClass().ref().getProperty(new character("InnerError"))); |
|
498 |
// |
|
499 |
// if (_and(and(oProp.isValid(), () -> isEqual(oProp.ref().getDataType(), DataType.object_)), () -> LegacyClass.getLegacyClass(oProp.ref().getDataTypeName()).ref().isA(ObjectOps.getLegacyClass(LegacyError.class)))) |
|
500 |
// { |
|
501 |
// oInner.assign(oProp.ref().get(poError)); |
|
502 |
// |
|
503 |
// if ((oInner.isValid()).booleanValue()) |
|
504 |
// { |
|
505 |
// this.writeError(oInner); |
|
506 |
// } |
|
507 |
// } |
|
508 |
return oResponse; |
|
509 |
}; |
|
510 |
|
|
433 |
} |
|
511 | 434 |
} |
src/com/goldencode/p2j/oo/net/http/filter/payload/JsonEntityWriter.java 2021-03-25 07:26:35 +0000 | ||
---|---|---|
9 | 9 |
** 002 MP 20200611 Added missing methods as stubs taken by converting the skeleton using FWD. |
10 | 10 |
** 003 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
11 | 11 |
** signature. |
12 |
** 004 ME 20210324 Add missing methods, complete implementation as of OE12.2. |
|
12 | 13 |
*/ |
13 | 14 | |
14 | 15 |
/* |
... | ... | |
73 | 74 |
import static com.goldencode.p2j.util.BlockManager.onBlockLevel; |
74 | 75 |
import static com.goldencode.p2j.util.BlockManager.returnNormal; |
75 | 76 | |
77 |
import com.goldencode.p2j.oo.common.support.IcharacterHolder; |
|
78 |
import com.goldencode.p2j.oo.common.support.IhandleHolder; |
|
79 |
import com.goldencode.p2j.oo.common.support.IlongcharHolder; |
|
76 | 80 |
import com.goldencode.p2j.oo.core.*; |
81 |
import com.goldencode.p2j.oo.core.collections.Iiterator; |
|
82 |
import com.goldencode.p2j.oo.core.collections.Imap; |
|
83 |
import com.goldencode.p2j.oo.core.collections.ImapEntry; |
|
84 |
import com.goldencode.p2j.oo.core.collections.LegacyMap; |
|
85 |
import com.goldencode.p2j.oo.core.collections.LegacyMapEntry; |
|
77 | 86 |
import com.goldencode.p2j.oo.json.objectmodel.*; |
78 | 87 |
import com.goldencode.p2j.oo.lang.*; |
88 |
import com.goldencode.p2j.oo.net.http.Cookie; |
|
89 |
import com.goldencode.p2j.oo.net.http.HttpHeader; |
|
90 |
import com.goldencode.p2j.persist.BufferImpl; |
|
91 |
import com.goldencode.p2j.persist.DataSet; |
|
92 |
import com.goldencode.p2j.persist.TempTable; |
|
93 |
import com.goldencode.p2j.persist.serial.JsonExport; |
|
79 | 94 |
import com.goldencode.p2j.util.*; |
80 | 95 |
import com.goldencode.p2j.util.BlockManager.Action; |
81 | 96 |
import com.goldencode.p2j.util.BlockManager.Condition; |
... | ... | |
125 | 140 |
} |
126 | 141 | |
127 | 142 |
/** |
143 |
* Constructor |
|
144 |
* |
|
145 |
* @param _poType entity type |
|
146 |
*/ |
|
147 |
@LegacySignature(type = Type.CONSTRUCTOR, parameters = |
|
148 |
{ |
|
149 |
@LegacyParameter(name = "poType", type = "OBJECT", |
|
150 |
qualified = "progress.lang.class", mode = "INPUT"), |
|
151 |
}) |
|
152 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
153 |
public void __net_http_filter_payload_JsonEntityWriter_constructor__( |
|
154 |
object<? extends LegacyClass> _poType) |
|
155 |
{ |
|
156 |
object<? extends LegacyClass> poType = TypeFactory.initInput(_poType); |
|
157 |
internalProcedure(this, "__net_http_filter_payload_JsonEntityWriter_constructor__", new Block((Body) () -> |
|
158 |
{ |
|
159 |
__net_http_filter_payload_MessageWriter_constructor__(poType); |
|
160 |
})); |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
128 | 164 |
* Opens the writer for output. |
129 | 165 |
*/ |
130 | 166 |
@LegacySignature(type = Type.METHOD, name = "Open") |
... | ... | |
148 | 184 |
{ |
149 | 185 |
internalProcedure(this, "Close", new Block((Body)() -> { |
150 | 186 |
super.close(); |
151 |
moParser.assign((ObjectModelParser)null);
|
|
187 |
moParser.setUnknown();
|
|
152 | 188 |
})); |
153 | 189 |
} |
154 | 190 | |
... | ... | |
201 | 237 |
return function(this, "Write", int64.class, new Block((Body) () -> |
202 | 238 |
{ |
203 | 239 |
int64 len = _poData.length(); |
204 |
Assert.isZeroOrPositive(len, new character("Data")); |
|
240 |
Assert.isZeroOrPositive(len, new character("Data size"));
|
|
205 | 241 |
if (len.longValue() == 0) |
206 | 242 |
{ |
207 | 243 |
this.entity.assign(ObjectOps.newInstance(JsonObject.class)); |
... | ... | |
256 | 292 |
{ |
257 | 293 |
@LegacyParameter(name = "phData", type = "HANDLE", mode = "INPUT") |
258 | 294 |
}) |
259 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
295 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
260 | 296 |
@Override |
261 | 297 |
public int64 write(handle _phData) |
262 | 298 |
{ |
299 |
handle phData = TypeFactory.initInput(_phData); |
|
300 |
|
|
263 | 301 |
return function(this, "Write", int64.class, new Block((Body) () -> |
264 | 302 |
{ |
265 |
UnimplementedFeature.missing("JsonEntityWriter:Write h METHOD"); |
|
303 |
Assert.notNull(phData, new character("Data")); |
|
304 |
|
|
305 |
WrappedResource res = phData.getResource(); |
|
306 |
|
|
307 |
if (res instanceof TempTable || res instanceof DataSet || res instanceof BufferImpl) |
|
308 |
{ |
|
309 |
this.entity.assign(ObjectOps.newInstance(JsonObject.class)); |
|
310 |
ObjectOps.cast(this.entity, JsonObject.class).ref().read(phData); |
|
311 |
} |
|
312 |
|
|
313 |
returnNormal(new unknown()); |
|
266 | 314 |
})); |
267 | 315 |
} |
268 | 316 |
|
... | ... | |
270 | 318 |
{ |
271 | 319 |
@LegacyParameter(name = "phData", type = "HANDLE", mode = "INPUT") |
272 | 320 |
}) |
273 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
321 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
274 | 322 |
public int64 writeHandle(final handle _phData) |
275 | 323 |
{ |
276 | 324 |
handle phData = TypeFactory.initInput(_phData); |
... | ... | |
295 | 343 |
}) |
296 | 344 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
297 | 345 |
@Override |
298 |
public int64 write(object<? extends _BaseObject_> poData) |
|
346 |
public int64 write(object<? extends _BaseObject_> _poData)
|
|
299 | 347 |
{ |
348 |
object<? extends _BaseObject_> poData = TypeFactory.initInput(_poData); |
|
349 |
|
|
300 | 350 |
return function(this, "Write", int64.class, new Block((Body) () -> |
301 | 351 |
{ |
302 | 352 |
object<? extends Memptr> mptr = TypeFactory.object(Memptr.class); |
303 |
Assert.notNull(poData); |
|
304 |
if (ObjectOps.typeOf(poData, LegacyError.class).booleanValue()) |
|
353 |
|
|
354 |
if (!poData._isValid()) |
|
355 |
{ |
|
356 |
this.entity.assign(ObjectOps.newInstance(JsonObject.class)); |
|
357 |
returnNormal(0L); |
|
358 |
} |
|
359 |
else if (ObjectOps.typeOf(poData, LegacyError.class).booleanValue()) |
|
305 | 360 |
{ |
306 | 361 |
writeError(ObjectOps.cast(poData, LegacyError.class)); |
307 | 362 |
returnNormal(0L); |
308 | 363 |
} |
309 |
if (ObjectOps.typeOf(poData, JsonConstruct.class).booleanValue()) |
|
364 |
else if (ObjectOps.typeOf(poData, JsonConstruct.class).booleanValue())
|
|
310 | 365 |
{ |
311 | 366 |
this.entity.assign(poData); |
312 | 367 |
returnNormal(0L); |
313 | 368 |
} |
314 |
if (ObjectOps.typeOf(poData, String.class).booleanValue()) |
|
315 |
{ |
|
316 |
returnNormal(write(ObjectOps.cast(poData, LegacyString.class).ref().getValue())); |
|
317 |
} |
|
318 | ||
319 |
if (ObjectOps.typeOf(poData, WidgetHandle.class).booleanValue()) |
|
320 |
{ |
|
321 |
returnNormal(write(ObjectOps.cast(poData, WidgetHandle.class).ref().getValue())); |
|
322 |
} |
|
323 | ||
324 |
if (ObjectOps.typeOf(poData, ByteBucket.class).booleanValue()) |
|
369 |
else if (ObjectOps.typeOf(poData, IlongcharHolder.class).booleanValue()) |
|
370 |
{ |
|
371 |
returnNormal(write(ObjectOps.cast(poData, IlongcharHolder.class).ref().getValue())); |
|
372 |
} |
|
373 |
else if (ObjectOps.typeOf(poData, IcharacterHolder.class).booleanValue()) |
|
374 |
{ |
|
375 |
returnNormal(write(ObjectOps.cast(poData, IcharacterHolder.class).ref().getValue())); |
|
376 |
} |
|
377 |
else if (ObjectOps.typeOf(poData, IhandleHolder.class).booleanValue()) |
|
378 |
{ |
|
379 |
returnNormal(write(ObjectOps.cast(poData, IhandleHolder.class).ref().getValue())); |
|
380 |
} |
|
381 |
else if (ObjectOps.typeOf(poData, ByteBucket.class).booleanValue()) |
|
325 | 382 |
{ |
326 | 383 |
returnNormal(write(ObjectOps.cast(poData, ByteBucket.class).ref().getString())); |
327 | 384 |
} |
328 | ||
329 |
if (ObjectOps.typeOf(poData, Memptr.class).booleanValue()) |
|
385 |
else if (ObjectOps.typeOf(poData, Memptr.class).booleanValue()) |
|
330 | 386 |
{ |
331 | 387 |
mptr.assign(poData); |
332 | 388 |
int64 len = mptr.ref().getSize(); |
... | ... | |
341 | 397 |
} |
342 | 398 |
returnNormal(len); |
343 | 399 |
} |
400 |
else if (ObjectOps.typeOf(poData, Cookie.class).booleanValue()) |
|
401 |
{ |
|
402 |
returnNormal(write(write_1(ObjectOps.cast(poData, Cookie.class)))); |
|
403 |
} |
|
404 |
else if (ObjectOps.typeOf(poData, HttpHeader.class).booleanValue()) |
|
405 |
{ |
|
406 |
returnNormal(write(write_2(ObjectOps.cast(poData, HttpHeader.class)))); |
|
407 |
} |
|
408 |
else if (ObjectOps.typeOf(poData, Imap.class).booleanValue()) |
|
409 |
{ |
|
410 |
writeMap(ObjectOps.cast(poData, Imap.class)); |
|
411 |
returnNormal(0L); |
|
412 |
} |
|
413 |
else if (ObjectOps.typeOf(poData, ImapEntry.class).booleanValue()) |
|
414 |
{ |
|
415 |
object<ImapEntry> mEntry = ObjectOps.cast(poData, ImapEntry.class); |
|
416 |
|
|
417 |
writeTuple(mEntry.ref().getKey(), mEntry.ref().getValue()); |
|
418 |
returnNormal(0L); |
|
419 |
} |
|
344 | 420 |
unsupported(poData); |
345 | 421 |
})); |
346 | 422 |
} |
423 |
|
|
424 |
@LegacySignature(type = Type.METHOD, name = "Write", returns = "OBJECT", qualified = "progress.json.objectmodel.jsonobject", parameters = |
|
425 |
{ |
|
426 |
@LegacyParameter(name = "pCookie", type = "OBJECT", qualified = "openedge.net.http.cookie", mode = "INPUT") |
|
427 |
}) |
|
428 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
429 |
protected object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> write_1(final object<? extends com.goldencode.p2j.oo.net.http.Cookie> _pCookie) |
|
430 |
{ |
|
431 |
object<? extends com.goldencode.p2j.oo.net.http.Cookie> pCookie = TypeFactory.initInput(_pCookie); |
|
432 |
object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> oRet = TypeFactory.object(JsonObject.class); |
|
433 |
|
|
434 |
return function(JsonEntityWriter.class, this, "Write", object.class, new Block((Body) () -> { |
|
435 |
|
|
436 |
oRet.assign(ObjectOps.newInstance(JsonObject.class)); |
|
437 |
oRet.ref().add(new character("name"), pCookie.ref().getName()); |
|
438 |
oRet.ref().add(new character("value"), pCookie.ref().getValue()); |
|
439 |
oRet.ref().add(new character("path"), pCookie.ref().getPath()); |
|
440 |
oRet.ref().add(new character("domain"), pCookie.ref().getDomain()); |
|
441 |
oRet.ref().add(new character("expires"), pCookie.ref().getExpiresAt()); |
|
442 |
oRet.ref().add(new character("httpOnly"), pCookie.ref().getHttpOnly()); |
|
443 |
oRet.ref().add(new character("secure"), pCookie.ref().getSecure()); |
|
444 |
|
|
445 |
returnNormal(oRet); |
|
446 |
})); |
|
447 |
} |
|
448 | ||
449 |
@LegacySignature(type = Type.METHOD, name = "Write", returns = "OBJECT", qualified = "progress.json.objectmodel.jsonobject", parameters = |
|
450 |
{ |
|
451 |
@LegacyParameter(name = "pHeader", type = "OBJECT", qualified = "openedge.net.http.httpheader", mode = "INPUT") |
|
452 |
}) |
|
453 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
454 |
protected object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> write_2(final object<? extends com.goldencode.p2j.oo.net.http.HttpHeader> _pHeader) |
|
455 |
{ |
|
456 |
object<? extends com.goldencode.p2j.oo.net.http.HttpHeader> pHeader = TypeFactory.initInput(_pHeader); |
|
457 |
object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> oRet = TypeFactory.object(JsonObject.class); |
|
458 |
|
|
459 |
return function(JsonEntityWriter.class, this, "Write", object.class, new Block((Body) () -> { |
|
460 |
|
|
461 |
oRet.assign(ObjectOps.newInstance(JsonObject.class)); |
|
462 |
oRet.ref().add(new character("name"), pHeader.ref().getName()); |
|
463 |
oRet.ref().add(new character("value"), pHeader.ref().getValue()); |
|
464 |
|
|
465 |
// 4GL quirk, always invalid object, missing return maybe |
|
466 |
returnNormal(oRet); |
|
467 |
})); |
|
468 |
} |
|
347 | 469 | |
348 | 470 |
/** |
349 | 471 |
* Write error. |
350 | 472 |
* |
351 |
* @param error error to be written.
|
|
473 |
* @param poError error to be written.
|
|
352 | 474 |
*/ |
353 |
private void writeError(object<? extends LegacyError> error) |
|
354 |
{ |
|
355 |
// TODO: immplement |
|
475 |
@LegacySignature(type = Type.METHOD, name = "WriteError", parameters = |
|
476 |
{ |
|
477 |
@LegacyParameter(name = "poError", type = "OBJECT", qualified = "progress.lang.error", mode = "INPUT") |
|
478 |
}) |
|
479 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
480 |
protected void writeError(object<? extends LegacyError> _poError) |
|
481 |
{ |
|
482 |
object<? extends com.goldencode.p2j.oo.lang.LegacyError> poError = TypeFactory.initInput(_poError); |
|
483 |
object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> jsonErr = TypeFactory.object(JsonObject.class); |
|
484 |
object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonArray> jsonArr = TypeFactory.object(JsonArray.class); |
|
485 |
|
|
486 |
|
|
487 |
internalProcedure(JsonEntityWriter.class, this, "WriteError", new Block((Body) () -> { |
|
488 |
|
|
489 |
jsonErr.assign(JsonExport.serializeError(poError)); |
|
490 |
|
|
491 |
if (this.entity._isValid()) |
|
492 |
{ |
|
493 |
if (ObjectOps.typeOf(this.entity, JsonArray.class).booleanValue()) |
|
494 |
{ |
|
495 |
ObjectOps.cast(this.entity, JsonArray.class).ref().add_2(jsonErr); |
|
496 |
} |
|
497 |
else if (ObjectOps.typeOf(this.entity, JsonObject.class).booleanValue()) |
|
498 |
{ |
|
499 |
jsonArr.assign(ObjectOps.newInstance(JsonArray.class)); |
|
500 |
jsonArr.ref().add_2(ObjectOps.cast(this.entity, JsonObject.class)); |
|
501 |
jsonArr.ref().add_2(jsonErr); |
|
502 |
|
|
503 |
this.entity.assign(jsonArr); |
|
504 |
} |
|
505 |
} |
|
506 |
else |
|
507 |
{ |
|
508 |
this.entity.assign(jsonErr); |
|
509 |
} |
|
510 |
})); |
|
511 |
} |
|
512 |
|
|
513 |
@LegacySignature(type = Type.METHOD, name = "WriteMap", parameters = |
|
514 |
{ |
|
515 |
@LegacyParameter(name = "pValue", type = "OBJECT", qualified = "openedge.core.collections.imap", mode = "INPUT") |
|
516 |
}) |
|
517 |
protected void writeMap(final object<? extends com.goldencode.p2j.oo.core.collections.Imap> _pValue) |
|
518 |
{ |
|
519 |
object<? extends com.goldencode.p2j.oo.core.collections.Imap> pValue = TypeFactory.initInput(_pValue); |
|
520 |
object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> oRet = TypeFactory.object(JsonObject.class); |
|
521 |
|
|
522 |
internalProcedure(JsonEntityWriter.class, this, "WriteMap", new Block((Body) () -> { |
|
523 |
|
|
524 |
Assert.notNull(pValue, new character("Map")); |
|
525 |
|
|
526 |
oRet.assign(ObjectOps.newInstance(JsonObject.class)); |
|
527 |
|
|
528 |
if (pValue.ref() instanceof LegacyMap) |
|
529 |
{ |
|
530 |
((LegacyMap) pValue.ref()).getMap().forEach((k, v) -> { |
|
531 |
if (!k.isUnknown()) |
|
532 |
{ |
|
533 |
if (!v.isUnknown()) |
|
534 |
{ |
|
535 |
oRet.ref().add(k.ref().toLegacyString(), v.ref().toLegacyString()); |
|
536 |
} |
|
537 |
else |
|
538 |
{ |
|
539 |
oRet.ref().addNull(k.ref().toLegacyString()); |
|
540 |
} |
|
541 |
} |
|
542 |
}); |
|
543 |
} |
|
544 |
else |
|
545 |
{ |
|
546 |
Iiterator it = pValue.ref().getEntrySet().ref().iterator().ref(); |
|
547 |
|
|
548 |
while (it.hasNext().booleanValue()) |
|
549 |
{ |
|
550 |
object<LegacyMapEntry> entry = ObjectOps.cast(it.next_(), LegacyMapEntry.class); |
|
551 |
if (!entry.isUnknown() && !entry.ref().getKey().isUnknown()) |
|
552 |
{ |
|
553 |
if (!entry.ref().getValue().isUnknown()) |
|
554 |
{ |
|
555 |
oRet.ref().add(entry.ref().getKey().ref().toLegacyString(), entry.ref().getValue().ref().toLegacyString()); |
|
556 |
} |
|
557 |
else |
|
558 |
{ |
|
559 |
oRet.ref().addNull(entry.ref().getKey().ref().toLegacyString()); |
|
560 |
} |
|
561 |
} |
|
562 |
} |
|
563 |
} |
|
564 |
|
|
565 |
this.entity.assign(oRet); |
|
566 |
})); |
|
567 |
} |
|
568 |
|
|
569 |
@LegacySignature(type = Type.METHOD, name = "WriteTuple", parameters = |
|
570 |
{ |
|
571 |
@LegacyParameter(name = "pKey", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"), |
|
572 |
@LegacyParameter(name = "pValue", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT") |
|
573 |
}) |
|
574 |
protected void writeTuple(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _pKey, final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _pValue) |
|
575 |
{ |
|
576 |
object<? extends com.goldencode.p2j.oo.lang._BaseObject_> pKey = TypeFactory.initInput(_pKey); |
|
577 |
object<? extends com.goldencode.p2j.oo.lang._BaseObject_> pValue = TypeFactory.initInput(_pValue); |
|
578 |
object<? extends com.goldencode.p2j.oo.json.objectmodel.JsonObject> oRet = TypeFactory.object(JsonObject.class); |
|
579 |
|
|
580 |
internalProcedure(JsonEntityWriter.class, this, "WriteTuple", new Block((Body) () -> { |
|
581 |
|
|
582 |
Assert.notNull(pKey, new character("Tuple key")); |
|
583 |
|
|
584 |
character key = pKey.ref().toLegacyString(); |
|
585 |
character val = pValue.isUnknown() ? new character() : pValue.ref().toLegacyString(); |
|
586 |
|
|
587 |
if (this.entity.isUnknown() || ObjectOps.typeOf(this.entity, JsonArray.class).booleanValue()) |
|
588 |
{ |
|
589 |
oRet.assign(ObjectOps.newInstance(JsonObject.class)); |
|
590 |
|
|
591 |
oRet.ref().add(key, val); |
|
592 |
|
|
593 |
if (this.entity.isUnknown()) |
|
594 |
{ |
|
595 |
this.entity.assign(oRet); |
|
596 |
} |
|
597 |
else |
|
598 |
{ |
|
599 |
ObjectOps.cast(this.entity, JsonArray.class).ref().add_2(oRet); |
|
600 |
} |
|
601 |
} |
|
602 |
else if (ObjectOps.typeOf(this.entity, JsonObject.class).booleanValue()) |
|
603 |
{ |
|
604 |
oRet.assign(ObjectOps.cast(this.entity, JsonObject.class)); |
|
605 |
if (oRet.ref().has(key).booleanValue()) |
|
606 |
{ |
|
607 |
oRet.ref().set(key, val); |
|
608 |
} |
|
609 |
else |
|
610 |
{ |
|
611 |
oRet.ref().add(key, val); |
|
612 |
} |
|
613 |
} |
|
614 |
})); |
|
356 | 615 |
} |
357 | 616 |
} |
src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartEntityWriter.java 2021-03-30 07:07:06 +0000 | ||
---|---|---|
10 | 10 |
** 003 CA 20191024 Added method support levels and updated the class support level. |
11 | 11 |
** 004 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
12 | 12 |
** signature. |
13 |
** 005 ME 20210330 Complete implementation as per OE12.2. |
|
13 | 14 |
*/ |
14 | 15 | |
15 | 16 |
/* |
... | ... | |
71 | 72 |
import static com.goldencode.p2j.report.ReportConstants.*; |
72 | 73 |
import static com.goldencode.p2j.util.BlockManager.function; |
73 | 74 |
import static com.goldencode.p2j.util.BlockManager.internalProcedure; |
75 |
import static com.goldencode.p2j.util.BlockManager.onBlockLevel; |
|
74 | 76 |
import static com.goldencode.p2j.util.BlockManager.returnNormal; |
75 | 77 | |
76 | 78 |
import java.io.*; |
... | ... | |
80 | 82 |
import org.apache.james.mime4j.*; |
81 | 83 |
import org.apache.james.mime4j.stream.*; |
82 | 84 | |
85 |
import com.goldencode.p2j.oo.common.support.ImemptrHolder; |
|
83 | 86 |
import com.goldencode.p2j.oo.core.*; |
84 | 87 |
import com.goldencode.p2j.oo.lang.*; |
85 | 88 |
import com.goldencode.p2j.oo.net.*; |
86 | 89 |
import com.goldencode.p2j.oo.net.http.*; |
87 | 90 |
import com.goldencode.p2j.oo.net.http.filter.writer.*; |
88 | 91 |
import com.goldencode.p2j.util.*; |
92 |
import com.goldencode.p2j.util.BlockManager.Action; |
|
93 |
import com.goldencode.p2j.util.BlockManager.Condition; |
|
89 | 94 |
import com.goldencode.p2j.util.InternalEntry.*; |
90 | 95 | |
91 | 96 |
/** |
... | ... | |
130 | 135 |
}) |
131 | 136 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
132 | 137 |
@Override |
133 |
public void setBoundary(character boundary) |
|
138 |
public void setBoundary(character _boundary)
|
|
134 | 139 |
{ |
135 |
character pcEncoding = TypeFactory.initInput(boundary);
|
|
140 |
character boundary = TypeFactory.initInput(_boundary);
|
|
136 | 141 |
internalProcedure(this, "Boundary", new Block((Body) () -> |
137 | 142 |
{ |
138 | 143 |
this.boundary.assign(boundary); |
... | ... | |
146 | 151 |
{ |
147 | 152 |
externalProcedure(MultipartEntityWriter.this, new Block((Body) () -> |
148 | 153 |
{ |
154 |
onBlockLevel(Condition.ERROR, Action.THROW); |
|
149 | 155 |
{ |
150 | 156 |
} |
151 | 157 |
})); |
... | ... | |
164 | 170 |
__net_http_filter_payload_MessageWriter_constructor__( |
165 | 171 |
ObjectOps.getLegacyClass(MultipartEntity.class) |
166 | 172 |
); |
173 |
|
|
174 |
this.boundary.assign("X-OPENEDGE-BOUNDARY"); |
|
167 | 175 |
})); |
168 | 176 |
} |
169 | 177 | |
... | ... | |
181 | 189 |
}) |
182 | 190 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
183 | 191 |
@Override |
184 |
public int64 write(object<? extends _BaseObject_> poData) |
|
192 |
public int64 write(object<? extends _BaseObject_> _poData)
|
|
185 | 193 |
{ |
194 |
object<? extends _BaseObject_> poData = TypeFactory.initInput(_poData); |
|
195 |
|
|
186 | 196 |
return function(this, "Write", int64.class, new Block((Body) () -> |
187 | 197 |
{ |
188 |
object<? extends Memptr> mptr = TypeFactory.object(Memptr.class); |
|
189 |
Assert.notNull(poData); |
|
190 |
if (ObjectOps.typeOf(poData, Memptr.class).booleanValue()) |
|
191 |
{ |
|
192 |
mptr.assign(ObjectOps.cast(poData, Memptr.class)); |
|
198 |
if (!poData._isValid()) |
|
199 |
{ |
|
200 |
returnNormal(0); |
|
201 |
} |
|
202 |
else if (ObjectOps.typeOf(poData, ImemptrHolder.class).booleanValue()) |
|
203 |
{ |
|
204 |
returnNormal(write(ObjectOps.cast(poData, ImemptrHolder.class).ref().getValue())); |
|
193 | 205 |
} |
194 | 206 |
else if (ObjectOps.typeOf(poData, ByteBucket.class).booleanValue()) |
195 | 207 |
{ |
208 |
object<? extends Memptr> mptr = TypeFactory.object(Memptr.class); |
|
209 |
|
|
196 | 210 |
mptr.assign(ObjectOps.cast(poData, ByteBucket.class).ref().getBytes()); |
211 |
returnNormal(write(mptr.ref().getValue())); |
|
212 |
} |
|
213 |
else if (ObjectOps.typeOf(poData, MessagePart.class).booleanValue()) |
|
214 |
{ |
|
215 |
returnNormal(write_1(ObjectOps.cast(poData, MessagePart.class))); |
|
197 | 216 |
} |
198 | 217 |
else |
199 | 218 |
{ |
200 | 219 |
unsupported(poData); |
201 | 220 |
} |
202 |
returnNormal(write(mptr.ref().getValue())); |
|
203 | 221 |
})); |
204 | 222 |
} |
205 | 223 | |
... | ... | |
216 | 234 |
}) |
217 | 235 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
218 | 236 |
@Override |
219 |
public int64 write(memptr ptr) |
|
237 |
public int64 write(memptr _ptr)
|
|
220 | 238 |
{ |
239 |
memptr ptr = TypeFactory.initInput(_ptr); |
|
240 |
|
|
221 | 241 |
return function(this, "Write", int64.class, new Block((Body) () -> |
222 | 242 |
{ |
243 |
Assert.notNull(ptr.length(), new character("Data size")); |
|
244 |
|
|
223 | 245 |
try |
224 | 246 |
{ |
225 | 247 |
returnNormal(parseMutipart(ptr.getByteArray())); |
... | ... | |
314 | 336 |
} |
315 | 337 |
return new int64(bytes.length); |
316 | 338 |
} |
339 |
|
|
340 |
@LegacySignature(type = Type.METHOD, name = "Write", returns = "INT64", parameters = |
|
341 |
{ |
|
342 |
@LegacyParameter(name = "pData", type = "OBJECT", qualified = "openedge.net.messagepart", mode = "INPUT") |
|
343 |
}) |
|
344 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
345 |
public int64 write_1(final object<? extends MessagePart> _pData) |
|
346 |
{ |
|
347 |
object<? extends MessagePart> pData = TypeFactory.initInput(_pData); |
|
348 |
|
|
349 |
return function(MultipartEntityWriter.class, this, "Write", int64.class, new Block((Body) () -> |
|
350 |
{ |
|
351 |
if (pData._isValid()) |
|
352 |
{ |
|
353 |
object<? extends MultipartEntity> mEntity = TypeFactory.object(MultipartEntity.class); |
|
354 |
|
|
355 |
if (!this.entity._isValid()) |
|
356 |
{ |
|
357 |
mEntity.assign(ObjectOps.newInstance(MultipartEntity.class)); |
|
358 |
mEntity.ref().setBoundary(boundary); |
|
359 |
this.entity.assign(mEntity); |
|
360 |
} |
|
361 |
else |
|
362 |
{ |
|
363 |
mEntity.assign(ObjectOps.cast(this.entity, MultipartEntity.class)); |
|
364 |
} |
|
365 |
|
|
366 |
mEntity.ref().addPart(pData); |
|
367 |
} |
|
368 |
|
|
369 |
returnNormal(0); |
|
370 |
})); |
|
371 |
} |
|
317 | 372 |
} |
src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartFormBodyWriter.java 2021-03-31 09:51:16 +0000 | ||
---|---|---|
9 | 9 |
** |
10 | 10 |
** 002 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
11 | 11 |
** signature. |
12 |
** 003 ME 20210331 Implemented as per OE12.2. |
|
12 | 13 |
*/ |
13 | 14 | |
14 | 15 |
/* |
... | ... | |
70 | 71 |
import com.goldencode.p2j.util.BlockManager.Action; |
71 | 72 |
import com.goldencode.p2j.util.BlockManager.Condition; |
72 | 73 | |
73 |
import static com.goldencode.p2j.report.ReportConstants.CVT_LVL_FULL; |
|
74 |
import static com.goldencode.p2j.report.ReportConstants.RT_LVL_STUB; |
|
74 |
import static com.goldencode.p2j.report.ReportConstants.*; |
|
75 | 75 |
import static com.goldencode.p2j.util.BlockManager.*; |
76 | 76 |
import static com.goldencode.p2j.util.InternalEntry.Type; |
77 | 77 | |
78 |
import java.io.File; |
|
79 | ||
80 |
import com.goldencode.p2j.oo.common.support.ImemptrHolder; |
|
81 |
import com.goldencode.p2j.oo.core.Assert; |
|
82 |
import com.goldencode.p2j.oo.core.ByteBucket; |
|
83 |
import com.goldencode.p2j.oo.core.LegacyString; |
|
84 |
import com.goldencode.p2j.oo.core.collections.Iiterator; |
|
85 |
import com.goldencode.p2j.oo.core.collections.Imap; |
|
86 |
import com.goldencode.p2j.oo.core.collections.LegacyMap; |
|
87 |
import com.goldencode.p2j.oo.core.collections.LegacyMapEntry; |
|
88 |
import com.goldencode.p2j.oo.io.FileInputStream; |
|
89 |
import com.goldencode.p2j.oo.net.FileTypeRegistry; |
|
90 |
import com.goldencode.p2j.oo.net.MessagePart; |
|
91 |
import com.goldencode.p2j.oo.net.MultipartEntity; |
|
92 |
import com.goldencode.p2j.oo.net.http.HttpHeader; |
|
93 |
import com.goldencode.p2j.oo.net.http.HttpHeaderBuilder; |
|
94 |
import com.goldencode.p2j.oo.net.http.filter.writer.BodyWriterBuilder; |
|
95 | ||
78 | 96 |
/** |
79 | 97 |
* Business logic (converted to Java from the 4GL source code |
80 | 98 |
* in OpenEdge/Net/HTTP/Filter/Payload/MultipartFormBodyWriter.cls). |
81 | 99 |
*/ |
82 | 100 |
@LegacyResource(resource = "OpenEdge.Net.HTTP.Filter.Payload.MultipartFormBodyWriter") |
83 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
101 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
84 | 102 |
public class MultipartFormBodyWriter |
85 | 103 |
extends com.goldencode.p2j.oo.net.http.filter.payload.MessageWriter |
86 | 104 |
implements com.goldencode.p2j.oo.net.ISupportMultipartEntity, |
87 | 105 |
com.goldencode.p2j.oo.core.ISupportEncoding |
88 | 106 |
{ |
107 |
private static final String CRLF = "\r\n"; |
|
108 |
|
|
89 | 109 |
@LegacySignature(type = Type.PROPERTY, name = "Boundary") |
90 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
110 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
91 | 111 |
private character boundary = TypeFactory.character(); |
92 | 112 | |
93 | 113 |
@LegacySignature(type = Type.PROPERTY, name = "Encoding") |
94 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
114 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
95 | 115 |
private character encoding = TypeFactory.character(); |
96 | 116 | |
97 | 117 |
public void __net_http_filter_payload_MultipartFormBodyWriter_execute__() |
... | ... | |
105 | 125 |
} |
106 | 126 | |
107 | 127 |
@LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "Boundary") |
108 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
128 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
109 | 129 |
public character getBoundary() |
110 | 130 |
{ |
111 | 131 |
return function(MultipartFormBodyWriter.class, this, "Boundary", character.class, new Block((Body) () -> |
... | ... | |
118 | 138 |
{ |
119 | 139 |
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT") |
120 | 140 |
}) |
121 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
141 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
122 | 142 |
public void setBoundary(final character _var) |
123 | 143 |
{ |
124 | 144 |
character var = TypeFactory.initInput(_var); |
... | ... | |
130 | 150 |
} |
131 | 151 | |
132 | 152 |
@LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "Encoding") |
133 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
153 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
134 | 154 |
public character getEncoding() |
135 | 155 |
{ |
136 | 156 |
return function(MultipartFormBodyWriter.class, this, "Encoding", character.class, new Block((Body) () -> |
... | ... | |
143 | 163 |
{ |
144 | 164 |
@LegacyParameter(name = "var", type = "CHARACTER", mode = "INPUT") |
145 | 165 |
}) |
146 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
166 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
147 | 167 |
public void setEncoding(final character _var) |
148 | 168 |
{ |
149 | 169 |
character var = TypeFactory.initInput(_var); |
... | ... | |
155 | 175 |
} |
156 | 176 | |
157 | 177 |
@LegacySignature(type = Type.CONSTRUCTOR) |
158 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
178 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
159 | 179 |
public void __net_http_filter_payload_MultipartFormBodyWriter_constructor__() |
160 | 180 |
{ |
161 | 181 |
internalProcedure(MultipartFormBodyWriter.class, this, "__net_http_filter_payload_MultipartFormBodyWriter_constructor__", new Block((Body) () -> |
162 | 182 |
{ |
163 |
UnimplementedFeature.missing("MultipartFormBodyWriter CONSTRUCTOR");
|
|
164 |
//__net_http_filter_payload_MessageWriter_constructor__();
|
|
183 |
__net_http_filter_payload_MessageWriter_constructor__(ObjectOps.getLegacyClass(ByteBucket.class));
|
|
184 |
this.boundary.assign(SecurityOps.convertUniversalUIDToGlobalUID());
|
|
165 | 185 |
})); |
166 | 186 |
} |
167 | 187 | |
168 | 188 |
@LegacySignature(type = Type.METHOD, name = "Open") |
169 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
189 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
170 | 190 |
@Override |
171 | 191 |
public void open() |
172 | 192 |
{ |
173 | 193 |
internalProcedure(MultipartFormBodyWriter.class, this, "Open", new Block((Body) () -> |
174 | 194 |
{ |
175 |
UnimplementedFeature.missing("MultipartFormBodyWriter:Open METHOD"); |
|
195 |
if (!this.entity._isValid()) |
|
196 |
{ |
|
197 |
this.entity.assign(ByteBucket.instance()); |
|
198 |
} |
|
199 |
super.open(); |
|
176 | 200 |
})); |
177 | 201 |
} |
178 | 202 | |
... | ... | |
187 | 211 |
|
188 | 212 |
return function(MultipartFormBodyWriter.class, this, "Write", int64.class, new Block((Body) () -> |
189 | 213 |
{ |
190 |
UnimplementedFeature.missing("MultipartFormBodyWriter:Write METHOD"); |
|
191 |
})); |
|
192 |
} |
|
193 | ||
214 |
Assert.notNull(pData, new character("Multipart entity")); |
|
215 |
|
|
216 |
ByteBucket bucket = ObjectOps.cast(this.entity, ByteBucket.class).ref(); |
|
217 |
long init = bucket.getSize().longValue(); |
|
218 |
|
|
219 |
this.boundary.assign(pData.ref().getBoundary()); |
|
220 |
|
|
221 |
character chunk = pData.ref().getPrologue(); |
|
222 |
|
|
223 |
// prologue |
|
224 |
if (!TextOps.isEmpty(chunk)) |
|
225 |
bucket.putString(new longchar(TextOps.substitute("&1&2", chunk, CRLF))); |
|
226 | ||
227 |
for (int i = 0; i < pData.ref().getSize().intValue(); i++) |
|
228 |
{ |
|
229 |
bucket.putString(new longchar(TextOps.substitute("--&1&2", this.boundary, CRLF))); |
|
230 |
writePart(bucket, pData.ref().getPart(new integer(i + 1))); |
|
231 |
} |
|
232 |
|
|
233 |
// end data |
|
234 |
bucket.putString(new longchar(TextOps.substitute("--&1--&2", this.boundary, CRLF))); |
|
235 |
|
|
236 |
// epilogue |
|
237 |
chunk.assign(pData.ref().getEpilogue()); |
|
238 |
if (!TextOps.isEmpty(chunk)) |
|
239 |
{ |
|
240 |
bucket.putString(new longchar(chunk)); |
|
241 |
} |
|
242 |
else |
|
243 |
{ |
|
244 |
// end |
|
245 |
bucket.putString(new longchar(CRLF)); |
|
246 |
} |
|
247 |
|
|
248 |
returnNormal(new int64(bucket.getSize().longValue() - init)); |
|
249 |
})); |
|
250 |
} |
|
251 | ||
252 |
private void writePart (ByteBucket bucket, object<? extends MessagePart> part) { |
|
253 |
object<? extends ByteBucket> msgPart = ByteBucket.instance(); |
|
254 |
object<? extends MessageWriter> writer = BodyWriterBuilder.build(part) |
|
255 |
.ref().writeTo(msgPart) |
|
256 |
.ref().getWriter(); |
|
257 |
|
|
258 |
Assert.notNull(writer, new character("Part writer")); |
|
259 |
writer.ref().open(); |
|
260 |
writer.ref().write(part.ref().getBody()); |
|
261 |
writer.ref().close(); |
|
262 |
|
|
263 |
object<? extends HttpHeader>[] oHhext[] = new object[][] |
|
264 |
{ |
|
265 |
TypeFactory.objectExtent(HttpHeader.class) |
|
266 |
}; |
|
267 |
integer iRsp = TypeFactory.integer(); |
|
268 |
|
|
269 |
iRsp.assign(part.ref().getHeaders().ref().getAll(new OutputExtentParameter<object<? extends com.goldencode.p2j.oo.net.http.HttpHeader>>() |
|
270 |
{ |
|
271 |
public object<? extends com.goldencode.p2j.oo.net.http.HttpHeader>[] getVariable() |
|
272 |
{ |
|
273 |
return oHhext[0]; |
|
274 |
} |
|
275 | ||
276 |
public void setVariable(final object<? extends com.goldencode.p2j.oo.net.http.HttpHeader>[] newRef) |
|
277 |
{ |
|
278 |
oHhext[0] = newRef; |
|
279 |
} |
|
280 |
})); |
|
281 |
|
|
282 |
for (int i = oHhext[0].length; i > 0; i--) |
|
283 |
{ |
|
284 |
bucket.putString(new longchar(TextOps.substitute("&1&2", oHhext[0][i - 1].ref().toLegacyString(), CRLF))); |
|
285 |
} |
|
286 |
|
|
287 |
// end header |
|
288 |
bucket.putString(new longchar(CRLF)); |
|
289 |
|
|
290 |
bucket.putBytes(msgPart); |
|
291 |
// end part |
|
292 |
bucket.putString(new longchar(CRLF)); |
|
293 |
} |
|
294 |
|
|
194 | 295 |
@LegacySignature(returns = "INT64", type = Type.METHOD, name = "Write", parameters = |
195 | 296 |
{ |
196 | 297 |
@LegacyParameter(name = "pData", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT") |
197 | 298 |
}) |
198 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
299 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
199 | 300 |
@Override |
200 | 301 |
public int64 write(final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _pData) |
201 | 302 |
{ |
... | ... | |
203 | 304 |
|
204 | 305 |
return function(MultipartFormBodyWriter.class, this, "Write", int64.class, new Block((Body) () -> |
205 | 306 |
{ |
206 |
UnimplementedFeature.missing("MultipartFormBodyWriter:Write METHOD"); |
|
307 |
if (!pData._isValid()) |
|
308 |
{ |
|
309 |
returnNormal(write_2(ObjectOps.newInstance(LegacyMap.class))); |
|
310 |
} |
|
311 |
else if (ObjectOps.typeOf(pData, Imap.class).booleanValue()) |
|
312 |
{ |
|
313 |
returnNormal(write_2(ObjectOps.cast(pData, Imap.class))); |
|
314 |
} |
|
315 |
else if (ObjectOps.typeOf(pData, MultipartEntity.class).booleanValue()) |
|
316 |
{ |
|
317 |
returnNormal(write_1(ObjectOps.cast(pData, MultipartEntity.class))); |
|
318 |
} |
|
319 |
else |
|
320 |
{ |
|
321 |
unsupported(pData); |
|
322 |
} |
|
207 | 323 |
})); |
208 | 324 |
} |
209 | 325 | |
... | ... | |
211 | 327 |
{ |
212 | 328 |
@LegacyParameter(name = "pData", type = "OBJECT", qualified = "openedge.core.collections.imap", mode = "INPUT") |
213 | 329 |
}) |
214 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
330 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
215 | 331 |
protected int64 write_2(final object<? extends com.goldencode.p2j.oo.core.collections.Imap> _pData) |
216 | 332 |
{ |
217 | 333 |
object<? extends com.goldencode.p2j.oo.core.collections.Imap> pData = TypeFactory.initInput(_pData); |
218 | 334 |
|
219 | 335 |
return function(MultipartFormBodyWriter.class, this, "Write", int64.class, new Block((Body) () -> |
220 | 336 |
{ |
221 |
UnimplementedFeature.missing("MultipartFormBodyWriter:Write METHOD"); |
|
337 |
ByteBucket bucket = ObjectOps.cast(this.entity, ByteBucket.class).ref(); |
|
338 |
|
|
339 |
long init = bucket.getSize().longValue(); |
|
340 |
|
|
341 |
// encodings |
|
342 |
if (!TextOps.isEmpty(this.encoding)) |
|
343 |
writeField(ObjectOps.newInstance(LegacyString.class, "I", "_charset_"), ObjectOps.newInstance(LegacyString.class, "I", this.encoding)); |
|
344 |
|
|
345 |
Iiterator it = pData.ref().getEntrySet().ref().iterator().ref(); |
|
346 |
object<LegacyMapEntry> entry = TypeFactory.object(LegacyMapEntry.class); |
|
347 |
|
|
348 |
while (it.hasNext().booleanValue()) |
|
349 |
{ |
|
350 |
entry = ObjectOps.cast(it.next_(), LegacyMapEntry.class); |
|
351 |
bucket.putString(new longchar(TextOps.substitute("--&1&2", this.boundary, CRLF))); |
|
352 |
writeField(entry.ref().getKey(), entry.ref().getValue()); |
|
353 |
} |
|
354 |
|
|
355 |
// end data |
|
356 |
bucket.putString(new longchar(TextOps.substitute("--&1--&2", this.boundary, CRLF))); |
|
357 |
|
|
358 |
// end |
|
359 |
bucket.putString(new longchar(CRLF)); |
|
360 |
|
|
361 |
returnNormal(new int64(bucket.getSize().longValue() - init)); |
|
222 | 362 |
})); |
223 | 363 |
} |
224 | 364 | |
... | ... | |
227 | 367 |
@LegacyParameter(name = "pKey", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT"), |
228 | 368 |
@LegacyParameter(name = "pValue", type = "OBJECT", qualified = "progress.lang.object", mode = "INPUT") |
229 | 369 |
}) |
230 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
370 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
231 | 371 |
protected void writeField( |
232 | 372 |
final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _pKey, |
233 | 373 |
final object<? extends com.goldencode.p2j.oo.lang._BaseObject_> _pValue) |
... | ... | |
237 | 377 |
|
238 | 378 |
internalProcedure(MultipartFormBodyWriter.class, this, "WriteField", new Block((Body) () -> |
239 | 379 |
{ |
240 |
UnimplementedFeature.missing("MultipartFormBodyWriter:WriteField METHOD"); |
|
380 |
Assert.notNull(pKey, new character("Form field name")); |
|
381 |
|
|
382 |
ByteBucket bucket = ObjectOps.cast(this.entity, ByteBucket.class).ref(); |
|
383 |
character contentType = TypeFactory.character("text/plain"); |
|
384 |
|
|
385 |
object<? extends HttpHeader> hContentDispo = HttpHeaderBuilder.build(new character("Content-Disposition")) |
|
386 |
.ref().value(new character("form-data")) |
|
387 |
.ref().getHeader(); |
|
388 |
|
|
389 |
hContentDispo.ref().setParameterValue(new character("name"), TextOps.substitute("\"&1\"", pKey.ref().toLegacyString())); |
|
390 |
|
|
391 |
if (pValue._isValid()) |
|
392 |
{ |
|
393 |
if (ObjectOps.typeOf(pValue, ImemptrHolder.class).booleanValue()) |
|
394 |
{ |
|
395 |
contentType.assign("application/octet-stream"); |
|
396 |
} |
|
397 |
else if (ObjectOps.typeOf(pValue, FileInputStream.class).booleanValue()) |
|
398 |
{ |
|
399 |
object<FileInputStream> fs = ObjectOps.cast(pValue, FileInputStream.class); |
|
400 |
|
|
401 |
String fileName = new File(fs.ref().getFileName().getValue()).getName(); |
|
402 |
String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1); |
|
403 |
|
|
404 |
hContentDispo.ref().setParameterValue(new character("filename"), TextOps.substitute("\"&1\"", fileName)); |
|
405 |
|
|
406 |
contentType.assign(FileTypeRegistry.getRegistry().ref().get(new character(fileExt))); |
|
407 |
} |
|
408 |
|
|
409 |
} |
|
410 |
|
|
411 |
bucket.putString(new longchar(TextOps.substitute("&1&2", hContentDispo.ref().toLegacyString(), CRLF))); |
|
412 |
|
|
413 |
if (pValue._isValid()) |
|
414 |
{ |
|
415 |
// content-type header |
|
416 |
object<? extends HttpHeader> hContentType = HttpHeaderBuilder.build(new character("Content-Type")) |
|
417 |
.ref().value(contentType) |
|
418 |
.ref().getHeader(); |
|
419 |
bucket.putString(new longchar(TextOps.substitute("&1&2", hContentType.ref().toLegacyString(), CRLF))); |
|
420 |
|
|
421 |
// end header |
|
422 |
bucket.putString(new longchar(CRLF)); |
|
423 |
|
|
424 |
// part body |
|
425 |
object<? extends ByteBucket> msgPart = ByteBucket.instance(); |
|
426 |
object<? extends MessageWriter> writer = BodyWriterBuilder.build(contentType) |
|
427 |
.ref().writeTo(msgPart) |
|
428 |
.ref().getWriter(); |
|
429 |
|
|
430 |
Assert.notNull(writer, new character("Part writer")); |
|
431 |
writer.ref().open(); |
|
432 |
writer.ref().write(pValue); |
|
433 |
writer.ref().close(); |
|
434 |
|
|
435 |
bucket.putBytes(msgPart); |
|
436 |
} |
|
437 |
else |
|
438 |
{ |
|
439 |
// end header |
|
440 |
bucket.putString(new longchar(CRLF)); |
|
441 |
} |
|
442 |
// end part |
|
443 |
bucket.putString(new longchar(CRLF)); |
|
241 | 444 |
})); |
242 | 445 |
} |
243 | 446 |
} |
src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartFormEntityWriter.java 2021-03-31 11:09:54 +0000 | ||
---|---|---|
9 | 9 |
** |
10 | 10 |
** 002 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
11 | 11 |
** signature. |
12 |
** ME 20210331 Update support levels, WEB-CONTEXT not available. |
|
12 | 13 |
*/ |
13 | 14 | |
14 | 15 |
/* |
... | ... | |
70 | 71 |
import com.goldencode.p2j.util.BlockManager.Action; |
71 | 72 |
import com.goldencode.p2j.util.BlockManager.Condition; |
72 | 73 | |
73 |
import static com.goldencode.p2j.report.ReportConstants.CVT_LVL_FULL; |
|
74 |
import static com.goldencode.p2j.report.ReportConstants.RT_LVL_STUB; |
|
74 |
import static com.goldencode.p2j.report.ReportConstants.*; |
|
75 | 75 |
import static com.goldencode.p2j.util.BlockManager.*; |
76 | 76 |
import static com.goldencode.p2j.util.InternalEntry.Type; |
77 | 77 | |
... | ... | |
95 | 95 |
} |
96 | 96 | |
97 | 97 |
@LegacySignature(type = Type.CONSTRUCTOR) |
98 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
98 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
99 | 99 |
public void __net_http_filter_payload_MultipartFormEntityWriter_constructor__() |
100 | 100 |
{ |
101 | 101 |
internalProcedure(MultipartFormEntityWriter.class, this, "__net_http_filter_payload_MultipartFormEntityWriter_constructor__", new Block((Body) () -> |
... | ... | |
116 | 116 |
|
117 | 117 |
return function(MultipartFormEntityWriter.class, this, "Write", int64.class, new Block((Body) () -> |
118 | 118 |
{ |
119 |
UnimplementedFeature.missing("MultipartFormEntityWriter:Write METHOD"); |
|
119 |
// TODO: this needs to get data from WEB-CONTEXT handle (webspeed) |
|
120 |
returnNormal(super.write(pData)); |
|
120 | 121 |
})); |
121 | 122 |
} |
122 | 123 |
} |
src/com/goldencode/p2j/oo/net/http/filter/payload/MultipartFormSimpleEntityWriter.java 2021-03-31 09:56:13 +0000 | ||
---|---|---|
9 | 9 |
** |
10 | 10 |
** 002 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
11 | 11 |
** signature. |
12 |
** ME 20210330 Update support levels, WEB-CONTEXT not available. |
|
12 | 13 |
*/ |
13 | 14 | |
14 | 15 |
/* |
... | ... | |
70 | 71 |
import com.goldencode.p2j.util.BlockManager.Action; |
71 | 72 |
import com.goldencode.p2j.util.BlockManager.Condition; |
72 | 73 | |
73 |
import static com.goldencode.p2j.report.ReportConstants.CVT_LVL_FULL; |
|
74 |
import static com.goldencode.p2j.report.ReportConstants.RT_LVL_STUB; |
|
74 |
import static com.goldencode.p2j.report.ReportConstants.*; |
|
75 | 75 |
import static com.goldencode.p2j.util.BlockManager.*; |
76 | 76 |
import static com.goldencode.p2j.util.InternalEntry.Type; |
77 | 77 | |
... | ... | |
80 | 80 |
* in OpenEdge/Net/HTTP/Filter/Payload/MultipartFormSimpleEntityWriter.cls). |
81 | 81 |
*/ |
82 | 82 |
@LegacyResource(resource = "OpenEdge.Net.HTTP.Filter.Payload.MultipartFormSimpleEntityWriter") |
83 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
83 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_PARTIAL)
|
|
84 | 84 |
public class MultipartFormSimpleEntityWriter |
85 | 85 |
extends com.goldencode.p2j.oo.net.http.filter.payload.MultipartEntityWriter |
86 | 86 |
{ |
... | ... | |
95 | 95 |
} |
96 | 96 | |
97 | 97 |
@LegacySignature(type = Type.CONSTRUCTOR) |
98 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
98 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
99 | 99 |
public void __net_http_filter_payload_MultipartFormSimpleEntityWriter_constructor__() |
100 | 100 |
{ |
101 | 101 |
internalProcedure(MultipartFormSimpleEntityWriter.class, this, "__net_http_filter_payload_MultipartFormSimpleEntityWriter_constructor__", new Block((Body) () -> |
... | ... | |
108 | 108 |
{ |
109 | 109 |
@LegacyParameter(name = "pData", type = "MEMPTR", mode = "INPUT") |
110 | 110 |
}) |
111 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
111 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_PARTIAL)
|
|
112 | 112 |
@Override |
113 | 113 |
public int64 write(final memptr _pData) |
114 | 114 |
{ |
... | ... | |
116 | 116 |
|
117 | 117 |
return function(MultipartFormSimpleEntityWriter.class, this, "Write", int64.class, new Block((Body) () -> |
118 | 118 |
{ |
119 |
UnimplementedFeature.missing("MultipartFormSimpleEntityWriter:Write METHOD"); |
|
119 |
// TODO: implementation specific to WEBSPEED (session:client-type = 'WEBSPEED') |
|
120 |
// SessionUtil is missing client-type support |
|
121 |
// WebContext system handle not available |
|
122 |
|
|
123 |
returnNormal(super.write(pData)); |
|
120 | 124 |
})); |
121 | 125 |
} |
122 | 126 |
} |
src/com/goldencode/p2j/oo/net/http/filter/payload/StringBodyWriter.java 2021-03-25 12:03:36 +0000 | ||
---|---|---|
9 | 9 |
** 002 CA 20191024 Added method support levels and updated the class support level. |
10 | 10 |
** 003 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
11 | 11 |
** signature. |
12 |
** 004 ME 20210325 Implement/fix functionality for OE12.2. |
|
12 | 13 |
*/ |
13 | 14 | |
14 | 15 |
/* |
... | ... | |
70 | 71 |
import static com.goldencode.p2j.report.ReportConstants.*; |
71 | 72 |
import static com.goldencode.p2j.util.BlockManager.function; |
72 | 73 |
import static com.goldencode.p2j.util.BlockManager.internalProcedure; |
74 |
import static com.goldencode.p2j.util.BlockManager.onBlockLevel; |
|
73 | 75 |
import static com.goldencode.p2j.util.BlockManager.returnNormal; |
76 |
import static com.goldencode.p2j.util.BlockManager.undoThrow; |
|
74 | 77 | |
78 |
import com.goldencode.p2j.oo.common.support.IcharacterHolder; |
|
79 |
import com.goldencode.p2j.oo.common.support.IlongcharHolder; |
|
80 |
import com.goldencode.p2j.oo.common.support.ImemptrHolder; |
|
75 | 81 |
import com.goldencode.p2j.oo.core.*; |
76 | 82 |
import com.goldencode.p2j.oo.io.*; |
77 | 83 |
import com.goldencode.p2j.oo.lang.*; |
78 | 84 |
import com.goldencode.p2j.util.*; |
85 |
import com.goldencode.p2j.util.BlockManager.Action; |
|
86 |
import com.goldencode.p2j.util.BlockManager.Condition; |
|
79 | 87 |
import com.goldencode.p2j.util.InternalEntry.*; |
80 | 88 | |
81 | 89 |
/** |
... | ... | |
96 | 104 |
{ |
97 | 105 |
externalProcedure(StringBodyWriter.this, new Block((Body) () -> |
98 | 106 |
{ |
107 |
onBlockLevel(Condition.ERROR, Action.THROW); |
|
99 | 108 |
{ |
100 | 109 |
} |
101 | 110 |
})); |
... | ... | |
127 | 136 |
{ |
128 | 137 |
internalProcedure(this, "Open", new Block((Body) () -> |
129 | 138 |
{ |
130 |
if (!entity.isValid().booleanValue())
|
|
139 |
if (!entity._isValid())
|
|
131 | 140 |
{ |
132 |
entity.assign(ByteBucket.instance().ref());
|
|
141 |
entity.assign(ByteBucket.instance()); |
|
133 | 142 |
} |
143 |
|
|
144 |
super.open(); |
|
134 | 145 |
})); |
135 | 146 |
} |
136 | 147 | |
... | ... | |
175 | 186 |
{ |
176 | 187 |
longchar lc = TypeFactory.longchar(); |
177 | 188 |
new LobCopy(new SourceLob(_pData), new TargetLob(lc)).run(); |
178 |
write(lc); |
|
179 |
returnNormal(new int64(TextOps.lengthOf(lc)));
|
|
189 |
|
|
190 |
returnNormal(write(lc));
|
|
180 | 191 |
})); |
181 | 192 |
} |
182 | 193 | |
... | ... | |
199 | 210 |
return function(this, "Write", int64.class, new Block((Body) () -> |
200 | 211 |
{ |
201 | 212 |
longchar lc = TypeFactory.longchar(); |
202 |
if (!poData.isValid().booleanValue()) |
|
213 |
|