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 initRecord = (TypeTemplate template) =>
|
||||
var initRecord = (TypeTemplate? template) =>
|
||||
listParser(data, offset, length, connection, requestSequence).then((r) {
|
||||
var ar = r as List;
|
||||
IRecord record;
|
||||
|
||||
if (template == null) {
|
||||
reply.triggerError(AsyncException(
|
||||
ErrorType.Management,
|
||||
ExceptionCode.TemplateNotFound.index,
|
||||
"Template not found for record."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (template.definedType != null) {
|
||||
record = Warehouse.createInstance(template.definedType!) as IRecord;
|
||||
} else {
|
||||
@ -184,19 +192,12 @@ class DataDeserializer {
|
||||
|
||||
if (template != null) {
|
||||
initRecord(template);
|
||||
} else {
|
||||
if (connection == null)
|
||||
throw Exception("Can't parse record with no connection");
|
||||
|
||||
} else if (connection != null) {
|
||||
connection.getTemplate(classId).then((tmp) {
|
||||
if (tmp == null)
|
||||
reply.triggerError(AsyncException(
|
||||
ErrorType.Management,
|
||||
ExceptionCode.TemplateNotFound.index,
|
||||
"Template not found for record."));
|
||||
else
|
||||
initRecord(tmp);
|
||||
}).error((x) => reply.triggerError(x));
|
||||
} else {
|
||||
initRecord(null);
|
||||
}
|
||||
|
||||
return reply;
|
||||
@ -322,10 +323,10 @@ class DataDeserializer {
|
||||
offset += valueRep.size;
|
||||
length -= valueRep.size;
|
||||
|
||||
|
||||
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 results = new AsyncBag();
|
||||
|
Loading…
x
Reference in New Issue
Block a user