Project

General

Profile

3821c.4384i.patch

Marian Edu, 03/23/2021 07:46 AM

Download (151 KB)

View differences:

src/com/goldencode/p2j/oo/core/ByteBucket.java 2021-03-10 10:53:37 +0000
15 15
** 006 CA  20210113 Renamed clear() to clear_(), to follow NameConverter's rules.
16 16
** 007 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
17 17
**                  signature.
18
**     ME  20210310 Use object variables defined out of block for methods that returns objects.
18 19
*/
19 20

  
20 21
/*
......
460 461
   {
461 462
      int64 pos = TypeFactory.initInput(_pos);
462 463
      int64 size = TypeFactory.initInput(_size);
464
      object<? extends Memptr> ret = TypeFactory.object(Memptr.class);
463 465

  
464 466
      return function(this, "GetBytes", object.class, new Block((Body) () -> {
465 467
         if (getSize().longValue() == 0 || size.longValue() == 0)
466 468
         {
467
            returnNormal(Memptr.getEmpty());
468
         }
469

  
470
         memptr ptr = TypeFactory.memptr();
471

  
472
         try
473
         {
474
            ptr.setLength(size);
475

  
476
            readBytes(pos, ptr);
477

  
478
            returnNormal(ObjectOps.newInstance(Memptr.class, "I", ptr));
479
         }
480
         finally
481
         {
482
            if (ptr.lengthOf() > 0L)
483
               ptr.setLength(0L);
484
         }
469
            ret.assign(Memptr.getEmpty());
470
         }
471
         else
472
         {
473
            memptr ptr = TypeFactory.memptr();
474
   
475
            try
476
            {
477
               ptr.setLength(size);
478
   
479
               readBytes(pos, ptr);
480
   
481
               ret.assign(ObjectOps.newInstance(Memptr.class, "I", ptr));
482
            }
483
            finally
484
            {
485
               if (ptr.lengthOf() > 0L)
486
                  ptr.setLength(0L);
487
            }
488
         }
489
         
490
         returnNormal(ret);
485 491

  
486 492
      }));
487 493
   }
......
672 678
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
673 679
   public static object<? extends ByteBucket> instance()
674 680
   {
675
      ObjectOps.load(ByteBucket.class);
681
      object<? extends ByteBucket> bb = TypeFactory.object(ByteBucket.class);
682

  
676 683
      return function(ByteBucket.class, "Instance", object.class, new Block((Body) () -> {
677
         object<? extends ByteBucket> bb = ObjectOps.newInstance(ByteBucket.class);
684
         bb.assign(ObjectOps.newInstance(ByteBucket.class));
678 685
         bb.ref().initialize();
679 686
         returnNormal(bb);
680 687
      }));
......
693 700
   public static object<? extends ByteBucket> instance(final int64 _p1)
694 701
   {
695 702
      int64 p1 = TypeFactory.initInput(_p1);
703
      object<? extends ByteBucket> bb = TypeFactory.object(ByteBucket.class);
704
      
696 705
      return function(ByteBucket.class, "Instance", object.class, new Block((Body) () -> {
697
         object<? extends ByteBucket> bb = ObjectOps.newInstance(ByteBucket.class, "I", p1);
706
         bb.assign(ObjectOps.newInstance(ByteBucket.class, "I", p1));
698 707
         bb.ref().initialize();
699 708
         returnNormal(bb);
700 709
      }));
......
716 725
   {
717 726
      integer p1 = TypeFactory.initInput(_p1);
718 727
      int64 p2 = TypeFactory.initInput(_p2);
728
      object<? extends ByteBucket> bb = TypeFactory.object(ByteBucket.class);
729
      
719 730
      return function(ByteBucket.class, "Instance", object.class, new Block((Body) () -> {
720
         object<? extends ByteBucket> bb = ObjectOps.newInstance(ByteBucket.class, "II", p1, p2);
731
         bb.assign(ObjectOps.newInstance(ByteBucket.class, "II", p1, p2));
721 732
         bb.ref().initialize();
722 733
         returnNormal(bb);
723 734
      }));
src/com/goldencode/p2j/oo/core/util/ConfigBuilder.java 2021-03-10 11:03:54 +0000
12 12
**         20201207 Use character as map key since unknown keys are allowed in 4GL.
13 13
**                  Add new methods as of OE12.2.
14 14
** 005 CA  20210221 Added 'extent' for getOptionStringArrayValue method.
15
** 006 ME  20210310 Increment object reference on option set, decrement on remove.
16
**     ME  20210310 Return ObjectVar on getOptionObjectValue so the reference is incremented.
15 17
*/
16 18

  
17 19
/*
......
319 321
   public object<? extends _BaseObject_> getOptionObjectValue(final character _p1)
320 322
   {
321 323
      character p1 = TypeFactory.initInput(_p1);
324
      object<? extends _BaseObject_> ret = TypeFactory.object(_BaseObject_.class);
322 325
      
323 326
      return function(this, "GetOptionObjectValue", object.class, new Block((Body) () -> 
324 327
      {
325
         returnNormal(getOption(p1, object.class));
328
         ret.assign(getOption(p1, object.class));
329
         
330
         returnNormal(ret);
326 331
      }));
327 332
   }
328 333

  
......
440 445
      
441 446
      return function(this, "RemoveOption", logical.class, new Block((Body) () -> 
442 447
      {
443
         returnNormal(new logical(options.remove(key) != null));
448
         OptionValueHolder val = options.remove(key);
449
         
450
         if (val != null && val.value() != null && val.type() == "object") {
451
            object obj = (object) val.value();
452
            if (obj._isValid())
453
               ObjectOps.decrement(obj.ref());
454
         }
455
         
456
         returnNormal(new logical( val != null));
444 457
      }));
445 458
   }
446 459

  
......
601 614
      
602 615
      return function(this, "SetOption", logical.class, new Block((Body) () -> 
603 616
      {
617
         if (p2._isValid()) 
618
         {
619
            ObjectOps.increment(p2.ref());
620
         }
621
         
604 622
         returnNormal(setOption(p1, p2, object.class));
605 623
      }));
606 624
   }
src/com/goldencode/p2j/oo/json/JsonBackend.java 2021-03-19 11:12:54 +0000
9 9
 ** 002 HC  20190714 Added more serializable number types.
10 10
 ** 003 ME  20210128 Escape forward slash as in 4GL, json data type names.
11 11
 **         20210215 Extend pretty printer to match the 4GL formated output.
12
 **         20210319 Flush output stream on write, replace BigDecimal use for integer/int64.
12 13
 */
13 14

  
14 15
/*
......
159 160
         target.write("\n".getBytes(Charset.forName(enc.getJavaName())));
160 161
      }
161 162
      
163
      // make sure we write everything, do not close the stream though
164
      target.flush();
165
      
162 166
      return enc.getJavaName();
163 167
   }
164 168

  
......
217 221
      Object targetValue = null;
218 222

  
219 223
      // convert the value to json-compatible data type
220
      if (value instanceof NumberType)
221
      {
222
         targetValue = ((NumberType) value).toBigDecimal();
224
      if (value instanceof integer)
225
      {
226
         targetValue = ((integer) value).toJavaIntegerType();
227
      }
228
      else if (value instanceof int64)
229
      {
230
         targetValue = ((int64) value).toJavaLongType();
231
      }
232
      else if (value instanceof NumberType)
233
      {
234
         targetValue = ((NumberType) value).toBigDecimal().stripTrailingZeros();
223 235
      }
224 236
      else if (value instanceof Text)
225 237
      {
......
400 412
      }
401 413
      else if (value instanceof BigDecimal)
402 414
      {
403
         jsonGen.writeNumber((BigDecimal) value);
415
         BigDecimal bd = (BigDecimal) value;
416
         
417
         if (bd.scale() == 0) 
418
         {
419
            jsonGen.writeNumber(bd.doubleValue());
420
         }
421
         else 
422
         {
423
            jsonGen.writeNumber(bd);
424
         }
404 425
      }
405 426
      else if (value instanceof String)
406 427
      {
src/com/goldencode/p2j/oo/json/objectmodel/JsonArray.java 2021-03-23 11:42:56 +0000
17 17
** 009 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
18 18
**                  signature.
19 19
**     CA  20210304 Fixed date, datetime and datetimetz literal parsing. 
20
**     ME  20210319 Fix remove, serialization,error on stream not found.
20 21
*/
21 22

  
22 23
/*
......
1718 1719
         {
1719 1720
            addSetElementImpl(pos, val.isUnknown() ? (Object) null : Double.parseDouble(val.getValue()), true);
1720 1721
         }
1721
         catch (Exception e)
1722
         catch (NumberFormatException e)
1722 1723
         {
1723 1724
            undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("value", this,
1724 1725
                     "AddNumber", "Not a valid JSON number."), 16053));
......
2573 2574
      
2574 2575
      return function(this, "Remove", logical.class, new Block((Body) () ->
2575 2576
      {
2576
         int pos = idx == null || idx.isUnknown() ? -1 : idx.intValue();
2577
         int pos = idx == null || idx.isUnknown() ? -1 : idx.intValue() - 1;
2577 2578
         int cnt = count == null || count.isUnknown() ? -1 : count.intValue();
2578 2579

  
2579
         if (pos < 1 || pos > elements.size())
2580
         if (pos < 0 || pos >= elements.size())
2580 2581
         {
2581 2582
            undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("index", this,
2582 2583
                     "Remove",
......
2594 2595
         
2595 2596
         for (int i = 0; i < cnt; i++)
2596 2597
         {
2597
            Object o = elements.remove(pos - 1);
2598
            Object o = elements.remove(pos);
2598 2599
            if (o instanceof JsonConstruct)
2599 2600
            {
2600 2601
               ObjectOps.decrement((_BaseObject_) o);
......
3254 3255
    *
3255 3256
    * @param   idx
3256 3257
    *          The 1-based index of the json array element to retrieve.
3258
    * @param   method
3259
    *          The actual 'get' method name, used for error message.
3260
    * @param   type
3261
    *          The expected JSON type.
3257 3262
    * @param   converter
3258 3263
    *          The function that will convert the stored Java element instance to a legacy instance.
3259 3264
    * @param   nullSupplier
......
3286 3291
                  method, JsonBackend.instance().getJsonDataTypeName(type), JsonBackend.instance().getJsonDataTypeName(vtype)), 16060));
3287 3292
      }
3288 3293

  
3289
      BaseDataType res = converter.apply(val);
3294
      BaseDataType res = null;
3295
      try
3296
      {
3297
         res = converter.apply(val);
3298
      }
3299
      catch(Exception ex)
3300
      {
3301
         log.log(Level.WARNING, "", ex);
3302
         returnError(ObjectOps.newInstance(JsonError.class));
3303
      }
3290 3304

  
3291 3305
      returnNormal(res);
3292 3306
   }
......
3372 3386
      logical omit = TypeFactory.initInput(_omit);
3373 3387
      
3374 3388
      return function(this, "Read", logical.class, new Block((Body) () -> {
3375
         logical ret = TypeFactory.logical();
3376
         
3377 3389
         if (!htt._isValid() || !htt.isType("TEMP-TABLE")) 
3378 3390
         {
3379 3391
            undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("temp-table handle", this,
......
3390 3402
         JsonExport export = new JsonExport();
3391 3403
         try
3392 3404
         {
3393
            export.serializeTempTable(jb, tmpBuffer, !omit.isUnknown() && omit.booleanValue());
3394
            ret.assign(true);
3405
            export.serializeTempTable(jb, tmpBuffer, true, !omit.isUnknown() && omit.booleanValue());
3406
            returnNormal(true);
3395 3407
         }
3396
         catch (Exception e)
3408
         catch (IOException e)
3397 3409
         {
3398 3410
            log.log(Level.WARNING, "", e);
3399 3411
            returnError(ObjectOps.newInstance(JsonError.class));
3400 3412
         }
3401
         
3402
         returnNormal(ret);
3403 3413
      }));
3404 3414
   }
3415
   
3416
   @Override
3417
   protected void throwStreamNotFound (String streamName) {
3418
      undoThrow(JsonError.newInstance(String.format("Invalid stream parameter to Progress.Json.ObjectModel.JsonArray:WriteStream( ). Could not find open stream \"%s\".", streamName), 16062));
3419
   }
3405 3420
}
3406 3421

  
src/com/goldencode/p2j/oo/json/objectmodel/JsonConstruct.java 2021-03-19 11:24:54 +0000
25 25
**         20210215 Remove clean/read methods, refactor write.
26 26
** 012 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
27 27
**                  signature.
28
**     ME  20210319 Fix write stream, add method to throw stream not found exception.
28 29
*/
29 30

  
30 31
/*
......
204 205
   {
205 206
      handle strHndl = TypeFactory.initInput(_strHndl);
206 207
      logical fmtted = TypeFactory.initInput(_fmtted);
207
      character enc  = TypeFactory.initInput(_enc);
208
      character enc = TypeFactory.initInput(_enc);
208 209

  
209
      return function(this, "Write", logical.class, new Block((Body) () ->
210
      {
211
         Stream stream = (Stream) strHndl.getResource();
212
         OutputStream o = new OutputStreamWrapper(stream);
210
      return function(this, "Write", logical.class, new Block((Body) () -> {
211
         
212
         if (!strHndl._isValid() || !(strHndl.get() instanceof Stream))
213
         {
214
            ErrorManager.recordOrThrowError(new int[] { 14263, 15351 },
215
                     new String[] { 
216
                              "Invalid handle or handle type for STREAM-HANDLE",
217
                              "WRITE-JSON( ) could not find the specified stream-handle." },
218
                     false, false, false);
219
         }
220
         
221
         OutputStream o = new OutputStreamWrapper(strHndl.unwrapStream());
213 222
         logical ret = TypeFactory.logical();
214
         
215
         try {
223

  
224
         try
225
         {
216 226
            writeImpl(o, fmtted, enc);
217 227
            ret.assign(true);
218 228
         }
219 229
         catch (Exception e)
220 230
         {
221 231
            returnError(JsonError.newInstance(e.getMessage(), 0));
222
         } 
232
         }
223 233
         returnNormal(ret);
224 234
      }));
225 235
   }
......
637 647

  
638 648
      return function(this, "WriteStream", logical.class, new Block((Body) () ->
639 649
      {
640
         logical ret = TypeFactory.logical();
650
         
641 651
         Stream s = StreamFactory.findOutputStream(sname.isUnknown() ? null : sname.toStringMessage());
642 652
         if (s != null)
643 653
         {
654
            logical ret = TypeFactory.logical();
644 655
            boolean pretty = fmtted != null && !fmtted.isUnknown() && fmtted.booleanValue();
645 656
            OutputStream o = new OutputStreamWrapper(s);
646 657

  
......
653 664
            }
654 665
            catch (Exception e)
655 666
            {
656
               log.log(Level.WARNING, "", e);
657
               returnError(ObjectOps.newInstance(JsonError.class));
667
               returnError(JsonError.newInstance(e.getMessage(), 0));
658 668
            }
659
         }
660
         
661
         returnNormal(ret);
669
            
670
            returnNormal(ret);
671
         }
672
         else 
673
         {
674
            throwStreamNotFound(sname.toStringMessage());
675
         }
676
        
662 677
      }));
663 678
   }
679
   
680
   /**
681
    * Throw stream not found exception. 
682
    * 
683
    * The error number and message is different for JsonArray/JsonObject.
684
    * 
685
    * @param streamName
686
    */
687
   protected void throwStreamNotFound (String streamName) {
688
      undoThrow(SysError.newInstance(String.format("WRITE-JSON( ) could not find open stream \"%s\"", streamName), 15343, false, true));
689
   }
664 690

  
665 691
   /**
666 692
    * Adds a json element (object property or array element) to the json object.
src/com/goldencode/p2j/oo/json/objectmodel/JsonObject.java 2021-03-23 11:42:56 +0000
20 20
** 011 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
21 21
**                  signature.
22 22
**     CA  20210304 Fixed date, datetime and datetimetz literal parsing. 
23
** 012 ME  20210319 Fix error handling, implement missing methods (OE12.2).
24
**     ME  20210323 Format error message when buffer isn't from a temp-table.
23 25
*/
24 26

  
25 27
/*
......
82 84
import com.goldencode.p2j.persist.*;
83 85
import com.goldencode.p2j.persist.serial.*;
84 86
import com.goldencode.p2j.util.*;
87
import com.goldencode.p2j.util.ErrorManager;
85 88
import com.goldencode.p2j.util.BlockManager.Action;
86 89
import com.goldencode.p2j.util.BlockManager.Condition;
87 90

  
88 91
import java.io.*;
89
import java.time.format.*;
90 92
import java.util.*;
91 93
import java.util.function.*;
92 94
import java.util.logging.*;
95
import java.util.stream.Collectors;
93 96

  
94 97
import static com.goldencode.p2j.util.BlockManager.*;
95 98
import static com.goldencode.p2j.report.ReportConstants.*;
......
444 447
      
445 448
      return function(this, "AddNull", logical.class, new Block((Body) () ->
446 449
      {
447
         addPropertyImpl(prop, null);
450
         addPropertyImpl(prop, null, "AddNull");
448 451
      }));
449 452
   }
450 453

  
......
461 464
      
462 465
      return function(this, "AddNumber", logical.class, new Block((Body) () ->
463 466
      {
467
         checkPropNotExists(prop, "AddNumber");
468
         
464 469
         try
465 470
         {
466
            addPropertyImpl(prop, new decimal(val));
471
            addPropertyImpl(prop.toStringMessage(), val.isUnknown() ? (Object) null : Double.parseDouble(val.getValue()));
467 472
         }
468 473
         catch (NumberFormatException e)
469 474
         {
470
            returnError(ObjectOps.newInstance(JsonError.class));
475
            undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("value", this,
476
                     "AddNumber", "Not a valid JSON number."), 16053));
471 477
         }
472 478
      }));
473 479
   }
......
505 511
      
506 512
      return function(this, "GetCharacter", character.class, new Block((Body) () ->
507 513
      {
508
         getPropertyImpl(prop, o -> new character((String) o), character::new);
514
         getPropertyImpl(prop, "GetCharacter", 1, o -> new character((String) o), unknown::new);
509 515
      }));
510 516
   }
511 517

  
......
520 526
      
521 527
      return function(this, "GetCOMHandle", comhandle.class, new Block((Body) () ->
522 528
      {
523
         getPropertyImpl(prop, o -> comhandle.fromResourceId(((Number) o).longValue()), comhandle::new);
529
         getPropertyImpl(prop, "GetCOMHandle", 2, o -> comhandle.fromResourceId(((Number) o).longValue()), comhandle::new);
524 530
      }));
525 531
   }
526 532

  
......
535 541
      
536 542
      return function(this, "GetDate", date.class, new Block((Body) () ->
537 543
      {
538
         getPropertyImpl(prop, o -> date.parseLiteral((String) o), date::new);
544
         getPropertyImpl(prop, "GetDate", 1, o -> date.parseLiteral((String) o), date::new);
539 545
      }));
540 546
   }
541 547

  
......
550 556
      
551 557
      return function(this, "GetDatetime", datetime.class, new Block((Body) () ->
552 558
      {
553
         getPropertyImpl(prop, o-> datetime.parseLiteral((String) o), datetime::new);
559
         getPropertyImpl(prop, "GetDatetime", 1, o-> datetime.parseLiteral((String) o), datetime::new);
554 560
      }));
555 561
   }
556 562

  
......
565 571
      
566 572
      return function(this, "GetDatetimeTZ", datetimetz.class, new Block((Body) () ->
567 573
      {
568
         getPropertyImpl(prop, o -> datetimetz.parseLiteral((String) o), datetimetz::new);
574
         getPropertyImpl(prop, "GetDatetimeTZ", 1, o -> datetimetz.parseLiteral((String) o), datetimetz::new);
569 575
      }));
570 576
   }
571 577

  
......
580 586
      
581 587
      return function(this, "GetDecimal", decimal.class, new Block((Body) () ->
582 588
      {
583
         getPropertyImpl(prop, o -> new decimal((Number) o), decimal::new);
589
         getPropertyImpl(prop, "GetDecimal", 2, o -> new decimal((Number) o), decimal::new);
584 590
      }));
585 591
   }
586 592

  
......
595 601
      
596 602
      return function(this, "GetHandle", handle.class, new Block((Body) () ->
597 603
      {
598
         getPropertyImpl(prop, o -> handle.fromResourceId(((Number) o).longValue()), handle::new);
604
         getPropertyImpl(prop, "GetHandle", 2, o -> handle.fromResourceId(((Number) o).longValue()), handle::new);
599 605
      }));
600 606
   }
601 607

  
......
610 616
      
611 617
      return function(this, "GetInt64", int64.class, new Block((Body) () ->
612 618
      {
613
         getPropertyImpl(prop, o -> new int64((Number) o), int64::new);
619
         getPropertyImpl(prop, "GetInt64", 2, o -> new int64((Number) o), int64::new);
614 620
      }));
615 621
   }
616 622

  
......
625 631
      
626 632
      return function(this, "GetInteger", integer.class, new Block((Body) () ->
627 633
      {
628
         getPropertyImpl(prop, o -> new integer((Number) o), integer::new);
634
         getPropertyImpl(prop, "GetInteger", 2, o -> new integer((Number) o), integer::new);
629 635
      }));
630 636
   }
631 637

  
......
640 646
      
641 647
      return function(this, "GetJsonArray", object.class, new Block((Body) () ->
642 648
      {
643
         getPropertyImpl(prop, o -> new object((JsonArray) o), object::new);
649
         getPropertyImpl(prop, "GetJsonArray", 5, o -> new object((JsonArray) o), object::new);
644 650
      }));
645 651
   }
646 652

  
......
655 661
      
656 662
      return function(this, "GetJsonObject", object.class, new Block((Body) () ->
657 663
      {
658
         getPropertyImpl(prop, o -> new object((JsonObject) o), object::new);
664
         getPropertyImpl(prop, "GetJsonObject", 4, o -> new object((JsonObject) o), object::new);
659 665
      }));
660 666
   }
661 667

  
......
680 686
      
681 687
      return function(this, "GetJsonText", longchar.class, new Block((Body) () ->
682 688
      {
683
         getPropertyImpl(prop, o ->
684
         {
685
            try
686
            {
687
               return getJsonText(o);
688
            }
689
            catch (IOException e)
690
            {
691
               throw new RuntimeException(e);
692
            }
693
         },
694
            longchar::new);
689
         checkPropExists(prop, "GetJsonText");
690
         
691
         try
692
         {
693
            returnNormal(getJsonText(properties.get(prop.toStringMessage())));
694
         }
695
         catch (IOException e)
696
         {
697
            log.log(Level.WARNING, "", e);
698
            returnError(ObjectOps.newInstance(JsonError.class));
699
         }
695 700
      }));
696 701
   }
697 702

  
......
706 711
      
707 712
      return function(this, "GetLogical", logical.class, new Block((Body) () ->
708 713
      {
709
         getPropertyImpl(prop, o -> new logical((Boolean) o), logical::new);
714
         getPropertyImpl(prop, "GetLogical", 3, o -> new logical((Boolean) o), logical::new);
710 715
      }));
711 716
   }
712 717

  
......
721 726
      
722 727
      return function(this, "GetLongchar", longchar.class, new Block((Body) () ->
723 728
      {
724
         getPropertyImpl(prop, o -> new longchar((String) o), longchar::new);
729
         getPropertyImpl(prop, "GetLongchar", 1, o -> new longchar((String) o), longchar::new);
725 730
      }));
726 731
   }
727 732

  
......
738 743
      
739 744
      return function(this, "GetLongchar", longchar.class, new Block((Body) () ->
740 745
      {
741
         getPropertyImpl(prop, o ->
746
         getPropertyImpl(prop, "GetLongchar", 1, o ->
742 747
         {
743
            longchar res = new longchar((String) o);
744
            res.fixCodePage(cp);
748
            longchar res = TypeFactory.longchar();
749
            if (!TextOps.isEmpty(cp))
750
               res.fixCodePage(cp);
751
            res.assign(o);
752
            
745 753
            return res;
746 754
         },
747 755
            longchar::new);
......
759 767
      
760 768
      return function(this, "GetMemptr", memptr.class, new Block((Body) () ->
761 769
      {
762
         getPropertyImpl(prop, o -> new memptr(Base64.getDecoder().decode((String) o)), memptr::new);
770
         getPropertyImpl(prop, "GetMemptr", 1, o -> new memptr(Base64.getDecoder().decode((String) o)), unknown::new);
763 771
      }));
764 772
   }
765 773

  
......
769 777
   {
770 778
      return extentFunction(this, "GetNames", character.class, new Block((Body) () ->
771 779
      {
772
         Set<String> nameSet = properties.keySet();
773
         character[] names = nameSet.toArray(new character[0]);
774
         returnExtentNormal(names);
780
         List<character> names = properties.keySet().stream().map(character::new).collect(Collectors.toList());
781
         returnExtentNormal(names.toArray(new character[names.size()]));
775 782
      }));
776 783
   }
777 784

  
......
786 793
      
787 794
      return function(this, "GetRaw", raw.class, new Block((Body) () ->
788 795
      {
789
         getPropertyImpl(prop,
796
         getPropertyImpl(prop, "GetRaw", 1,
790 797
                         o -> new raw(Base64.getDecoder().decode((String) o)), raw::instantiateUnknownRaw);
791 798
      }));
792 799
   }
......
802 809
      
803 810
      return function(this, "GetRecid", recid.class, new Block((Body) () ->
804 811
      {
805
         getPropertyImpl(prop, o -> new recid(((Number) o).longValue()), recid::new);
812
         getPropertyImpl(prop, "GetRecid", 2, o -> new recid(((Number) o).longValue()), recid::new);
806 813
      }));
807 814
   }
808 815

  
......
817 824
      
818 825
      return function(this, "GetRowid", rowid.class, new Block((Body) () ->
819 826
      {
820
         getPropertyImpl(prop, o ->
827
         getPropertyImpl(prop, "GetRowid", 1, o ->
821 828
         {
822 829
            Base64.Decoder dec = Base64.getDecoder();
823 830
            return new rowid(Utils.bytesToLongLE(dec.decode((String) o)));
......
837 844
      
838 845
      return function(this, "GetType", integer.class, new Block((Body) () ->
839 846
      {
840
         if (checkValidPropName(prop))
841
         {
842
            Object value = properties.get(prop.toStringMessage());
843
            returnNormal(new integer(JsonBackend.instance().getJsonDataType(value)));
844
         }
845
         else
846
         {
847
            returnError(ObjectOps.newInstance(JsonError.class));
848
         }
847
         checkPropExists(prop, "GetType");
848
         
849
         Object value = properties.get(prop.toStringMessage());
850
         returnNormal(new integer(JsonBackend.instance().getJsonDataType(value)));
849 851
      }));
850 852
   }
851 853

  
......
860 862
      
861 863
      return function(this, "Has", logical.class, new Block((Body) () ->
862 864
      {
863
         if (checkValidPropName(prop))
864
         {
865
            returnNormal(new logical(properties.containsKey(prop.toStringMessage())));
866
         }
867
         else
868
         {
869
            returnError(ObjectOps.newInstance(JsonError.class));
870
         }
865
         checkValidPropName(prop, "Has");
866
         returnNormal(new logical(properties.containsKey(prop.toStringMessage())));
871 867
      }));
872 868
   }
873 869

  
......
882 878
      
883 879
      return function(this, "IsNull", logical.class, new Block((Body) () ->
884 880
      {
885
         if (checkValidPropName(prop))
886
         {
887
            if (!properties.containsKey(prop.toStringMessage()))
888
            {
889
               returnError(ObjectOps.newInstance(JsonError.class));
890
            }
891
            else
892
            {
893
               Object val = properties.get(prop.toStringMessage());
894
               returnNormal(new logical(val == null));
895
            }
896
         }
897
         else
898
         {
899
            returnError(ObjectOps.newInstance(JsonError.class));
900
         }
881
         checkPropExists(prop, "IsNull");
882
         
883
         Object val = properties.get(prop.toStringMessage());
884
         returnNormal(new logical(val == null));
901 885
      }));
902 886
   }
903 887

  
......
935 919
      logical omit = TypeFactory.initInput(_omit);
936 920
      logical b4img = TypeFactory.initInput(_b4img);
937 921
           
938
      return function(this, "Read", logical.class, new Block((Init) () ->
922
      return function(this, "Read", logical.class, new Block((Body) () ->
939 923
      {
940 924
         if (!bh.isUnknown())
941 925
         {
......
943 927
            if (res instanceof BufferImpl)
944 928
            {
945 929
               BufferImpl buf = (BufferImpl) res;
946
               TemporaryBuffer tb = (TemporaryBuffer) buf.buffer();
947
               returnNormal(readImpl(tb, omit));
930
               returnNormal(readImpl(buf, omit));
948 931
            }
949 932
            else if (res instanceof TempTable)
950 933
            {
......
957 940
               DataSet ds = (DataSet) res;
958 941
               returnNormal(readImpl(ds, omit, b4img));
959 942
            }
960
            else
961
            {
962
               returnError(ObjectOps.newInstance(JsonError.class));
963
            }
964
         }
965
         else
966
         {
967
            returnError(ObjectOps.newInstance(JsonError.class));
968
         }
943
         }
944
         
945
         undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("handle", this,
946
                  "Read", "Not initialized or not a handle to a temp-table/dataset/buffer."), 16070));
969 947
      }));
970 948
   }
971 949

  
......
980 958
      
981 959
      return function(this, "Remove", logical.class, new Block((Body) () ->
982 960
      {
983
         if (checkPropExists(prop))
984
         {
985
            Object o = properties.remove(prop.toStringMessage());
986
            if (o instanceof JsonConstruct)
987
            {
988
               ObjectOps.decrement((_BaseObject_) o);
989
            }
990
            returnNormal(new logical(true));
991
         }
992
         else
993
         {
994
            returnError(ObjectOps.newInstance(JsonError.class));
995
         }
961
         checkPropExists(prop, "Remove");
962
         
963
         Object o = properties.remove(prop.toStringMessage());
964
         if (o instanceof JsonConstruct)
965
         {
966
            ObjectOps.decrement((_BaseObject_) o);
967
         }
968
         returnNormal(new logical(true));
996 969
      }));
997 970
   }
998 971

  
......
1296 1269
      
1297 1270
      return function(this, "SetNull", logical.class, new Block((Body) () ->
1298 1271
      {
1299
         setPropertyImpl(prop, null);
1272
         setPropertyImpl(prop, null, "SetNull");
1300 1273
      }));
1301 1274
   }
1302 1275

  
......
1313 1286
      
1314 1287
      return function(this, "SetNumber", logical.class, new Block((Body) () ->
1315 1288
      {
1289
         checkPropExists(prop, "SetNumber");
1290
         
1316 1291
         try
1317 1292
         {
1318
            setPropertyImpl(prop, new decimal(val));
1293
            addPropertyImpl(prop.toStringMessage(), val.isUnknown() ? (Object) null : Double.parseDouble(val.getValue()));
1319 1294
         }
1320 1295
         catch (NumberFormatException e)
1321 1296
         {
1322
            returnError(ObjectOps.newInstance(JsonError.class));
1297
            undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("value", this,
1298
                     "SetNumber", "Not a valid JSON number."), 16053));
1323 1299
         }
1324 1300
      }));
1325 1301
   }
......
1440 1416
    */
1441 1417
   private void addPropertyImpl(character name, BaseDataType value)
1442 1418
   {
1443
      if (checkValidPropName(name))
1419
      addPropertyImpl(name, value, "Add");
1420
   }
1421
   
1422
   /**
1423
    * Implements the {@code add} legacy methods for adding json property to this instance.
1424
    *
1425
    * @param   name
1426
    *          Property name.
1427
    * @param   value
1428
    *          Property value.
1429
    * @param   method
1430
    *          Calling method name, used for error message.
1431
    */
1432
   private void addPropertyImpl(character name, BaseDataType value, String method)
1433
   {
1434
      checkPropNotExists(name, method);
1435
      
1436
      try
1444 1437
      {
1445
         try
1446
         {
1447
            Object newValue = JsonBackend.instance().convertLegacyValueToJson(value);
1448
            addPropertyImpl(name.toStringMessage(), newValue);
1449
            returnNormal(new logical(true));
1450
         }
1451
         catch (ClassCastException e)
1452
         {
1453
            returnError(ObjectOps.newInstance(JsonError.class));
1454
         }
1438
         Object newValue = value != null ? JsonBackend.instance().convertLegacyValueToJson(value) : null;
1439
         addPropertyImpl(name.toStringMessage(), newValue);
1440
         returnNormal(new logical(true));
1455 1441
      }
1456
      else
1442
      catch (ClassCastException e)
1457 1443
      {
1458 1444
         returnError(ObjectOps.newInstance(JsonError.class));
1459 1445
      }
......
1469 1455
    */
1470 1456
   private void setPropertyImpl(character name, BaseDataType value)
1471 1457
   {
1472
      if (checkPropExists(name))
1458
      setPropertyImpl(name, value, "Set");
1459
   }
1460
   
1461
   /**
1462
    * Implements the {@code set} legacy methods for setting json property in this instance.
1463
    *
1464
    * @param   name
1465
    *          Property name.
1466
    * @param   value
1467
    *          Property value.
1468
    */
1469
   private void setPropertyImpl(character name, BaseDataType value, String method)
1470
   {
1471
      checkPropExists(name, method);
1472
      
1473
      try
1473 1474
      {
1474
         try
1475
         {
1476
            Object newValue = JsonBackend.instance().convertLegacyValueToJson(value);
1477
            addPropertyImpl(name.toStringMessage(), newValue);
1478
            returnNormal(new logical(true));
1479
         }
1480
         catch (ClassCastException e)
1481
         {
1482
            returnError(ObjectOps.newInstance(JsonError.class));
1483
         }
1475
         Object newValue = value != null ? JsonBackend.instance().convertLegacyValueToJson(value) : null;
1476
         addPropertyImpl(name.toStringMessage(), newValue);
1477
         returnNormal(new logical(true));
1484 1478
      }
1485
      else
1479
      catch (ClassCastException e)
1486 1480
      {
1487 1481
         returnError(ObjectOps.newInstance(JsonError.class));
1488 1482
      }
......
1493 1487
    *
1494 1488
    * @param   property
1495 1489
    *          Property name.
1496
    *
1490
    * @param   method
1491
    *          Calling method name, used for error message.
1492
    *          
1497 1493
    * @return  {@code true} when the property name is valid, {@code false} otherwise.
1498 1494
    */
1499
   private boolean checkValidPropName(character property)
1495
   private void checkValidPropName(character property, String method)
1500 1496
   {
1501
      return property != null && !property.isUnknown() && !property.toStringMessage().isEmpty();
1497
      if (TextOps.isEmpty(property))
1498
      {
1499
         undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("name", this,
1500
                  method, "Can not be UNKNOWN (?) or empty string."), 16055));
1501
      }
1502 1502
   }
1503 1503

  
1504 1504
   /**
......
1506 1506
    *
1507 1507
    * @param   property
1508 1508
    *          Property name.
1509
    * @param   method
1510
    *          Calling method name, used for error message.
1509 1511
    *
1510 1512
    * @return  {@code true} when the property name is valid, {@code false} otherwise.
1511 1513
    */
1512
   private boolean checkPropExists(character property)
1514
   private void checkPropExists(character property, String method)
1513 1515
   {
1514
      return checkValidPropName(property) && properties.containsKey(property.toStringMessage());
1516
      checkValidPropName(property, method);
1517
      
1518
      String key = property.toStringMessage();
1519
      
1520
      if (!properties.containsKey(key))
1521
      {
1522
         undoThrow(JsonError.newInstance(String.format("Call to Progress.Json.ObjectModel.JsonObject:%s( ) failed. Property '%s' was not found.", 
1523
                  method, key), 16058));
1524
      }
1515 1525
   }
1516 1526

  
1517 1527
   /**
1528
    * Checks whether the supplied value is valid json property name and whether the property not exists.
1529
    *
1530
    * @param   property
1531
    *          Property name.
1532
    * @param   method
1533
    *          Calling method name, used for error message.
1534
    *
1535
    * @return  {@code true} when the property name is valid, {@code false} otherwise.
1536
    */
1537
   private void checkPropNotExists(character property, String method)
1538
   {
1539
      checkValidPropName(property, method);
1540
      
1541
      String key = property.toStringMessage();
1542
      
1543
      if (properties.containsKey(key))
1544
      {
1545
         undoThrow(JsonError.newInstance(String.format("Call to Progress.Json.ObjectModel.JsonObject:%s( ) failed. Attempted to add duplicate property '%s'.", 
1546
                  method, key), 16056));
1547
      }
1548
   }
1549
   
1550
   /**
1518 1551
    * Implements the {@code get} legacy methods.
1519 1552
    *
1520 1553
    * @param   propName
1521 1554
    *          Property name.
1555
    * @param   method
1556
    *          The actual 'get' method name, used for error message.
1557
    * @param   type
1558
    *          The expected JSON type.
1522 1559
    * @param   converter
1523 1560
    *          The function that will convert the stored Java value instance to a legacy instance.
1524 1561
    * @param   nullSupplier
......
1526 1563
    *          corresponding legacy value.
1527 1564
    */
1528 1565
   private void getPropertyImpl(character propName,
1566
                                String method, 
1567
                                int type,
1529 1568
                                Function<Object, BaseDataType> converter,
1530 1569
                                Supplier<BaseDataType> nullSupplier)
1531 1570
   {
1532
      if (checkPropExists(propName))
1533
      {
1534
         Object val = properties.get(propName.toStringMessage());
1535

  
1536
         BaseDataType res = null;
1537
         try
1538
         {
1539
            if (val == null)
1540
            {
1541
               res = nullSupplier.get();
1542
            }
1543
            else
1544
            {
1545
               res = converter.apply(val);
1546
            }
1547
         }
1548
         catch(ClassCastException | DateTimeParseException ex)
1549
         {
1550
            log.log(Level.WARNING, "", ex);
1551
            // the value is not the expected type or has incorrect format
1552
            returnError(ObjectOps.newInstance(JsonError.class));
1553
         }
1554
         catch(RuntimeException ex)
1555
         {
1556
            log.log(Level.WARNING, "", ex);
1557
            returnError(ObjectOps.newInstance(JsonError.class));
1558
         }
1559

  
1560
         if (res != null)
1561
         {
1562
            returnNormal(res);
1563
         }
1564
      }
1565
      else
1566
      {
1571
      checkPropExists(propName, method);
1572
      
1573
      Object val = properties.get(propName.toStringMessage());
1574
      int vtype = JsonBackend.instance().getJsonDataType(val);
1575
      
1576
      if (vtype == 6)
1577
         returnNormal(nullSupplier.get());
1578
      
1579
      if (vtype != type)
1580
      {
1581
         undoThrow(JsonError.newInstance(String.format("Call to Progress.Json.ObjectModel.JsonObject:%s( ) failed. Expected a JSON %s value, found a JSON %s value.", 
1582
                  method, JsonBackend.instance().getJsonDataTypeName(type), JsonBackend.instance().getJsonDataTypeName(vtype)), 16060));
1583
      }
1584
      
1585
      BaseDataType res = null;
1586
      
1587
      try
1588
      {
1589
         if (val == null)
1590
         {
1591
            res = nullSupplier.get();
1592
         }
1593
         else
1594
         {
1595
            res = converter.apply(val);
1596
         }
1597
      }
1598
      catch(Exception ex)
1599
      {
1600
         log.log(Level.WARNING, "", ex);
1567 1601
         returnError(ObjectOps.newInstance(JsonError.class));
1568 1602
      }
1603
      returnNormal(res);
1569 1604
   }
1570 1605
   
1571 1606
   protected logical readImpl(TemporaryBuffer tb, final logical omit)
......
1574 1609
         ObjectBuilder jb = new ObjectBuilder(this);
1575 1610
         JsonExport export = new JsonExport();
1576 1611

  
1577
         try
1578
         {
1579
            export.exportTempBuffer(tb, omit, new logical(false), jb);
1580
            returnNormal(new logical(true));
1581
         }
1582
         catch (PersistenceException e)
1612
         this.clear();
1613
         
1614
         try
1615
         {
1616
            export.serializeTempTable(jb, tb, false, !omit.isUnknown() && omit.booleanValue());
1617
            returnNormal(new logical(true));
1618
         }
1619
         catch (IOException e)
1620
         {
1621
            log.log(Level.WARNING, "", e);
1622
            returnError(ObjectOps.newInstance(JsonError.class));
1623
         }
1624
      }));
1625
   }
1626
   
1627
   protected logical readImpl(BufferImpl buffer, final logical omit)
1628
   {
1629
      return function(this, "Read", logical.class, new Block((Body) () -> {
1630
         
1631
         if (!buffer._available())
1632
         {
1633
            undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("buffer-handle", this,
1634
                     "Read", "No record in buffer."), 16065));
1635
         }
1636
         
1637
         if (!buffer.buffer().isTemporary())
1638
         {
1639
            ErrorManager.recordOrThrowError(15378, "JSON methods are only allowed on TEMP-TABLE buffers", false, false);
1640
         }
1641
         
1642
         ObjectBuilder jb = new ObjectBuilder(this);
1643
         JsonExport export = new JsonExport();
1644

  
1645
         this.clear();
1646
         
1647
         try
1648
         {
1649
            export.serializeRecord(jb, (TemporaryBuffer) buffer.buffer(), !omit.isUnknown() && omit.booleanValue());
1650
            returnNormal(new logical(true));
1651
         }
1652
         catch (IOException e)
1583 1653
         {
1584 1654
            log.log(Level.WARNING, "", e);
1585 1655
            returnError(ObjectOps.newInstance(JsonError.class));
......
1593 1663
         ObjectBuilder jb = new ObjectBuilder(this);
1594 1664
         JsonExport export = new JsonExport();
1595 1665

  
1666
         this.clear();
1667
         
1596 1668
         try
1597 1669
         {
1598
            export.exportDataSet(pds, false, 
1670
            export.serializeDataSet(jb, pds, 
1599 1671
                     !omit.isUnknown() && omit.booleanValue(), 
1600
                     !b4img.isUnknown() && b4img.booleanValue(), 
1601
                     jb);
1672
                     false,
1673
                     !b4img.isUnknown() && b4img.booleanValue());
1602 1674
            
1603 1675
            returnNormal(new logical(true));
1604 1676
         }
1605
         catch (PersistenceException e)
1677
         catch (IOException e)
1606 1678
         {
1607 1679
            log.log(Level.WARNING, "", e);
1608 1680
            returnError(ObjectOps.newInstance(JsonError.class));
src/com/goldencode/p2j/oo/net/http/DefaultRequestBuilder.java 2021-03-11 08:18:20 +0000
133 133
   @Override
134 134
   public object<? extends IhttpRequest> getRequest()
135 135
   {
136
      return function(this, "Request", object.class, new Block((Body) () -> 
137
      {
138
        object<? extends IhttpRequest> request = TypeFactory.object(IhttpRequest.class);
139
         
136
      object<? extends IhttpRequest> request = TypeFactory.object(IhttpRequest.class);
137
      
138
      return function(this, "Request", object.class, new Block(
139
      (Init) () ->
140
      {
141
         ObjectOps.register(request);
142
      },
143
      (Body) () -> 
144
      {
140 145
         object<? extends LegacyClass> requestType = getRegistry().ref().
141 146
               _get(ObjectOps.getLegacyName(IhttpRequest.class));
142 147
         
src/com/goldencode/p2j/oo/net/http/RequestBuilder.java 2021-03-11 08:18:20 +0000
15 15
**     CA  20210221 Fixed parameters at the LegacySignature annotation.
16 16
** 007 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
17 17
**                  signature.
18
**     ME  20210310 Add block 'referent' for static methods.
18 19
*/
19 20

  
20 21
/*
......
212 213
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
213 214
   private static void initializeRegistry(final object<? extends BuilderRegistry> _poRegistry)
214 215
   {
215
      internalProcedure(null, "InitializeRegistry", new Block((Body) () -> {
216
      internalProcedure(RequestBuilder.class, "InitializeRegistry", new Block((Body) () -> {
216 217
         _poRegistry.ref()._put(ObjectOps.getLegacyName(IAuthenticatedRequest.class),
217 218
                  ObjectOps.getLegacyClass(AuthenticatedRequest.class));
218 219
         _poRegistry.ref()._put(ObjectOps.getLegacyName(IhttpRequest.class),
......
233 234
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
234 235
   public static object<? extends BuilderRegistry> getRegistry()
235 236
   {
236
      return function(null, "Registry", object.class, new Block((Body) () -> 
237
      return function(RequestBuilder.class, "Registry", object.class, new Block((Body) () -> 
237 238
      {
238 239
         object<? extends BuilderRegistry> registry = REGISTRY.get();
239 240
         
src/com/goldencode/p2j/oo/net/http/ResponseBuilder.java 2021-03-11 08:18:20 +0000
11 11
**          20210208 Fix static registry property initialization.
12 12
** 004 CA   20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
13 13
**                   signature.
14
**     ME   20210310 Add block 'referent' for static methods.
14 15
*/
15 16

  
16 17
/*
......
133 134
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
134 135
   public static object<? extends BuilderRegistry> getRegistry()
135 136
   {
136
      return function(null, "Registry", object.class, new Block((Body) () -> 
137
      return function(ResponseBuilder.class, "Registry", object.class, new Block((Body) () -> 
137 138
      {
138 139
         object<? extends BuilderRegistry> registry = REGISTRY.get();
139 140
         
src/com/goldencode/p2j/oo/net/http/filter/payload/MessageWriter.java 2021-03-10 13:13:29 +0000
13 13
**         20210204 Allocate memory when reading from file input stream.
14 14
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
15 15
**                  signature.
16
** 005 ME  20210310 Use initInput in setter methods to avoid issue with 'invalid' object
17
**                  when value is directly returned by a method.
16 18
*/
17 19

  
18 20
/*
......
137 139
               qualified = "OpenEdge.Logging.ILogWriter", mode = "INPUT")
138 140
   })
139 141
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
140
   public void setLogger(object<? extends IlogWriter> poLogger)
142
   public void setLogger(object<? extends IlogWriter> _poLogger)
141 143
   {
144
      object<? extends IlogWriter> poLogger = TypeFactory.initInput(_poLogger);
145
      
142 146
      internalProcedure(this, "Logger", new Block((Body) () -> 
143 147
      {
144 148
         this.logger.assign(poLogger);
......
186 190
               qualified = "Progress.Lang.Object", mode = "INPUT")
187 191
   })
188 192
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
189
   public void setEntity(object<? extends _BaseObject_> poEntity)
193
   public void setEntity(object<? extends _BaseObject_> _poEntity)
190 194
   {
195
      object<? extends _BaseObject_> poEntity = TypeFactory.initInput(_poEntity);
196
      
191 197
      internalProcedure(this, "Entity", new Block((Body) () -> 
192 198
      {
193 199
         Assert.isType(poEntity, entityType);
......
200 206
    */
201 207
   public void __net_http_filter_payload_MessageWriter_execute__()
202 208
   {
203
      externalProcedure(MessageWriter.this, new Block((Body) () -> 
209
      externalProcedure(MessageWriter.this, new Block((Init) () -> 
210
      {
211
         ObjectOps.register(entity, entityType, logger);
212
      },
213
      (Body) () -> 
204 214
      {
205 215
         onBlockLevel(Condition.ERROR, Action.THROW);
206 216
         {
src/com/goldencode/p2j/oo/net/http/filter/writer/AuthenticationRequestWriterBuilder.java 2021-03-11 08:18:20 +0000
12 12
**         20210208 Fix static registry property initialization.
13 13
** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
14 14
**                  signature.
15
**     ME  20210310 Add block 'referent' for static methods.
15 16
*/
16 17

  
17 18
/*
......
211 212
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
212 213
   public static object<? extends BuilderRegistry> getRegistry()
213 214
   {
214
      return function(null, "Registry", object.class, new Block((Body) () -> {
215
      return function(AuthenticationRequestWriterBuilder.class, "Registry", object.class, new Block((Body) () -> {
215 216
         object<? extends BuilderRegistry> registry = REGISTRY.get();
216 217

  
217 218
         if (!registry._isValid())
src/com/goldencode/p2j/oo/net/http/filter/writer/BodyWriterBuilder.java 2021-03-11 08:18:20 +0000
10 10
** 003 MP  20201218 Implement as of OE12.2.
11 11
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
12 12
**                  signature.
13
**     ME  20210310 Add block 'referent' for static methods.
13 14
*/
14 15

  
15 16
/*
......
118 119
            object<? extends MessagePart> _poPart)
119 120
   {
120 121
      object<? extends MessagePart> poPart = TypeFactory.initInput(_poPart);
121
      return function(null, "Build", object.class, new Block((Body)() -> {
122
      return function(BodyWriterBuilder.class, "Build", object.class, new Block((Body)() -> {
122 123
         
123 124
         if (!poPart.ref().getHeaders().ref().has(new character("Content-Type")).booleanValue())
124 125
         {
......
168 169
   {
169 170
      object<? extends IhttpMessage> poMessage = TypeFactory.initInput(_poMessage);
170 171
      
171
      return function(null, "Build", object.class, new Block((Body)() -> 
172
      return function(BodyWriterBuilder.class, "Build", object.class, new Block((Body)() -> 
172 173
      {
173 174
         if (!poMessage.ref().hasHeader(new character("Content-Type")).booleanValue())
174 175
         {
......
215 216
   {
216 217
      character pcContentType = TypeFactory.initInput(_pcContentType);
217 218
      
218
      return function(null, "Build", object.class, new Block((Body)() -> 
219
      return function(BodyWriterBuilder.class, "Build", object.class, new Block((Body)() -> 
219 220
      {
220 221
         returnNormal(MessageWriterBuilder.build(pcContentType, BodyWriterRegistry.getRegistry()));
221 222
      }));
src/com/goldencode/p2j/oo/net/http/filter/writer/BodyWriterRegistry.java 2021-03-11 08:18:20 +0000
11 11
**     ME  20210208 Fix static registry property initialization.
12 12
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
13 13
**                  signature.
14
**     ME  20210310 Add block 'referent' for static methods.
14 15
*/
15 16

  
16 17
/*
......
140 141
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
141 142
   public static void initializeRegistry(final object<? extends BuilderRegistry> _poRegistry)
142 143
   {
143
      internalProcedure(null, "InitializeRegistry", new Block((Body) ()-> {
144
      internalProcedure(BodyWriterRegistry.class, "InitializeRegistry", new Block((Body) ()-> {
144 145
         object<? extends LegacyClass> handlerCls = ObjectOps.getLegacyClass(BinaryBodyWriter.class);
145 146
         // binary
146 147
         _poRegistry.ref()._put("application/gzip", handlerCls);
src/com/goldencode/p2j/oo/net/http/filter/writer/EntityWriterBuilder.java 2021-03-11 08:18:20 +0000
10 10
** 003 MP  20201218 Implement as of OE12.2.
11 11
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
12 12
**                  signature.
13
**     ME  20210310 Add block 'referent' for static methods.
13 14
*/
14 15

  
15 16
/*
......
108 109
   {
109 110
      object<? extends MessagePart> poPart = TypeFactory.initInput(_poPart);
110 111
      
111
      return function(null, "Build", object.class, new Block((Body)() -> {
112
      return function(EntityWriterBuilder.class, "Build", object.class, new Block((Body)() -> {
112 113

  
113 114
         object<? extends HttpHeader> contentType = TypeFactory.object(HttpHeader.class);
114 115
         
......
142 143
   {
143 144
      object<? extends IhttpMessage> poMessage = TypeFactory.initInput(_poMessage);
144 145
      
145
      return function(null, "Build", object.class, new Block((Body)() -> 
146
      return function(EntityWriterBuilder.class, "Build", object.class, new Block((Body)() -> 
146 147
      {
147 148
         
148 149
         object<? extends HttpHeader> contentType = TypeFactory.object(HttpHeader.class);
......
175 176
   {
176 177
      character pcContentType = TypeFactory.initInput(_pcContentType);
177 178
      
178
      return function(null, "Build", object.class, new Block((Body)() -> 
179
      return function(EntityWriterBuilder.class, "Build", object.class, new Block((Body)() -> 
179 180
      {
180 181
         returnNormal(MessageWriterBuilder.build(pcContentType, EntityWriterRegistry.getRegistry()));
181 182
      }));
src/com/goldencode/p2j/oo/net/http/filter/writer/MessageWriterBuilder.java 2021-03-11 08:18:20 +0000
12 12
**         20210208 Fix static registry property initialization.
13 13
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
14 14
**                  signature.
15
**     ME  20210310 Add block 'referent' for static methods, use initInput for object params.
15 16
*/
16 17

  
17 18
/*
......
183 184
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
184 185
   public static object<? extends BuilderRegistry> getRegistry()
185 186
   {
186
     return function(BodyWriterRegistry.class, "Registry", object.class, new Block((Body) () -> {
187
      object<? extends BuilderRegistry> registry = TypeFactory.object(BuilderRegistry.class);
188
      
189
      return function(BodyWriterRegistry.class, "Registry", object.class, new Block((Body) () -> {
187 190
        
188
        object<? extends BuilderRegistry> registry = REGISTRY.get();
191
        registry.assign(REGISTRY.get());
189 192
        
190 193
        if (!registry._isValid())
191 194
        {
......
208 211
         @LegacyParameter(name = "poRegistry", type = "OBJECT", qualified = "openedge.net.http.builderregistry", mode = "INPUT") 
209 212
   })
210 213
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
211
   public static void initializeRegistry(final object<? extends BuilderRegistry> _poRegistry)
214
   private static void initializeRegistry(final object<? extends BuilderRegistry> _poRegistry)
212 215
   {
213 216
      
214
      internalProcedure(null, "InitializeRegistry", new Block((Body) ()-> {
217
      internalProcedure(MessageWriterBuilder.class, "InitializeRegistry", new Block((Body) ()-> {
215 218
         
216 219
         _poRegistry.ref().put(new character(ObjectOps.getLegacyName(MessageWriterBuilder.class)), 
217 220
               ObjectOps.getLegacyClass(DefaultMessageWriterBuilder.class));
......
227 230
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
228 231
   protected object<? extends BuilderRegistry>  getWriterRegistry()
229 232
   {
230
      return function(BodyWriterRegistry.class, "WriterRegistry", object.class, 
233
      return function(MessageWriterBuilder.class, "WriterRegistry", object.class, 
231 234
            new Block((Body) () -> {
232 235
               
233 236
         returnNormal(this.writerRegistry);
......
252 255
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
253 256
   protected character getContentType()
254 257
   {
255
      return function(BodyWriterRegistry.class, "ContentType", character.class, 
258
      return function(MessageWriterBuilder.class, "ContentType", character.class, 
256 259
            new Block((Body) () -> {
257 260
               
258 261
         returnNormal(this.contentType);
......
274 277
   })
275 278
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
276 279
   public static object<? extends MessageWriterBuilder> build(
277
         object<? extends IhttpMessage> poMessage, 
278
         object<? extends BuilderRegistry> poRegistry)
280
         object<? extends IhttpMessage> _poMessage, 
281
         object<? extends BuilderRegistry> _poRegistry)
279 282
   {
280
      return function(null, "Build", object.class, new Block((Body)() -> {
283
      object<? extends IhttpMessage> poMessage = TypeFactory.initInput(_poMessage);
284
      object<? extends BuilderRegistry> poRegistry = TypeFactory.initInput(_poRegistry);
285
      
286
      return function(MessageWriterBuilder.class, "Build", object.class, new Block((Body)() -> {
... This diff was truncated because it exceeds the maximum size that can be displayed.