MCPcopy Create free account
hub / github.com/MITK/MITK / GetNodeProperty

Method GetNodeProperty

Modules/RESTAPI/src/mitkDataStorageBridge.cpp:987–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985 }
986
987 std::optional<DataStorageBridge::Json> DataStorageBridge::GetNodeProperty(
988 const std::string& uid,
989 const std::string& key,
990 const PropertyQueryParams& params) const
991 {
992 // Reject access to internal properties (no dispatch needed for this check)
993 if (IsInternalProperty(key))
994 {
995 return std::nullopt;
996 }
997
998 std::lock_guard<std::mutex> lock(m_Mutex);
999 return this->DispatchTask<std::optional<Json>>([this, uid, key, params]()
1000 {
1001 auto dataStorage = m_DataStorage.Lock();
1002 if (dataStorage.IsNull())
1003 {
1004 return std::optional<Json>(std::nullopt);
1005 }
1006
1007 auto node = m_UidMapper->FindNodeByUid(uid);
1008 if (node == nullptr)
1009 {
1010 return std::optional<Json>(std::nullopt);
1011 }
1012
1013 auto prop = GetConstProperty(node, key, params.context, params.scope);
1014
1015 if (prop == nullptr)
1016 {
1017 return std::optional<Json>(std::nullopt);
1018 }
1019
1020 Json result = Json::object();
1021 result[key] = ConvertPropertyToSelfContainedJson(prop);
1022
1023 return std::optional<Json>(result);
1024 });
1025 }
1026
1027 DataStorageBridge::OperationStatus DataStorageBridge::SetNodeProperty(
1028 const std::string& uid,

Calls 5

IsInternalPropertyFunction · 0.85
FindNodeByUidMethod · 0.80
GetConstPropertyFunction · 0.70
LockMethod · 0.45
IsNullMethod · 0.45

Tested by

no test coverage detected