3821c.4384h.patch
src/com/goldencode/p2j/oo/core/ConvCp.java 2021-02-05 11:28:05 +0000 | ||
---|---|---|
11 | 11 |
** 002 CA 20190710 Added LegacyResource annotation. Implemented Equals, NotEquals, IsFalse, |
12 | 12 |
** IsTrue. |
13 | 13 |
** 003 IAS 20190923 Added implementation of additional methods |
14 |
** 004 ME 20210204 Use upper case when looking-up the codepage. |
|
14 | 15 |
*/ |
15 | 16 | |
16 | 17 |
/* |
... | ... | |
199 | 200 |
{ |
200 | 201 |
return new character(MIME.stream().collect(Collectors.joining(","))); |
201 | 202 |
} |
202 |
int n = PROGRESS.indexOf(enc.getValue()); |
|
203 |
int n = PROGRESS.indexOf(enc.getValue().toUpperCase());
|
|
203 | 204 |
return n < 0 ? enc : new character(MIME.get(n)); |
204 | 205 |
} |
205 | 206 |
|
src/com/goldencode/p2j/oo/core/IobjectArrayHolder.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- -------------------------------Description-------------------------------- |
8 | 8 |
** 001 ME 20200729 Convert from skeleton (OE12.2). |
9 |
** ME 20210205 Add getter for object array Value. |
|
9 | 10 |
** 002 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
10 | 11 |
** signature. |
11 | 12 |
*/ |
... | ... | |
79 | 80 |
public interface IobjectArrayHolder |
80 | 81 |
extends com.goldencode.p2j.oo.lang._BaseObject_ |
81 | 82 |
{ |
83 |
@LegacySignature(returns = "OBJECT", qualified = "Progress.Lang.Object", type = Type.GETTER, name = "Value", extent = -1) |
|
84 |
public object<? extends com.goldencode.p2j.oo.lang._BaseObject_>[] getValue(); |
|
85 |
|
|
82 | 86 |
@LegacySignature(returns = "OBJECT", qualified = "Progress.Lang.Object", type = Type.GETTER, name = "Value", parameters = |
83 | 87 |
{ |
84 | 88 |
@LegacyParameter(name = "idx", type = "INT64", mode = "INPUT") |
85 | 89 |
}) |
86 |
public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> getValue_1(final int64 _idx);
|
|
90 |
public object<? extends com.goldencode.p2j.oo.lang._BaseObject_> getValue(final int64 _idx); |
|
87 | 91 |
|
88 | 92 |
@LegacySignature(returns = "INTEGER", type = Type.LENGTH, name = "Value") |
89 | 93 |
public abstract integer lengthOfValue(); |
src/com/goldencode/p2j/oo/core/Memptr.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
12 | 12 |
** 004 ME 20200331 Fix constructors, add setters and validate input parameters for get methods. |
13 | 13 |
** GES 20200526 Change to match legacy enum implementation. |
14 | 14 |
** 005 CA 20210113 Renamed clear() to clear_(), to follow NameConverter's rules. |
15 |
** ME 20210204 The class implements ImemptrHolder. |
|
15 | 16 |
** 006 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
16 | 17 |
** signature. |
17 | 18 |
*/ |
... | ... | |
75 | 76 |
import com.goldencode.p2j.util.BlockManager.Action; |
76 | 77 |
import com.goldencode.p2j.util.BlockManager.Condition; |
77 | 78 |
import com.goldencode.p2j.util.InternalEntry.Type; |
79 |
import com.goldencode.p2j.oo.common.support.ImemptrHolder; |
|
78 | 80 |
import com.goldencode.p2j.oo.lang.*; |
79 | 81 |
import java.io.IOException; |
80 | 82 | |
... | ... | |
88 | 90 |
*/ |
89 | 91 |
@LegacyResource(resource = "OpenEdge.Core.Memptr") |
90 | 92 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_PARTIAL) |
91 |
public class Memptr extends BaseObject |
|
93 |
public class Memptr extends BaseObject implements ImemptrHolder
|
|
92 | 94 |
{ |
93 | 95 |
private logical autoDestroy = TypeFactory.logical(); |
94 | 96 |
src/com/goldencode/p2j/oo/core/collections/AbstractTtcollection.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
171 | 171 |
size.assign(0); |
172 | 172 | |
173 | 173 |
tableHandle.assign(p1.unwrapTempTable()); |
174 |
fieldHandle.assign(p2); |
|
174 |
fieldHandle.assign(p2.unwrapBufferField());
|
|
175 | 175 |
})); |
176 | 176 |
} |
177 | 177 |
src/com/goldencode/p2j/oo/core/collections/ArrayIterator.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
90 | 90 |
@LegacySignature(type = Type.PROPERTY, name = "IteratedArray") |
91 | 91 |
private object<? extends Array> iteratedArray = TypeFactory.object(Array.class); |
92 | 92 | |
93 |
public void __skeleton_oo4gl_openedge_core_collections_ArrayIterator_execute__()
|
|
93 |
public void __core_collections_ArrayIterator_execute__() |
|
94 | 94 |
{ |
95 | 95 |
externalProcedure(ArrayIterator.class, ArrayIterator.this, new Block((Body) () -> |
96 | 96 |
{ |
... | ... | |
149 | 149 |
@LegacySignature(type = Type.CONSTRUCTOR, parameters = { |
150 | 150 |
@LegacyParameter(name = "poIteratedArray", type = "OBJECT", qualified = "openedge.core.collections.array", mode = "INPUT") }) |
151 | 151 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL) |
152 |
public void __skeleton_oo4gl_openedge_core_collections_ArrayIterator_constructor__(
|
|
152 |
public void __core_collections_ArrayIterator_constructor__( |
|
153 | 153 |
final object<? extends Array> _poIteratedArray) |
154 | 154 |
{ |
155 | 155 |
object<? extends Array> poIteratedArray = TypeFactory.initInput(_poIteratedArray); |
src/com/goldencode/p2j/oo/core/collections/IStringStringMap.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
9 | 9 |
** RFB 20191022 Added LegacyResource annotation |
10 | 10 |
** 002 CA 20191024 Added method support levels and updated the class support level. |
11 | 11 |
** 003 ME 20200730 Update parameter names. |
12 |
** ME 20210205 Change second parameter of put method to longchar. |
|
12 | 13 |
** 004 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
13 | 14 |
** signature. |
14 | 15 |
*/ |
... | ... | |
132 | 133 |
@LegacyParameter(name = "poValue", type = "LONGCHAR", mode = "INPUT") |
133 | 134 |
}) |
134 | 135 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
135 |
public longchar put(final character _poKey, final Text _poValue);
|
|
136 |
public longchar put(final character _poKey, final longchar _poValue);
|
|
136 | 137 |
|
137 | 138 |
@LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Put", qualified = "openedge.core.string", parameters = |
138 | 139 |
{ |
src/com/goldencode/p2j/oo/core/collections/Imap.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
10 | 10 |
** 002 CA 20191024 Added method support levels and updated the class support level. |
11 | 11 |
** 003 ME 20200729 Update parameter names to match skeleton. |
12 | 12 |
** 004 CA 20210113 Renamed clear() to clear_(), to follow NameConverter's rules. |
13 |
** 005 ME 20210205 Removed getMap method from interface definition, this is FWD specific. |
|
13 | 14 |
** 005 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
14 | 15 |
** signature. |
15 | 16 |
*/ |
... | ... | |
173 | 174 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
174 | 175 |
public void removeAll(final object<? extends com.goldencode.p2j.oo.core.collections.Icollection> _poKeys); |
175 | 176 |
|
176 |
public Map<object, object> getMap(); |
|
177 | ||
178 | 177 |
} |
src/com/goldencode/p2j/oo/core/collections/LegacyCollection.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
95 | 95 |
public class LegacyCollection |
96 | 96 |
extends AbstractTtcollection |
97 | 97 |
{ |
98 |
private Collection<object<? extends _BaseObject_>> objects;
|
|
98 |
private List<object<? extends _BaseObject_>> objects;
|
|
99 | 99 |
|
100 | 100 |
public void __core_collections_LegacyCollection_execute__() |
101 | 101 |
{ |
... | ... | |
151 | 151 |
object<? extends _BaseObject_> p1 = TypeFactory.initInput(_p1); |
152 | 152 | |
153 | 153 |
return function(this, "Add", logical.class, new Block((Body) () -> { |
154 |
returnNormal(p1._isValid() && objects.add(p1));
|
|
154 |
returnNormal(add_(p1));
|
|
155 | 155 |
})); |
156 | 156 |
} |
157 | 157 |
|
158 |
private boolean add_(final object<? extends _BaseObject_> p1) { |
|
159 |
if (p1._isValid()) { |
|
160 |
ObjectOps.increment(p1.ref()); |
|
161 |
return objects.add(p1); |
|
162 |
} |
|
163 |
|
|
164 |
return false; |
|
165 |
} |
|
166 |
|
|
158 | 167 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "AddArray", parameters = { |
159 | 168 |
@LegacyParameter(name = "p1", type = "OBJECT", extent = -1, qualified = "progress.lang.object", mode = "INPUT") }) |
160 | 169 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL) |
... | ... | |
164 | 173 |
object<? extends _BaseObject_> p1[] = TypeFactory.initInput(_p1); |
165 | 174 | |
166 | 175 |
return function(this, "AddArray", logical.class, new Block((Body) () -> { |
167 |
if (p1.length > 0)
|
|
176 |
for (object<? extends _BaseObject_> obj : p1)
|
|
168 | 177 |
{ |
169 |
objects.addAll(Arrays.asList(p1));
|
|
178 |
add_(obj);
|
|
170 | 179 |
} |
171 | 180 | |
172 | 181 |
returnNormal(true); |
... | ... | |
184 | 193 |
return function(this, "AddAll", logical.class, new Block((Body) () -> { |
185 | 194 |
if (ObjectOps.typeOf(p1, LegacyCollection.class).booleanValue()) |
186 | 195 |
{ |
187 |
objects.addAll(ObjectOps.cast(p1, LegacyCollection.class).ref().objects); |
|
196 |
for (object<? extends _BaseObject_> obj : ObjectOps.cast(p1, LegacyCollection.class).ref().objects) |
|
197 |
{ |
|
198 |
add_(obj); |
|
199 |
} |
|
188 | 200 |
returnNormal(true); |
189 | 201 |
} |
190 | 202 |
else |
... | ... | |
224 | 236 |
protected object<? extends _BaseObject_> _find( |
225 | 237 |
final object<? extends _BaseObject_> checkObject) |
226 | 238 |
{ |
227 |
// in 4GL objects are also matched using equals (LegacyEquals) |
|
228 | 239 |
if (checkObject._isValid()) |
229 | 240 |
{ |
230 |
if (objects.contains(checkObject)) |
|
231 |
return checkObject; |
|
232 |
|
|
241 |
List<object<? extends _BaseObject_>> items = objects.stream() |
|
242 |
.filter(o -> o.equals(checkObject)).collect(Collectors.toList()); |
|
243 | ||
244 |
// if more objects found (duplicate) 4GL sees it as ambiguous |
|
245 |
if (items.size() == 1) |
|
246 |
{ |
|
247 |
return items.get(0); |
|
248 |
} |
|
249 | ||
250 |
// in 4GL objects are also matched using equals (LegacyEquals) |
|
233 | 251 |
Optional<object<? extends _BaseObject_>> found = objects.stream() |
234 | 252 |
.filter(o -> checkObject.ref().legacyEquals(o).booleanValue()).findFirst(); |
235 | 253 | |
236 | 254 |
if (found.isPresent()) |
255 |
{ |
|
237 | 256 |
return found.get(); |
257 |
} |
|
238 | 258 |
} |
239 | 259 | |
240 |
return checkObject;
|
|
260 |
return TypeFactory.object(_BaseObject_.class);
|
|
241 | 261 |
} |
242 | 262 |
|
243 | 263 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "ContainsAll", parameters = { |
src/com/goldencode/p2j/oo/core/collections/LegacyIterator.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
336 | 336 |
} |
337 | 337 |
else if (qry.getNumResults().intValue() == 1 && qry.currentRow().intValue() == 1) |
338 | 338 |
{ |
339 |
returnNormal(bufferHandle.unwrapBuffer().available());
|
|
339 |
returnNormal(!bufferHandle.unwrapBuffer().available().booleanValue());
|
|
340 | 340 |
} |
341 | 341 |
else |
342 | 342 |
{ |
... | ... | |
373 | 373 |
else |
374 | 374 |
{ |
375 | 375 |
queryHandle.unwrapQuery().next(); |
376 |
object<_BaseObject_> ret = TypeFactory.object(_BaseObject_.class); |
|
377 |
|
|
376 | 378 |
if (bufferHandle.unwrapBuffer()._available()) |
377 | 379 |
{ |
378 |
returnNormal(objectFieldHandle.unwrapBufferField().value()); |
|
379 |
} |
|
380 |
else |
|
381 |
{ |
|
382 |
returnNormal(new object<>()); |
|
383 |
} |
|
380 |
ret.assign(objectFieldHandle.unwrapBufferField().value()); |
|
381 |
} |
|
382 |
|
|
383 |
returnNormal(ret); |
|
384 | 384 |
} |
385 | 385 |
})); |
386 | 386 |
} |
src/com/goldencode/p2j/oo/core/collections/LegacyMap.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
8 | 8 |
** 001 ME 20200427 First version, stubs taken by converting the skeleton using FWD. |
9 | 9 |
** 002 CA 20210113 Renamed Iiterator.next to Iiterator.next_, to follow NameConverter's rules. |
10 | 10 |
** Renamed clear() to clear_(), to follow NameConverter's rules. |
11 |
** ME 20210205 Removed getMap method from interface definition, this is FWD specific. |
|
11 | 12 |
** 003 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
12 | 13 |
** signature. |
13 | 14 |
*/ |
... | ... | |
451 | 452 |
})); |
452 | 453 |
} |
453 | 454 | |
454 |
@Override |
|
455 | 455 |
public Map<object, object> getMap() |
456 | 456 |
{ |
457 | 457 |
return map; |
src/com/goldencode/p2j/oo/core/collections/StringStringMap.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- -------------------------------Description-------------------------------- |
8 | 8 |
** 001 ME 20200427 First version, stubs taken by converting the skeleton using FWD. |
9 |
** ME 20210205 Change second parameter of put method to longchar. |
|
9 | 10 |
** |
10 | 11 |
** 002 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
11 | 12 |
** signature. |
... | ... | |
297 | 298 |
@LegacyParameter(name = "pcKey", type = "CHARACTER", mode = "INPUT"), |
298 | 299 |
@LegacyParameter(name = "pcValue", type = "LONGCHAR", mode = "INPUT") }) |
299 | 300 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL) |
300 |
public longchar put(final character pcKey, final Text pcValue)
|
|
301 |
public longchar put(final character pcKey, final longchar pcValue)
|
|
301 | 302 |
{ |
302 | 303 |
return function(StringStringMap.class, this, "Put", longchar.class, new Block((Body) () -> { |
303 | 304 |
object<LegacyString> key = ObjectOps.newInstance(LegacyString.class, "I", pcKey); |
src/com/goldencode/p2j/oo/io/FileInputStream.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
9 | 9 |
** 002 MP 20200703 Complete code with methods like legacy class |
10 | 10 |
** 003 MP 20210112 improve constructor behavior and add file name in loop |
11 | 11 |
** 004 ME 20210128 Fix ctor/execute names. |
12 |
** ME 20210204 Complete implementation as of OE12.2. |
|
12 | 13 |
** 005 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
13 | 14 |
** signature. |
14 | 15 |
*/ |
... | ... | |
74 | 75 |
import static com.goldencode.p2j.util.BlockManager.onBlockLevel; |
75 | 76 |
import static com.goldencode.p2j.report.ReportConstants.*; |
76 | 77 |
import static com.goldencode.p2j.util.BlockManager.returnNormal; |
78 |
import static com.goldencode.p2j.util.BlockManager.undoThrow; |
|
77 | 79 | |
80 |
import com.goldencode.p2j.oo.lang.SysError; |
|
78 | 81 |
import com.goldencode.p2j.util.*; |
79 | 82 |
import com.goldencode.p2j.util.BlockManager.Action; |
80 | 83 |
import com.goldencode.p2j.util.BlockManager.Condition; |
... | ... | |
85 | 88 |
* in Progress/IO/FileInputStream.cls). |
86 | 89 |
*/ |
87 | 90 |
@LegacyResource(resource = "Progress.IO.FileInputStream") |
88 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
91 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
89 | 92 |
public class FileInputStream |
90 | 93 |
extends InputStream |
91 | 94 |
{ |
92 | 95 |
@LegacySignature(type = Type.PROPERTY, name = "FileName") |
93 | 96 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB) |
94 | 97 |
private character fileName = TypeFactory.character(); |
95 | ||
98 |
private long fileSize; |
|
99 |
private long bytesLeft; |
|
100 |
|
|
101 |
private Stream sFileStream = new StreamWrapper("sFile"); |
|
102 |
|
|
96 | 103 |
public void __io_FileInputStream_execute__() |
97 | 104 |
{ |
98 | 105 |
externalProcedure(FileInputStream.class, FileInputStream.this, new Block((Body) () -> |
... | ... | |
107 | 114 |
{ |
108 | 115 |
@LegacyParameter(name = "filename", type = "CHARACTER", mode = "INPUT") |
109 | 116 |
}) |
110 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
117 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
111 | 118 |
public void __io_FileInputStream_constructor__(final character _filename) |
112 | 119 |
{ |
113 | 120 |
character filename = TypeFactory.initInput(_filename); |
... | ... | |
115 | 122 |
internalProcedure(FileInputStream.class, this, "__io_FileInputStream_constructor__", new Block((Body) () -> |
116 | 123 |
{ |
117 | 124 |
__io_InputStream_constructor__(); |
125 |
|
|
126 |
if (filename.isUnknown()) |
|
127 |
{ |
|
128 |
undoThrow(SysError.newInstance("Invalid file name specified for 'Progress.IO.FileInputStream'", 18195, false, false)); |
|
129 |
} |
|
130 |
|
|
118 | 131 |
this.fileName.assign(filename); |
132 |
|
|
133 |
try |
|
134 |
{ |
|
135 |
sFileStream.assign(StreamFactory.openFileStream((filename).toStringMessage(), false, false)); |
|
136 |
sFileStream.setBinary(); |
|
137 |
sFileStream.setConvert(false); |
|
138 |
|
|
139 |
FileSystemOps.initFileInfo(fileName); |
|
140 |
fileSize = FileSystemOps.fileInfoGetSize().longValue(); |
|
141 |
bytesLeft = fileSize; |
|
142 |
} |
|
143 |
catch (Exception e) |
|
144 |
{ |
|
145 |
undoThrow(SysError.newInstance("Cannot find or open file %s, errno = 2", 11294, true, false)); |
|
146 |
} |
|
147 |
|
|
119 | 148 |
})); |
120 | 149 |
} |
121 | 150 |
|
122 | 151 |
@LegacySignature(returns = "CHARACTER", type = Type.GETTER, name = "FileName") |
123 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
152 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
124 | 153 |
public character getFileName() |
125 | 154 |
{ |
126 | 155 |
return function(FileInputStream.class, this, "FileName", character.class, new Block((Body) () -> |
... | ... | |
131 | 160 | |
132 | 161 |
@LegacySignature(type = Type.METHOD, name = "Close") |
133 | 162 |
@Override |
134 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
163 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
135 | 164 |
public void close() |
136 | 165 |
{ |
137 | 166 |
internalProcedure(FileInputStream.class, this, "Close", new Block((Body) () -> |
138 | 167 |
{ |
139 |
UnimplementedFeature.missing("FileInputStream:Close METHOD"); |
|
168 |
sFileStream.closeIn(); |
|
169 |
super.close(); |
|
140 | 170 |
})); |
141 | 171 |
} |
142 | 172 | |
... | ... | |
145 | 175 |
@LegacyParameter(name = "target", type = "MEMPTR", mode = "INPUT") |
146 | 176 |
}) |
147 | 177 |
@Override |
148 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
149 |
public int64 read(final memptr _target)
|
|
178 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
179 |
public int64 read(final memptr target) |
|
150 | 180 |
{ |
151 |
memptr target = TypeFactory.initInput(_target); |
|
152 |
|
|
153 | 181 |
return function(FileInputStream.class, this, "Read", int64.class, new Block((Body) () -> |
154 | 182 |
{ |
155 |
UnimplementedFeature.missing("FileInputStream:Read1 METHOD");
|
|
183 |
returnNormal(read(target, new int64(1), target.length()));
|
|
156 | 184 |
})); |
157 | 185 |
} |
158 | 186 | |
... | ... | |
161 | 189 |
@LegacyParameter(name = "n", type = "INT64", mode = "INPUT") |
162 | 190 |
}) |
163 | 191 |
@Override |
164 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
192 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
165 | 193 |
public int64 skipBytes(final int64 _n) |
166 | 194 |
{ |
167 | 195 |
int64 n = TypeFactory.initInput(_n); |
196 |
memptr mdata = TypeFactory.memptr(); |
|
168 | 197 |
|
169 | 198 |
return function(FileInputStream.class, this, "SkipBytes", int64.class, new Block((Body) () -> |
170 | 199 |
{ |
171 |
UnimplementedFeature.missing("FileInputStream:SkipBytes METHOD"); |
|
200 |
if (getClosed().booleanValue()) |
|
201 |
{ |
|
202 |
undoThrow(SysError.newInstance("Cannot invoke method 'SkipBytes' after stream has been closed", 18196, false, false)); |
|
203 |
} |
|
204 |
|
|
205 |
if (n.isUnknown()) |
|
206 |
{ |
|
207 |
undoThrow(SysError.newInstance("Invalid value specified for parameter 'length' of method or constructor 'SkipBytes'", 18193, false, true)); |
|
208 |
} |
|
209 |
|
|
210 |
if (n.longValue() < 1) |
|
211 |
{ |
|
212 |
returnNormal(0); |
|
213 |
} |
|
214 |
|
|
215 |
mdata.setLength(n); |
|
216 |
|
|
217 |
read(mdata); |
|
218 |
|
|
219 |
returnNormal(n); |
|
220 |
|
|
221 |
}, (Fini) () -> { |
|
222 |
mdata.setLength(0); |
|
172 | 223 |
})); |
173 | 224 |
} |
174 | 225 | |
... | ... | |
179 | 230 |
@LegacyParameter(name = "length", type = "INT64", mode = "INPUT") |
180 | 231 |
}) |
181 | 232 |
@Override |
182 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
233 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
183 | 234 |
public int64 read(final memptr _target, final int64 _offset, final int64 _length) |
184 | 235 |
{ |
185 | 236 |
memptr target = TypeFactory.initInput(_target); |
186 | 237 |
int64 offset = TypeFactory.initInput(_offset); |
187 | 238 |
int64 length = TypeFactory.initInput(_length); |
239 |
memptr vmem = TypeFactory.memptr(); |
|
188 | 240 |
|
189 | 241 |
return function(FileInputStream.class, this, "Read", int64.class, new Block((Body) () -> |
190 | 242 |
{ |
191 |
UnimplementedFeature.missing("FileInputStream:Read2 METHOD"); |
|
243 |
if (getClosed().booleanValue()) |
|
244 |
{ |
|
245 |
undoThrow(SysError.newInstance("Cannot invoke method 'Read' after stream has been closed", 18196, false, false)); |
|
246 |
} |
|
247 |
|
|
248 |
if (target.length().longValue() == 0) |
|
249 |
{ |
|
250 |
undoThrow(SysError.newInstance("Invalid parameter: An initialized MEMPTR must be provided for the Read method or constructor", 19066, false, true)); |
|
251 |
} |
|
252 |
|
|
253 |
if (offset.isUnknown() || offset.longValue() < 1 || offset.longValue() > target.length().longValue()) |
|
254 |
{ |
|
255 |
undoThrow(SysError.newInstance("Invalid value specified for parameter 'offset' of method or constructor 'Read'", 18193, false, true)); |
|
256 |
} |
|
257 |
|
|
258 |
if (length.isUnknown() || length.longValue() < 0) |
|
259 |
{ |
|
260 |
undoThrow(SysError.newInstance("Invalid value specified for parameter 'length' of method or constructor 'Read'", 18193, false, true)); |
|
261 |
} |
|
262 |
|
|
263 |
long toRead = bytesLeft; |
|
264 |
|
|
265 |
if (bytesLeft > 0) |
|
266 |
{ |
|
267 |
toRead = Math.min(bytesLeft, Math.min(length.longValue(), target.length().longValue() + 1 - offset.longValue())); |
|
268 |
} |
|
269 |
|
|
270 |
// easy way out |
|
271 |
if (toRead > 0) |
|
272 |
{ |
|
273 |
bytesLeft -= toRead; |
|
274 |
|
|
275 |
// read straight into the given memptr |
|
276 |
if (offset.longValue() == 1 && toRead == target.length().longValue()) |
|
277 |
{ |
|
278 |
sFileStream.readBlock(target); |
|
279 |
} |
|
280 |
else |
|
281 |
{ |
|
282 |
vmem.setLength(toRead); |
|
283 |
sFileStream.readBlock(vmem); |
|
284 |
target.setBytes(vmem, offset); |
|
285 |
} |
|
286 |
|
|
287 |
sFileStream.resetCurrentLine(); |
|
288 |
} |
|
289 |
|
|
290 |
returnNormal(toRead); |
|
291 |
}, (Fini) () -> { |
|
292 |
vmem.setLength(0); |
|
192 | 293 |
})); |
193 | 294 |
} |
194 | 295 | |
... | ... | |
198 | 299 |
@LegacyParameter(name = "target", type = "CHARACTER", mode = "OUTPUT") |
199 | 300 |
}) |
200 | 301 |
@Override |
201 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
302 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
202 | 303 |
public int64 read(final character _delimiter, final character target) |
203 | 304 |
{ |
204 |
character delimiter = TypeFactory.initInput(_delimiter); |
|
205 |
|
|
206 |
return function(FileInputStream.class, this, "Read", int64.class, new Block((Init) () -> |
|
207 |
{ |
|
208 |
TypeFactory.initOutput(target); |
|
209 |
}, |
|
210 |
(Body) () -> |
|
211 |
{ |
|
212 |
UnimplementedFeature.missing("FileInputStream:Read3 METHOD"); |
|
305 |
return function(FileInputStream.class, this, "Read", int64.class, new Block((Body) () -> |
|
306 |
{ |
|
307 |
undoThrow(SysError.newInstance("Cannot invoke Read method in 'Progress.IO.FileInputStream' because it is not implemented", 18192, false, false)); |
|
213 | 308 |
})); |
214 | 309 |
} |
215 | 310 | |
... | ... | |
219 | 314 |
@LegacyParameter(name = "target", type = "LONGCHAR", mode = "OUTPUT") |
220 | 315 |
}) |
221 | 316 |
@Override |
222 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_STUB)
|
|
317 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
|
|
223 | 318 |
public int64 read(final character _delimiter, final longchar target) |
224 | 319 |
{ |
225 |
character delimiter = TypeFactory.initInput(_delimiter); |
|
226 |
|
|
227 | 320 |
return function(FileInputStream.class, this, "Read", int64.class, new Block((Init) () -> |
228 | 321 |
{ |
229 | 322 |
TypeFactory.initOutput(target); |
230 | 323 |
}, |
231 | 324 |
(Body) () -> |
232 | 325 |
{ |
233 |
UnimplementedFeature.missing("FileInputStream:Read4 METHOD");
|
|
326 |
undoThrow(SysError.newInstance("Cannot invoke Read method in 'Progress.IO.FileInputStream' because it is not implemented", 18192, false, false));
|
|
234 | 327 |
})); |
235 | 328 |
} |
236 | 329 |
} |
src/com/goldencode/p2j/oo/io/InputStream.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
8 | 8 |
** 001 IAS 20190923 First version. |
9 | 9 |
** 002 MP 20200703 Complete code with methods like legacy class |
10 | 10 |
** 003 ME 20201209 Fully implement non-abstract methods. |
11 |
** ME 20210204 Add destructor to automatically close the stream. |
|
11 | 12 |
** 004 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
12 | 13 |
** signature. |
13 | 14 |
*/ |
... | ... | |
112 | 113 |
__lang_BaseObject_constructor__(); |
113 | 114 |
})); |
114 | 115 |
} |
116 |
|
|
117 |
@LegacySignature(type = Type.DESTRUCTOR) |
|
118 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
119 |
public void __io_InputStream_destructor__() |
|
120 |
{ |
|
121 |
internalProcedure(this, "__io_InputStream_destructor__", new Block((Body) () -> |
|
122 |
{ |
|
123 |
close(); |
|
124 |
})); |
|
125 |
} |
|
115 | 126 | |
116 | 127 |
@LegacySignature(returns = "LOGICAL", type = Type.GETTER, name = "Closed") |
117 | 128 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
src/com/goldencode/p2j/oo/json/JsonBackend.java 2021-02-15 09:22:31 +0000 | ||
---|---|---|
8 | 8 |
** 001 HC 20190701 Initial version. |
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 |
** 20210215 Extend pretty printer to match the 4GL formated output. |
|
11 | 12 |
*/ |
12 | 13 | |
13 | 14 |
/* |
... | ... | |
70 | 71 |
import com.fasterxml.jackson.core.io.SerializedString; |
71 | 72 |
import com.fasterxml.jackson.core.*; |
72 | 73 |
import com.fasterxml.jackson.core.util.*; |
74 |
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter; |
|
73 | 75 |
import com.goldencode.p2j.oo.json.objectmodel.*; |
74 | 76 |
import com.goldencode.p2j.util.*; |
75 | 77 | |
76 | 78 |
import java.io.*; |
77 | 79 |
import java.math.*; |
80 |
import java.nio.charset.Charset; |
|
78 | 81 |
import java.util.*; |
79 | 82 | |
80 | 83 |
/** |
... | ... | |
139 | 142 |
JsonGenerator gen = factory.createGenerator(target, enc); |
140 | 143 |
if (prettyPrint) |
141 | 144 |
{ |
142 |
// TODO: there are some small differences how 4GL formats the output, |
|
143 |
// for example new object bracket as the first element in an array is |
|
144 |
// put on new line |
|
145 |
gen.setPrettyPrinter(new DefaultPrettyPrinter()); |
|
145 |
gen.setPrettyPrinter(ProPretyPrinter.instance()); |
|
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
// 4GL escapes forward slash |
149 |
gen.setCharacterEscapes(new ProCharacterEscapes());
|
|
149 |
gen.setCharacterEscapes(ProCharacterEscapes.instance());
|
|
150 | 150 |
writeConstruct(gen, construct); |
151 | 151 |
gen.flush(); |
152 |
gen.close(); |
|
152 |
|
|
153 |
// skip this as it will close the stream and not always what we need |
|
154 |
// gen.close(); |
|
155 |
|
|
156 |
// 4GL add a new line at the end of document |
|
157 |
if (prettyPrint) |
|
158 |
{ |
|
159 |
target.write("\n".getBytes(Charset.forName(enc.getJavaName()))); |
|
160 |
} |
|
161 |
|
|
153 | 162 |
return enc.getJavaName(); |
154 | 163 |
} |
155 | 164 | |
... | ... | |
540 | 549 |
} |
541 | 550 |
} |
542 | 551 |
|
543 |
private class ProCharacterEscapes extends CharacterEscapes { |
|
552 |
private static class ProCharacterEscapes extends CharacterEscapes {
|
|
544 | 553 | |
545 | 554 |
private static final long serialVersionUID = 1L; |
555 |
private static final ProCharacterEscapes _escapeInstance = new ProCharacterEscapes(); |
|
556 | ||
557 |
public static ProCharacterEscapes instance() { return _escapeInstance; } |
|
558 | ||
559 |
|
|
546 | 560 |
private final SerializedString fwdSlash; |
547 | 561 |
private final int[] asciiEscapes; |
548 | 562 |
|
549 |
public ProCharacterEscapes()
|
|
563 |
private ProCharacterEscapes()
|
|
550 | 564 |
{ |
551 | 565 |
fwdSlash = new SerializedString("\\/"); |
552 | 566 |
asciiEscapes = standardAsciiEscapesForJSON(); |
... | ... | |
568 | 582 |
return null; |
569 | 583 |
} |
570 | 584 |
|
585 |
} |
|
586 |
|
|
587 |
private static class ProPretyPrinter extends DefaultPrettyPrinter { |
|
588 |
private static final long serialVersionUID = 1L; |
|
589 |
private static final ProPretyPrinter _printerInstance = new ProPretyPrinter(); |
|
590 | ||
591 |
public static ProPretyPrinter instance() { return _printerInstance; } |
|
592 |
|
|
593 |
ProPretyPrinter() { |
|
594 |
indentArraysWith(TwoSpacesIndenter.instance()); |
|
595 |
indentObjectsWith(TwoSpacesIndenter.instance()); |
|
596 |
} |
|
597 | ||
598 |
@Override |
|
599 |
public void writeObjectFieldValueSeparator(JsonGenerator g) throws IOException |
|
600 |
{ |
|
601 |
// no space between name and colon |
|
602 |
g.writeRaw(": "); |
|
603 |
} |
|
604 |
|
|
605 |
} |
|
606 |
|
|
607 |
private static class TwoSpacesIndenter implements Indenter |
|
608 |
{ |
|
609 | ||
610 |
private static final TwoSpacesIndenter _indenterInstance = new TwoSpacesIndenter(); |
|
611 | ||
612 |
public static TwoSpacesIndenter instance() { return _indenterInstance; } |
|
613 |
|
|
614 |
@Override |
|
615 |
public boolean isInline() |
|
616 |
{ |
|
617 |
return false; |
|
618 |
} |
|
619 | ||
620 |
@Override |
|
621 |
public void writeIndentation(JsonGenerator g, int level) throws IOException |
|
622 |
{ |
|
623 |
g.writeRaw('\n'); |
|
624 |
|
|
625 |
for (int i = 0; i < level; i++) |
|
626 |
{ |
|
627 |
g.writeRaw(" "); |
|
628 |
} |
|
629 |
|
|
630 |
} |
|
571 | 631 |
|
572 | 632 |
} |
573 | 633 |
} |
src/com/goldencode/p2j/oo/json/objectmodel/JsonArray.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
13 | 13 |
** 006 HC 20190701 Implemented most of the legacy methods. |
14 | 14 |
** 007 CA 20191024 Added method support levels and updated the class support level. |
15 | 15 |
** 008 ME 20210130 Add missing methods (OE12.2), implement error handling 4GL compatible. |
16 |
** 20210215 Fix write method return. |
|
16 | 17 |
** 009 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
17 | 18 |
** signature. |
18 | 19 |
*/ |
... | ... | |
3036 | 3037 |
/** |
3037 | 3038 |
* Removes all values from this json object or array. |
3038 | 3039 |
*/ |
3039 |
@Override |
|
3040 | 3040 |
protected void clear() |
3041 | 3041 |
{ |
3042 | 3042 |
for (Object o : elements) |
... | ... | |
3366 | 3366 |
}) |
3367 | 3367 |
public logical read(final handle htt) |
3368 | 3368 |
{ |
3369 |
return function(this, "Read", logical.class, new Block((Body) () -> { |
|
3370 |
returnNormal(read(htt, new logical(false))); |
|
3371 |
})); |
|
3369 |
return read(htt, new logical(false)); |
|
3372 | 3370 |
} |
3373 | 3371 | |
3374 | 3372 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
... | ... | |
3382 | 3380 |
logical omit = TypeFactory.initInput(_omit); |
3383 | 3381 |
|
3384 | 3382 |
return function(this, "Read", logical.class, new Block((Body) () -> { |
3383 |
logical ret = TypeFactory.logical(); |
|
3385 | 3384 |
|
3386 |
if (!htt._isValid() || !CompareOps._isEqual(htt.unwrapType().getResourceType(), "temp-table"))
|
|
3385 |
if (!htt._isValid() || !htt.isType("TEMP-TABLE"))
|
|
3387 | 3386 |
{ |
3388 | 3387 |
undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("temp-table handle", this, |
3389 | 3388 |
"Read", "Not initialized or not a handle to a TEMP-TABLE."), 16070)); |
... | ... | |
3400 | 3399 |
try |
3401 | 3400 |
{ |
3402 | 3401 |
export.serializeTempTable(jb, tmpBuffer, !omit.isUnknown() && omit.booleanValue()); |
3403 |
returnNormal(new logical(true));
|
|
3402 |
ret.assign(true);
|
|
3404 | 3403 |
} |
3405 | 3404 |
catch (Exception e) |
3406 | 3405 |
{ |
3407 | 3406 |
log.log(Level.WARNING, "", e); |
3408 | 3407 |
returnError(ObjectOps.newInstance(JsonError.class)); |
3409 | 3408 |
} |
3409 |
|
|
3410 |
returnNormal(ret); |
|
3410 | 3411 |
})); |
3411 | 3412 |
} |
3412 | 3413 |
} |
src/com/goldencode/p2j/oo/json/objectmodel/JsonConstruct.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
2 | 2 |
** Module : JsonConstruct.java |
3 | 3 |
** Abstract : Implementation of the Progress.Json.Objectmodel.JsonConstruct builtin class. |
4 | 4 |
** |
5 |
** Copyright (c) 2018-2021, Golden Code Development Corporation.
|
|
5 |
** Copyright (c) 2018-2020, Golden Code Development Corporation.
|
|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- -------------------------------Description-------------------------------- |
8 | 8 |
** 001 OM 20181218 First version. |
... | ... | |
21 | 21 |
** 010 CA 20200503 Added stub for JsonConstruct:read(handle). |
22 | 22 |
** 011 ME 20201028 Add routine level undo throw to avoid 'eating' errors. |
23 | 23 |
** 20210128 Fix longchar to utf-8 for jsonText, 'null' string for nulls. |
24 |
** 20210209 Fix encoding parameter sent to write method (unknown instead of null). |
|
25 |
** 20210215 Remove clean/read methods, refactor write. |
|
24 | 26 |
** 012 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
25 | 27 |
** signature. |
26 | 28 |
*/ |
... | ... | |
82 | 84 | |
83 | 85 |
import com.goldencode.p2j.oo.json.*; |
84 | 86 |
import com.goldencode.p2j.oo.lang.*; |
85 |
import com.goldencode.p2j.persist.*; |
|
86 | 87 |
import com.goldencode.p2j.persist.serial.*; |
87 | 88 |
import com.goldencode.p2j.util.*; |
89 |
import com.goldencode.p2j.util.ErrorManager; |
|
88 | 90 |
import com.goldencode.p2j.util.BlockManager.Action; |
89 | 91 |
import com.goldencode.p2j.util.BlockManager.Condition; |
90 | 92 | |
91 | 93 |
import java.io.*; |
92 | 94 |
import java.nio.charset.*; |
93 | 95 |
import java.util.*; |
94 |
import java.util.function.*; |
|
95 | 96 |
import java.util.logging.*; |
96 | 97 | |
97 | 98 |
import static com.goldencode.p2j.util.BlockManager.*; |
... | ... | |
141 | 142 |
})); |
142 | 143 |
} |
143 | 144 | |
144 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
145 |
{ |
|
146 |
@LegacyParameter(name = "tt", type = "HANDLE", mode = "INPUT") |
|
147 |
}) |
|
148 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
149 |
public logical read(final TableParameter _tt) |
|
150 |
{ |
|
151 |
return read(_tt, new logical(false)); |
|
152 |
} |
|
153 | ||
154 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
155 |
{ |
|
156 |
@LegacyParameter(name = "tt", type = "HANDLE", mode = "INPUT") |
|
157 |
}) |
|
158 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_NONE) |
|
159 |
public logical read(final handle _tt) |
|
160 |
{ |
|
161 |
UnimplementedFeature.missing("JsonConstruct:read(handle)"); |
|
162 |
return new logical(false); |
|
163 |
} |
|
164 | ||
165 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
166 |
{ |
|
167 |
@LegacyParameter(name = "tt", type = "HANDLE", mode = "INPUT"), |
|
168 |
@LegacyParameter(name = "omit", type = "LOGICAL", mode = "INPUT") |
|
169 |
}) |
|
170 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
171 |
public logical read(final TableParameter _tt, final logical _omit) |
|
172 |
{ |
|
173 |
logical omit = TypeFactory.initInput(_omit); |
|
174 | ||
175 |
return function(this, "Read", logical.class, new Block((Body) () -> |
|
176 |
{ |
|
177 |
TemporaryBuffer tb = (TemporaryBuffer) ((BufferReference) _tt.getTable()).buffer(); |
|
178 |
readImpl(tb, omit); |
|
179 |
})); |
|
180 |
} |
|
181 | ||
145 |
/** |
|
146 |
* Writes the object graph referenced by this JSON construct into the given target. |
|
147 |
* |
|
148 |
* @param _strHndl |
|
149 |
* The stream handle to use as a target. |
|
150 |
* |
|
151 |
* @return {@code true} if the serialization was successful. |
|
152 |
*/ |
|
153 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Write", parameters = |
|
154 |
{ |
|
155 |
@LegacyParameter(name = "str-hndl", type = "HANDLE", mode = "INPUT"), |
|
156 |
}) |
|
157 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
158 |
public logical write(final handle strHndl) |
|
159 |
{ |
|
160 |
return write(strHndl, new logical(false), new character()); |
|
161 |
} |
|
162 |
|
|
182 | 163 |
/** |
183 | 164 |
* Writes the object graph referenced by this JSON construct into the given target. |
184 | 165 |
* |
... | ... | |
195 | 176 |
@LegacyParameter(name = "fmtted", type = "LOGICAL", mode = "INPUT") |
196 | 177 |
}) |
197 | 178 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
198 |
public logical write(final handle _strHndl, final logical _fmtted)
|
|
179 |
public logical write(final handle strHndl, final logical fmtted)
|
|
199 | 180 |
{ |
200 |
handle strHndl = TypeFactory.initInput(_strHndl); |
|
201 |
logical fmtted = TypeFactory.initInput(_fmtted); |
|
202 | ||
203 |
return function(this, "Write", logical.class, new Block((Body) () -> |
|
204 |
{ |
|
205 |
write(strHndl, fmtted, new character()); |
|
206 |
})); |
|
181 |
return write(strHndl, fmtted, new character()); |
|
207 | 182 |
} |
208 | 183 | |
209 | 184 |
/** |
... | ... | |
234 | 209 |
return function(this, "Write", logical.class, new Block((Body) () -> |
235 | 210 |
{ |
236 | 211 |
Stream stream = (Stream) strHndl.getResource(); |
237 |
writeImpl(fmtted, enc, (b, chset) -> |
|
212 |
OutputStream o = new OutputStreamWrapper(stream); |
|
213 |
logical ret = TypeFactory.logical(); |
|
214 |
|
|
215 |
try { |
|
216 |
writeImpl(o, fmtted, enc); |
|
217 |
ret.assign(true); |
|
218 |
} |
|
219 |
catch (Exception e) |
|
238 | 220 |
{ |
239 |
try |
|
240 |
{ |
|
241 |
stream.write(b); |
|
242 |
return new logical(true); |
|
243 |
} |
|
244 |
catch (IOException e) |
|
245 |
{ |
|
246 |
throw new RuntimeException(e); |
|
247 |
} |
|
248 |
}); |
|
221 |
returnError(JsonError.newInstance(e.getMessage(), 0)); |
|
222 |
} |
|
223 |
returnNormal(ret); |
|
249 | 224 |
})); |
250 | 225 |
} |
251 | 226 | |
... | ... | |
262 | 237 |
@LegacyParameter(name = "target", type = "LONGCHAR", mode = "INPUT-OUTPUT") |
263 | 238 |
}) |
264 | 239 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
265 |
public logical write_1(final longchar target)
|
|
240 |
public logical write(final longchar target) |
|
266 | 241 |
{ |
267 |
return function(this, "Write", logical.class, new Block((Body) () -> |
|
268 |
{ |
|
269 |
writeImpl(null, null, (b, chset) -> |
|
270 |
{ |
|
271 |
target.assign(new String(b, chset)); |
|
272 |
return new logical(true); |
|
273 |
}); |
|
274 |
})); |
|
242 |
return write(target, new logical(false), new character()); |
|
275 | 243 |
} |
276 | 244 | |
277 | 245 |
/** |
... | ... | |
290 | 258 |
@LegacyParameter(name = "fmtted", type = "LOGICAL", mode = "INPUT") |
291 | 259 |
}) |
292 | 260 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
293 |
public logical write(final longchar target, final logical _fmtted)
|
|
261 |
public logical write(final longchar target, final logical fmtted) |
|
294 | 262 |
{ |
295 |
logical fmtted = TypeFactory.initInput(_fmtted); |
|
296 | ||
297 |
return function(this, "Write", logical.class, new Block((Body) () -> |
|
298 |
{ |
|
299 |
writeImpl(fmtted, null, (b, chset) -> |
|
300 |
{ |
|
301 |
target.assign(new String(b, chset)); |
|
302 |
return new logical(true); |
|
303 |
}); |
|
304 |
})); |
|
263 |
return write(target, fmtted, new character()); |
|
305 | 264 |
} |
306 | 265 | |
307 | 266 |
/** |
... | ... | |
330 | 289 | |
331 | 290 |
return function(this, "Write", logical.class, new Block((Body) () -> |
332 | 291 |
{ |
333 |
writeImpl(fmtted, enc, (b, chset) -> |
|
334 |
{ |
|
335 |
target.assign(new String(b, chset)); |
|
336 |
return new logical(true); |
|
337 |
}); |
|
292 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
293 |
logical ret = TypeFactory.logical(); |
|
294 |
|
|
295 |
if (TextOps.isEmpty(enc)) |
|
296 |
{ |
|
297 |
enc.assign("UTF-8"); |
|
298 |
} |
|
299 |
|
|
300 |
try { |
|
301 |
Charset ch = writeImpl(out, fmtted, enc); |
|
302 |
target.setUnknown(); |
|
303 |
target.fixCodePage(enc); |
|
304 |
target.assign(new String(out.toByteArray(), ch)); |
|
305 |
ret.assign(true); |
|
306 |
} |
|
307 |
catch (Exception e) |
|
308 |
{ |
|
309 |
returnError(JsonError.newInstance(e.getMessage(), 0)); |
|
310 |
} |
|
311 |
|
|
312 |
returnNormal(ret); |
|
338 | 313 |
})); |
339 | 314 |
} |
340 | 315 | |
... | ... | |
353 | 328 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
354 | 329 |
public logical write(final memptr _target) |
355 | 330 |
{ |
356 |
return function(this, "Write", logical.class, new Block((Body) () -> |
|
357 |
{ |
|
358 |
returnNormal(write(_target, null, null)); |
|
359 |
})); |
|
331 |
return write(_target, new logical(false), new character()); |
|
360 | 332 |
} |
361 | 333 | |
362 | 334 |
/** |
... | ... | |
377 | 349 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
378 | 350 |
public logical write(final memptr _target, final logical _fmtted) |
379 | 351 |
{ |
380 |
logical fmtted = TypeFactory.initInput(_fmtted); |
|
381 | ||
382 |
return function(this, "Write", logical.class, new Block((Body) () -> |
|
383 |
{ |
|
384 |
returnNormal(write(_target, fmtted, null)); |
|
385 |
})); |
|
352 |
return write(_target, _fmtted, new character()); |
|
386 | 353 |
} |
387 | 354 | |
388 | 355 |
/** |
... | ... | |
411 | 378 | |
412 | 379 |
return function(this, "Write", logical.class, new Block((Body) () -> |
413 | 380 |
{ |
414 |
writeImpl(fmtted, enc, (b, chset) -> |
|
381 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
382 |
logical ret = TypeFactory.logical(); |
|
383 |
|
|
384 |
try { |
|
385 |
Charset ch = writeImpl(out, fmtted, enc); |
|
386 |
_target.setLength(0); |
|
387 |
_target.setLength(out.size()); |
|
388 |
_target.write(true, out.toByteArray(), 0, false); |
|
389 |
|
|
390 |
ret.assign(true); |
|
391 |
} |
|
392 |
catch (Exception e) |
|
415 | 393 |
{ |
416 |
_target.assign(b);
|
|
417 |
return new logical(true);
|
|
418 |
});
|
|
394 |
returnError(JsonError.newInstance(e.getMessage(), 0));
|
|
395 |
}
|
|
396 |
returnNormal(ret);
|
|
419 | 397 |
})); |
420 | 398 |
} |
421 | 399 | |
... | ... | |
434 | 412 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
435 | 413 |
public logical write(final character target) |
436 | 414 |
{ |
437 |
return write(target, new logical(false)); |
|
415 |
return write(target, new logical(false), new character());
|
|
438 | 416 |
} |
439 | 417 | |
440 | 418 |
/** |
... | ... | |
484 | 462 | |
485 | 463 |
return function(this, "Write", logical.class, new Block((Body) () -> |
486 | 464 |
{ |
487 |
writeImpl(fmtted, enc, (b, chset) -> |
|
465 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
466 |
logical ret = TypeFactory.logical(); |
|
467 |
|
|
468 |
try { |
|
469 |
Charset ch = writeImpl(out, fmtted, enc); |
|
470 |
target.assign(new String(out.toByteArray(), ch)); |
|
471 |
ret.assign(true); |
|
472 |
} |
|
473 |
catch (Exception e) |
|
488 | 474 |
{ |
489 |
target.assign(new String(b, chset)); |
|
490 |
return new logical(true); |
|
491 |
}); |
|
475 |
returnError(JsonError.newInstance(e.getMessage(), 0)); |
|
476 |
} |
|
477 |
|
|
478 |
returnNormal(ret); |
|
492 | 479 |
})); |
493 | 480 |
} |
494 | 481 | |
... | ... | |
552 | 539 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
553 | 540 |
public logical writeFile(final character _fname, final logical _fmtted, final character _enc) |
554 | 541 |
{ |
542 |
character fname = TypeFactory.initInput(_fname); |
|
555 | 543 |
logical fmtted = TypeFactory.initInput(_fmtted); |
556 | 544 |
character enc = TypeFactory.initInput(_enc); |
557 | 545 | |
558 |
return function(this, "Write", logical.class, new Block((Body) () -> |
|
546 |
return function(this, "WriteFile", logical.class, new Block((Body) () ->
|
|
559 | 547 |
{ |
560 |
writeImpl(fmtted, enc, (b, chset) -> |
|
561 |
{ |
|
562 |
Stream s = StreamFactory.openFileStream(_fname.toStringMessage(), true, false); |
|
563 |
if (s == null) |
|
564 |
{ |
|
565 |
return new logical(false); |
|
566 |
} |
|
567 |
else |
|
568 |
{ |
|
569 |
try |
|
570 |
{ |
|
571 |
s.write(b); |
|
572 |
s.close(); |
|
573 |
} |
|
574 |
catch (IOException e) |
|
575 |
{ |
|
576 |
throw new RuntimeException(e); |
|
577 |
} |
|
578 |
return new logical(true); |
|
579 |
} |
|
580 |
}); |
|
548 |
if (TextOps.isEmpty(fname)) |
|
549 |
{ |
|
550 |
undoThrow(JsonError.newInstance(ErrorManager.getInvalidParameterError("filename", this, |
|
551 |
"WriteFile", "Can not be UNKNOWN (?) or empty string."), 16055)); |
|
552 |
} |
|
553 |
|
|
554 |
Stream s = StreamFactory.openFileStream(fname.toStringMessage(), true, false); |
|
555 |
OutputStream o = new OutputStreamWrapper(s); |
|
556 |
logical ret = TypeFactory.logical(); |
|
557 |
|
|
558 |
try { |
|
559 |
writeImpl(o, fmtted, enc); |
|
560 |
|
|
561 |
ret.assign(true); |
|
562 |
} |
|
563 |
catch (Exception e) |
|
564 |
{ |
|
565 |
returnError(JsonError.newInstance(e.getMessage(), 0)); |
|
566 |
} finally { |
|
567 |
s.closeOut(); |
|
568 |
} |
|
569 |
|
|
570 |
returnNormal(ret); |
|
581 | 571 |
})); |
582 | 572 |
} |
583 | 573 | |
... | ... | |
647 | 637 | |
648 | 638 |
return function(this, "WriteStream", logical.class, new Block((Body) () -> |
649 | 639 |
{ |
650 |
if (sname.isUnknown()) |
|
651 |
{ |
|
652 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
653 |
} |
|
654 |
else |
|
655 |
{ |
|
656 |
Stream s = StreamFactory.findOutputStream(sname.toStringMessage()); |
|
657 |
if (s == null) |
|
658 |
{ |
|
659 |
returnNormal(new logical(false)); |
|
660 |
} |
|
661 |
else |
|
662 |
{ |
|
663 |
boolean pretty = fmtted != null && !fmtted.isUnknown() && fmtted.booleanValue(); |
|
664 |
OutputStream o = new OutputStreamWrapper(s); |
|
665 |
try |
|
666 |
{ |
|
667 |
JsonBackend.instance().write(o, |
|
668 |
this, pretty, |
|
669 |
enc.isUnknown() ? null : enc.toStringMessage()); |
|
670 |
returnNormal(new logical(true)); |
|
671 |
} |
|
672 |
catch (IOException e) |
|
673 |
{ |
|
674 |
log.log(Level.WARNING, "", e); |
|
675 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
676 |
} |
|
677 |
} |
|
678 |
} |
|
640 |
logical ret = TypeFactory.logical(); |
|
641 |
Stream s = StreamFactory.findOutputStream(sname.isUnknown() ? null : sname.toStringMessage()); |
|
642 |
if (s != null) |
|
643 |
{ |
|
644 |
boolean pretty = fmtted != null && !fmtted.isUnknown() && fmtted.booleanValue(); |
|
645 |
OutputStream o = new OutputStreamWrapper(s); |
|
646 | ||
647 |
try |
|
648 |
{ |
|
649 |
JsonBackend.instance().write(o, |
|
650 |
this, pretty, |
|
651 |
enc.isUnknown() ? null : enc.toStringMessage()); |
|
652 |
ret.assign(true); |
|
653 |
} |
|
654 |
catch (Exception e) |
|
655 |
{ |
|
656 |
log.log(Level.WARNING, "", e); |
|
657 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
658 |
} |
|
659 |
} |
|
660 |
|
|
661 |
returnNormal(ret); |
|
679 | 662 |
})); |
680 | 663 |
} |
681 | 664 | |
... | ... | |
739 | 722 |
* @param converter |
740 | 723 |
* Bi function instance that will receive the serialized bytes and return {@code BaseDateType} |
741 | 724 |
* value that will be "returned" with the call to {@link BlockManager#returnNormal}. |
725 |
* @throws Exception |
|
742 | 726 |
*/ |
743 |
protected void writeImpl(logical fmted, character enc, BiFunction<byte[], Charset, BaseDataType> converter)
|
|
727 |
protected Charset writeImpl(OutputStream out, logical fmted, character enc) throws Exception
|
|
744 | 728 |
{ |
745 |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
746 | 729 |
boolean pretty = fmted != null && !fmted.isUnknown() && fmted.booleanValue(); |
747 | 730 |
String legacyEnc = enc != null && !enc.isUnknown() ? enc.toStringMessage() : null; |
748 | 731 | |
749 |
try |
|
750 |
{ |
|
751 |
String javaEnc = JsonBackend.instance().write(out, this, pretty, legacyEnc); |
|
752 |
returnNormal(converter.apply(out.toByteArray(), Charset.forName(javaEnc))); |
|
753 |
} |
|
754 |
catch (UnsupportedEncodingException e) |
|
755 |
{ |
|
756 |
log.log(Level.WARNING, "", e); |
|
757 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
758 |
} |
|
759 |
catch (IOException e) |
|
760 |
{ |
|
761 |
log.log(Level.WARNING, "", e); |
|
762 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
763 |
} |
|
764 |
catch (StackUnwindException e) |
|
765 |
{ |
|
766 |
throw e; |
|
767 |
} |
|
768 |
catch (RuntimeException e) |
|
769 |
{ |
|
770 |
log.log(Level.WARNING, "", e); |
|
771 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
772 |
} |
|
732 |
return Charset.forName(JsonBackend.instance().write(out, this, pretty, legacyEnc)); |
|
733 |
|
|
773 | 734 |
} |
774 | 735 | |
775 | 736 |
/** |
... | ... | |
834 | 795 |
} |
835 | 796 |
|
836 | 797 |
/** |
837 |
* Implements the method {@link #read(TableParameter)} and {@link #read(TableParameter, logical)} for |
|
838 |
* json object and array classes. |
|
839 |
* |
|
840 |
* @param tb |
|
841 |
* Temp buffer to read. |
|
842 |
* @param omit |
|
843 |
* {@code true} to omit initial values, {@code false} otherwise. |
|
844 |
*/ |
|
845 |
protected void readImpl(TemporaryBuffer tb, final logical omit) |
|
846 |
{ |
|
847 |
ObjectBuilder jb = new ObjectBuilder(this); |
|
848 |
clear(); |
|
849 |
JsonExport export = new JsonExport(); |
|
850 |
try |
|
851 |
{ |
|
852 |
export.exportTempBuffer(tb, omit, new logical(false), jb); |
|
853 |
returnNormal(new logical(true)); |
|
854 |
} |
|
855 |
catch (PersistenceException e) |
|
856 |
{ |
|
857 |
log.log(Level.WARNING, "", e); |
|
858 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
859 |
} |
|
860 |
} |
|
861 | ||
862 |
/** |
|
863 |
* Removes all values from this json object or array. |
|
864 |
*/ |
|
865 |
protected abstract void clear(); |
|
866 | ||
867 |
/** |
|
868 | 798 |
* Json structure callback for building the json objects. |
869 | 799 |
*/ |
870 | 800 |
protected static class ObjectBuilder |
src/com/goldencode/p2j/oo/json/objectmodel/JsonObject.java 2021-02-23 07:39:32 +0000 | ||
---|---|---|
16 | 16 |
** 007 HC 20190803 Fixed an NPE condition in read(). |
17 | 17 |
** 008 CA 20191024 Added method support levels and updated the class support level. |
18 | 18 |
** 009 CA 20191013 read(handle) can load either a TEMP-TABLE or DATASET. |
19 |
** 010 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
|
19 |
** 010 ME 20210215 Fixing read methods. |
|
20 |
** 011 CA 20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy |
|
20 | 21 |
** signature. |
21 | 22 |
*/ |
22 | 23 | |
... | ... | |
79 | 80 |
import com.goldencode.p2j.oo.lang.*; |
80 | 81 |
import com.goldencode.p2j.persist.*; |
81 | 82 |
import com.goldencode.p2j.persist.serial.*; |
82 |
import com.goldencode.p2j.ui.chui.*; |
|
83 | 83 |
import com.goldencode.p2j.util.*; |
84 |
import com.goldencode.p2j.util.BlockManager.Action; |
|
85 |
import com.goldencode.p2j.util.BlockManager.Condition; |
|
84 | 86 | |
85 | 87 |
import java.io.*; |
86 | 88 |
import java.time.format.*; |
... | ... | |
114 | 116 |
{ |
115 | 117 |
externalProcedure(JsonObject.this, new Block((Body) () -> |
116 | 118 |
{ |
117 |
{ |
|
118 |
} |
|
119 |
onBlockLevel(Condition.ERROR, Action.THROW); |
|
119 | 120 |
})); |
120 | 121 |
} |
121 | 122 | |
... | ... | |
901 | 902 | |
902 | 903 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
903 | 904 |
{ |
904 |
@LegacyParameter(name = "pds", type = "HANDLE", mode = "INPUT") |
|
905 |
}) |
|
906 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
907 |
public logical read(final DataSetParameter _pds) |
|
908 |
{ |
|
909 |
return read(_pds, new logical(false)); |
|
910 |
} |
|
911 | ||
912 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
913 |
{ |
|
914 |
@LegacyParameter(name = "pds", type = "HANDLE", mode = "INPUT"), |
|
915 |
@LegacyParameter(name = "omit", type = "LOGICAL", mode = "INPUT") |
|
916 |
}) |
|
917 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
918 |
public logical read(final DataSetParameter _pds, final logical _omit) |
|
919 |
{ |
|
920 |
return read(_pds, _omit, new logical(false)); |
|
921 |
} |
|
922 | ||
923 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
924 |
{ |
|
925 |
@LegacyParameter(name = "pds", type = "HANDLE", mode = "INPUT"), |
|
926 |
@LegacyParameter(name = "omit", type = "LOGICAL", mode = "INPUT"), |
|
927 |
@LegacyParameter(name = "b4img", type = "LOGICAL", mode = "INPUT") |
|
928 |
}) |
|
929 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
930 |
public logical read(final DataSetParameter _pds, final logical _omit, final logical _b4img) |
|
931 |
{ |
|
932 |
logical omit = TypeFactory.initInput(_omit); |
|
933 |
logical b4img = TypeFactory.initInput(_b4img); |
|
934 |
|
|
935 |
return function(this, "Read", logical.class, new Block((Init) () -> |
|
936 |
{ |
|
937 |
ObjectBuilder jb = new ObjectBuilder(this); |
|
938 |
properties.clear(); |
|
939 |
try |
|
940 |
{ |
|
941 |
JsonExport export = new JsonExport(); |
|
942 |
export.exportDataSet(_pds.getDataset(), false, omit.booleanValue(), b4img.booleanValue(), jb); |
|
943 |
returnNormal(new logical(true)); |
|
944 |
} |
|
945 |
catch (PersistenceException e) |
|
946 |
{ |
|
947 |
log.log(Level.WARNING, "", e); |
|
948 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
949 |
} |
|
950 |
})); |
|
951 |
} |
|
952 | ||
953 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
954 |
{ |
|
955 | 905 |
@LegacyParameter(name = "bh", type = "HANDLE", mode = "INPUT") |
956 | 906 |
}) |
957 | 907 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
958 | 908 |
public logical read(final handle _bh) |
959 | 909 |
{ |
960 |
return read(_bh, new logical(false)); |
|
910 |
return read(_bh, new logical(false), new logical(false));
|
|
961 | 911 |
} |
962 | 912 | |
963 | 913 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
... | ... | |
968 | 918 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
969 | 919 |
public logical read(final handle _bh, final logical _omit) |
970 | 920 |
{ |
921 |
return read(_bh, _omit, new logical(false)); |
|
922 |
} |
|
923 | ||
924 |
@LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "Read", parameters = |
|
925 |
{ |
|
926 |
@LegacyParameter(name = "bh", type = "HANDLE", mode = "INPUT"), |
|
927 |
@LegacyParameter(name = "omit", type = "LOGICAL", mode = "INPUT"), |
|
928 |
@LegacyParameter(name = "b4img", type = "LOGICAL", mode = "INPUT") |
|
929 |
}) |
|
930 |
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL) |
|
931 |
public logical read(final handle _bh, final logical _omit, final logical _b4img) |
|
932 |
{ |
|
971 | 933 |
handle bh = TypeFactory.initInput(_bh); |
972 | 934 |
logical omit = TypeFactory.initInput(_omit); |
973 |
|
|
935 |
logical b4img = TypeFactory.initInput(_b4img); |
|
936 |
|
|
974 | 937 |
return function(this, "Read", logical.class, new Block((Init) () -> |
975 | 938 |
{ |
976 | 939 |
if (!bh.isUnknown()) |
... | ... | |
980 | 943 |
{ |
981 | 944 |
BufferImpl buf = (BufferImpl) res; |
982 | 945 |
TemporaryBuffer tb = (TemporaryBuffer) buf.buffer(); |
983 |
readImpl(tb, omit); |
|
946 |
returnNormal(readImpl(tb, omit)); |
|
947 |
} |
|
948 |
else if (res instanceof TempTable) |
|
949 |
{ |
|
950 |
TempTable tt = (TempTable) res; |
|
951 |
TemporaryBuffer tb = (TemporaryBuffer) ((BufferImpl) tt.defaultBufferHandle().getResource()).buffer(); |
|
952 |
returnNormal(readImpl(tb, omit)); |
|
984 | 953 |
} |
985 | 954 |
else if (res instanceof DataSet) |
986 | 955 |
{ |
987 | 956 |
DataSet ds = (DataSet) res; |
988 |
read(new DataSetParameter(ds), omit);
|
|
957 |
returnNormal(readImpl(ds, omit, b4img));
|
|
989 | 958 |
} |
990 | 959 |
else |
991 | 960 |
{ |
... | ... | |
1427 | 1396 |
/** |
1428 | 1397 |
* Removes all values from this json object or array. |
1429 | 1398 |
*/ |
1430 |
@Override |
|
1431 | 1399 |
protected void clear() |
1432 | 1400 |
{ |
1433 | 1401 |
for (Map.Entry<String, Object> e : properties.entrySet()) |
... | ... | |
1598 | 1566 |
returnError(ObjectOps.newInstance(JsonError.class)); |
1599 | 1567 |
} |
1600 | 1568 |
} |
1569 |
|
|
1570 |
protected logical readImpl(TemporaryBuffer tb, final logical omit) |
|
1571 |
{ |
|
1572 |
return function(this, "Read", logical.class, new Block((Body) () -> { |
|
1573 |
ObjectBuilder jb = new ObjectBuilder(this); |
|
1574 |
JsonExport export = new JsonExport(); |
|
1575 | ||
1576 |
try |
|
1577 |
{ |
|
1578 |
export.exportTempBuffer(tb, omit, new logical(false), jb); |
|
1579 |
returnNormal(new logical(true)); |
|
1580 |
} |
|
1581 |
catch (PersistenceException e) |
|
1582 |
{ |
|
1583 |
log.log(Level.WARNING, "", e); |
|
1584 |
returnError(ObjectOps.newInstance(JsonError.class)); |
|
1585 |
} |