Project

General

Profile

Start-trunk.java

Radu Apetrii, 11/25/2024 06:34 AM

Download (3.76 KB)

 
1
package com.goldencode.dataset;
2

    
3
import com.goldencode.p2j.util.*;
4
import com.goldencode.p2j.persist.*;
5
import com.goldencode.dataset.dmo.fwd.*;
6
import com.goldencode.p2j.ui.*;
7
import com.goldencode.p2j.persist.lock.*;
8

    
9
import static com.goldencode.p2j.util.BlockManager.*;
10
import static com.goldencode.p2j.util.InternalEntry.Type;
11
import static com.goldencode.p2j.ui.LogicalTerminal.*;
12

    
13
/**
14
 * Business logic (converted to Java from the 4GL source code
15
 * in start.p).
16
 */
17
@DatabaseReferences(aliases = 
18
{
19
   "fwd"
20
}, tables = 
21
{
22
   "fwd.test"
23
})
24
public class Start
25
{
26
   Test.Buf test = RecordBuffer.define(Test.Buf.class, "fwd", "test", "test");
27

    
28
   /**
29
    * External procedure (converted to Java from the 4GL source code
30
    * in start.p).
31
    */
32
   @LegacySignature(type = Type.MAIN, name = "start.p")
33
   public void execute()
34
   {
35
      externalProcedure(Start.this, new Block((Body) () -> 
36
      {
37
         AdaptiveQuery query0 = new AdaptiveQuery();
38
         
39
         forEach(query0, "loopLabel0", new Block((Init) () -> 
40
         {
41
            RecordBuffer.openScope(test);
42
            query0.initialize(test, ((String) null), null, "test.f1 asc");
43
         }, 
44
         (Body) () -> 
45
         {
46
            message((integer) new FieldReference(test, "f1").getValue());
47
         }));
48
         
49
         AdaptiveQuery query1 = new AdaptiveQuery();
50
         
51
         forEach(query1, "loopLabel1", new Block((Init) () -> 
52
         {
53
            RecordBuffer.openScope(test);
54
            query1.initialize(test, "contains(test.c1, 'a*')", null, "test.f1 asc");
55
         }, 
56
         (Body) () -> 
57
         {
58
            message((integer) new FieldReference(test, "f1").getValue());
59
         }));
60
         
61
         AdaptiveQuery query2 = new AdaptiveQuery();
62
         
63
         forEach(query2, "loopLabel2", new Block((Init) () -> 
64
         {
65
            RecordBuffer.openScope(test);
66
            query2.initialize(test, "contains(test.c1, 'a*')", null, "test.f1 asc");
67
         }, 
68
         (Body) () -> 
69
         {
70
            message((integer) new FieldReference(test, "f1").getValue());
71
         }));
72
         
73
         AdaptiveQuery query3 = new AdaptiveQuery();
74
         
75
         forEach(query3, "loopLabel3", new Block((Init) () -> 
76
         {
77
            RecordBuffer.openScope(test);
78
            query3.initialize(test, "test.f2 = 1 and test.f3 >= 1 and contains(test.c1, 'a*')", null, "test.f2 asc, test.f3 asc");
79
         }, 
80
         (Body) () -> 
81
         {
82
            message((integer) new FieldReference(test, "f1").getValue());
83
         }));
84
         
85
         AdaptiveQuery query4 = new AdaptiveQuery();
86
         
87
         forEach(query4, "loopLabel4", new Block((Init) () -> 
88
         {
89
            RecordBuffer.openScope(test);
90
            query4.initialize(test, "test.f2 = 1 and test.f3 >= 1 or contains(test.c1, 'a*')", null, "test.f1 asc");
91
         }, 
92
         (Body) () -> 
93
         {
94
            message((integer) new FieldReference(test, "f1").getValue());
95
         }));
96
         
97
         AdaptiveQuery query5 = new AdaptiveQuery();
98
         
99
         forEach(query5, "loopLabel5", new Block((Init) () -> 
100
         {
101
            RecordBuffer.openScope(test);
102
            query5.initialize(test, "contains(test.c1, 'co*')", null, "test.f1 asc");
103
         }, 
104
         (Body) () -> 
105
         {
106
            message((character) new FieldReference(test, "c1").getValue());
107
         }));
108
         
109
         AdaptiveQuery query6 = new AdaptiveQuery();
110
         
111
         forEach(query6, "loopLabel6", new Block((Init) () -> 
112
         {
113
            RecordBuffer.openScope(test);
114
            query6.initialize(test, "contains(test.c1, 'm*')", null, "test.f1 asc");
115
         }, 
116
         (Body) () -> 
117
         {
118
            message((character) new FieldReference(test, "c1").getValue());
119
         }));
120
      }));
121
   }
122
}