13 #ifndef mitkDataStorageBridge_h
14 #define mitkDataStorageBridge_h
24 #include <nlohmann/json.hpp>
80 static constexpr
const char* INTERNAL_PROPERTY_PREFIX =
"restapi.";
88 static constexpr
const char* MODIFIED_PROPERTY_KEY =
"restapi.modified";
91 static constexpr
const char* LAST_MODIFICATION_PROPERTY_KEY =
"restapi.lastmodification";
195 std::optional<Json>
GetNode(
const std::string& uid)
const;
339 const std::string& uid,
340 const std::string& key,
353 const std::string& uid,
354 const std::string& key,
367 const std::string& uid,
368 const std::string& key,
389 const std::string& uid,
390 const Json& properties,
414 NodePredicateBase::Pointer BuildNodePredicate(
const NodeQueryParams& params)
const;
417 std::string BuildNodePath(
const DataNode* node)
const;
418 int GetChildrenCount(
const DataNode* node)
const;
426 void DispatchTask(std::function<
void()> task)
const;
434 template <
typename R>
435 R DispatchTask(std::function<R()> task)
const;
439 std::unique_ptr<NodeUidMapper> m_UidMapper;
443 mutable std::mutex m_Mutex;
#define MITKRESTAPI_EXPORT
Base class of all data objects.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Thread-safe bridge between the REST API layer and MITK DataStorage.
DeleteResult DeleteNode(const std::string &uid, bool recursive=false)
Delete a node.
DataStorageBridge(const DataStorageBridge &)=delete
std::optional< Json > GetNodeProperty(const std::string &uid, const std::string &key, const PropertyQueryParams ¶ms={}) const
Get a single property of a node.
std::optional< Json > GetNodeProperties(const std::string &uid, const PropertyQueryParams ¶ms={}) const
Get properties of a node with scope filtering.
void SetDataStorage(DataStorage *dataStorage)
Set the DataStorage to operate on.
DataStorage::Pointer GetDataStorage() const
Get the current DataStorage.
std::optional< Json > GetNodeAvailableContexts(const std::string &uid) const
Get available property contexts for a node.
NodeQueryResult GetNodes(const NodeQueryParams ¶ms) const
Get nodes with full query parameter support.
OperationStatus SetNodeData(const std::string &uid, BaseData *data)
Set or replace the data on a node.
OperationStatus DeleteNodeProperty(const std::string &uid, const std::string &key, const PropertyQueryParams ¶ms)
Delete a property from a node.
bool UpdateNode(const std::string &uid, const Json &updates)
Update a node.
DataStorageBridge(DataStorageBridge &&)=delete
ReplacePropertiesResult ReplaceNodeProperties(const std::string &uid, const Json &properties, const PropertyQueryParams ¶ms)
Replace all properties on a node (PUT semantics).
DataNode::ConstPointer FindDataNode(const std::string &uid) const
Look up a DataNode by UID.
std::string GetNodeUid(DataNode *node) const
Get the UID for a DataNode.
OperationStatus SetNodeProperty(const std::string &uid, const std::string &key, const Json &value, const PropertyQueryParams ¶ms)
Set a single property on a node.
bool HasDataStorage() const
Check if a DataStorage is connected.
CreateNodeResult CreateNode(const Json &nodeData, const std::optional< std::string > &parentUid=std::nullopt)
Create a new node.
DataStorageBridge & operator=(DataStorageBridge &&)=delete
DataStorageBridge & operator=(const DataStorageBridge &)=delete
GetNodeDataResult GetNodeData(const std::string &uid) const
Get a clone of the node's data for thread-safe processing.
OperationStatus
Status codes for mutation operations.
std::optional< Json > GetNode(const std::string &uid) const
Get a single node by UID.
void SetDispatcher(StorageThreadDispatcherBase *dispatcher)
Set the dispatcher for thread-safe DataStorage operations.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Abstract base class for dispatching tasks to the thread that owns DataStorage.
A weak pointer that observes an itk::Object without preventing its deletion.
Find image slices visible on a given plane.
Result of a node creation operation.
std::string uid
UID of the created node (empty if failed)
bool success
Whether the node was created.
std::vector< std::string > failedProperties
Property keys that failed to deserialize.
Result of a node deletion operation.
std::string deletedUid
UID of the deleted node.
std::vector< std::string > deletedChildren
UIDs of deleted children (if recursive)
int childrenCount
Number of children (for error reporting)
bool success
Whether deletion succeeded.
Result of a GetNodeData operation.
BaseData::Pointer data
Clone of the data, or nullptr if node has no data.
bool nodeFound
Whether the node with the given UID exists.
Result of a node query with pagination metadata.
Json nodes
Array of node objects.
int offset
Offset used in query.
int totalCount
Total number of matching nodes (before pagination)
int limit
Limit used in query.
Result of a ReplaceNodeProperties operation.
Query parameters for the GET /datastorage/nodes endpoint.
Query parameters for the GET /datastorage/nodes/{uid}/properties endpoint.