refs #527, JSON reading of value objects

* renamed simkey to modelstring
* allow parsing of stub objects (only foreign keys, not denormalized)
This commit is contained in:
Klaus Basan
2016-01-02 20:49:28 +01:00
parent c7121e3f9f
commit 5ab0173508
5 changed files with 26 additions and 13 deletions

View File

@@ -143,12 +143,17 @@ namespace BlackMisc
}
QString combinedCode(json.value(prefix + "combinedcode").toString());
if (combinedCode.isEmpty()) {
CLivery liveryStub; // only consists of id, maybe id and timestamp
liveryStub.setKeyAndTimestampFromDatabaseJson(json, prefix);
return liveryStub;
}
QString description(json.value(prefix + "description").toString());
CRgbColor colorFuselage(json.value(prefix + "colorfuselage").toString());
CRgbColor colorTail(json.value(prefix + "colortail").toString());
bool military = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "military").toString());
CAirlineIcaoCode airline(CAirlineIcaoCode::fromDatabaseJson(json, "al_"));
Q_ASSERT_X(description.length() > 0, Q_FUNC_INFO, "require description");
CLivery livery(combinedCode, airline, description, colorFuselage, colorTail, military);
livery.setKeyAndTimestampFromDatabaseJson(json, prefix);
return livery;