ModelCard record and dbase fixes

This commit is contained in:
Ralph Wessel
2024-09-16 15:00:55 +01:00
parent 8ea4ced153
commit 220c9a5a40
4 changed files with 18 additions and 6 deletions
@@ -49,7 +49,7 @@ namespace {
Constructor
--------------------------------------------------------------------*/
ModelCardDatabase::ModelCardDatabase() {
auto engine = std::make_shared<Engine>(modelCardDBaseName,
m_engine = std::make_shared<Engine>(modelCardDBaseName,
//Schema
DBaseSchema{active::utility::String{modelCardDBaseName},
//Tables
@@ -28,6 +28,18 @@ namespace connector::record {
Default constructor
*/
ModelCard() {}
/*!
Constructor
@param modelID The model ID
@param projectID The project ID
@param accountID The account ID
@param serverURL The server URL
@param settings Any BIM host-related settings relevant to the appearance/rendering of the model, e.g. LoD, if properties included etc
*/
ModelCard(const speckle::database::RecordID& modelID, const speckle::database::RecordID& projectID,
const speckle::database::RecordID& accountID, const speckle::utility::String& serverURL,
const SettingList& settings) :
m_modelID(modelID), m_projectID(projectID), m_accountID(accountID), m_serverURL(serverURL), m_settings(settings) {}
/*!
Destructor
*/
+4 -2
View File
@@ -28,12 +28,14 @@ namespace speckle::database {
/*!
Default constructor
*/
Record() : base{} {}
Record() : base{active::utility::Guid{true}.operator active::utility::String(),
active::utility::Guid{true}.operator active::utility::String()} {} //TODO: Implement a better default for the ID
/*!
Constructor
@param ID The record ID
*/
Record(speckle::utility::String ID) : base{ID} {}
Record(speckle::utility::String ID, speckle::utility::String::Option globID = std::nullopt) :
base{ID, globID.value_or(active::utility::Guid{true}.operator active::utility::String())} {}
/*!
Destructor
*/
@@ -58,13 +58,11 @@ namespace {
bool isExistingStore(active::utility::NameID& storeID) {
if (storeID.id)
return true; //We must have a store if the ID is populated
bool isStoreFound = false;
API_Guid acID;
if (auto statusCode = convertArchicadError(ACAPI_AddOnObject_GetObjectGuidFromName(String{storeID.name}, &acID)); statusCode != nominal)
throw std::system_error(DocumentStoreCore::makeError(statusCode));
storeID.id = Guid{acID};
isStoreFound = true;
return isStoreFound;
return storeID.id.operator bool(); //Returns true if the store ID is non-null, i.e. the object exists
} //isExistingStore