mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 12:02:57 +00:00
RecordParser
This commit is contained in:
parent
f823d70a63
commit
6e67938553
@ -161,11 +161,19 @@ class DataDeserializer {
|
|||||||
|
|
||||||
var template = Warehouse.getTemplateByClassId(classId, TemplateType.Record);
|
var template = Warehouse.getTemplateByClassId(classId, TemplateType.Record);
|
||||||
|
|
||||||
var initRecord = (TypeTemplate template) =>
|
var initRecord = (TypeTemplate? template) =>
|
||||||
listParser(data, offset, length, connection, requestSequence).then((r) {
|
listParser(data, offset, length, connection, requestSequence).then((r) {
|
||||||
var ar = r as List;
|
var ar = r as List;
|
||||||
IRecord record;
|
IRecord record;
|
||||||
|
|
||||||
|
if (template == null) {
|
||||||
|
reply.triggerError(AsyncException(
|
||||||
|
ErrorType.Management,
|
||||||
|
ExceptionCode.TemplateNotFound.index,
|
||||||
|
"Template not found for record."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (template.definedType != null) {
|
if (template.definedType != null) {
|
||||||
record = Warehouse.createInstance(template.definedType!) as IRecord;
|
record = Warehouse.createInstance(template.definedType!) as IRecord;
|
||||||
} else {
|
} else {
|
||||||
@ -184,19 +192,12 @@ class DataDeserializer {
|
|||||||
|
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
initRecord(template);
|
initRecord(template);
|
||||||
} else {
|
} else if (connection != null) {
|
||||||
if (connection == null)
|
|
||||||
throw Exception("Can't parse record with no connection");
|
|
||||||
|
|
||||||
connection.getTemplate(classId).then((tmp) {
|
connection.getTemplate(classId).then((tmp) {
|
||||||
if (tmp == null)
|
|
||||||
reply.triggerError(AsyncException(
|
|
||||||
ErrorType.Management,
|
|
||||||
ExceptionCode.TemplateNotFound.index,
|
|
||||||
"Template not found for record."));
|
|
||||||
else
|
|
||||||
initRecord(tmp);
|
initRecord(tmp);
|
||||||
}).error((x) => reply.triggerError(x));
|
}).error((x) => reply.triggerError(x));
|
||||||
|
} else {
|
||||||
|
initRecord(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
@ -322,10 +323,10 @@ class DataDeserializer {
|
|||||||
offset += valueRep.size;
|
offset += valueRep.size;
|
||||||
length -= valueRep.size;
|
length -= valueRep.size;
|
||||||
|
|
||||||
|
|
||||||
var keyRuntimeType = keyRep.type.getRuntimeType();
|
var keyRuntimeType = keyRep.type.getRuntimeType();
|
||||||
|
|
||||||
var map = keyRuntimeType == null ? Map() : Warehouse.createMap(keyRuntimeType);
|
var map =
|
||||||
|
keyRuntimeType == null ? Map() : Warehouse.createMap(keyRuntimeType);
|
||||||
var rt = new AsyncReply();
|
var rt = new AsyncReply();
|
||||||
|
|
||||||
var results = new AsyncBag();
|
var results = new AsyncBag();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user