Skip to content

Commit 29b8cfb

Browse files
Improve documentation and port copyDataObjectsByValue with SWIG
Renamed parameters for clarity in copyToDataspace and copyDataObjectsByValue methods, updated method documentation for accuracy and detail, and added copyDataObjectsByValue in SWIG interface.
1 parent 7c92257 commit 29b8cfb

3 files changed

Lines changed: 84 additions & 58 deletions

File tree

cmake/swigEtp1_2Include.i.in

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,37 +1943,37 @@ namespace ETP_NS
19431943
std::vector<Energistics::Etp::v12::Datatypes::Object::Dataspace> getDataspaceInfo(const std::map<std::string, std::string>& dataspaceUris);
19441944

19451945
/**
1946-
* Copy by reference some dataspaces into another one.
1946+
* A customer sends to a store to lock or unlock one or more dataspaces.
19471947
* This function should be used with caution if Dataspace OSDU Handlers have been overidden.
1948-
* It actually sends a message and block the current thread until a response has been received from the store.
1948+
* It actually sends a message and blocks the current thread until a response has been received from the store.
1949+
* An OSDU locked dataspace will have its custom data "locked" to true. It will also have its custom datm "read-only" to true for all users.
1950+
* As a reminder, a custom data "read-only" can be true with a custom data "locked" to false in case the dataspace is not locked but in read only for the particular current ETP user.
19491951
*
1950-
* @param sourceDataspaceUris ETP general map : One each for each source dataspace to be copied. They are identified by their URI.
1951-
* @param targetDataspaceUri The URI of the ETP dataspace where the sourceDataspaces have to be copied by reference.
1952-
* @param return The map keys corresponding to the dataspaces which have been successfully copied into the target dataspace.
1953-
*/
1954-
std::vector<std::string> copyDataspacesContent(const std::map<std::string, std::string>& sourceDataspaceUris, const std::string& targetDataspaceUri);
1952+
* @param dataspaceUris ETP general map where the values must be the URIs for the dataspaces the customer wants to lock or unlock.
1953+
* @param lock true for locking the dataspaces, false to unlock the dataspaces
1954+
std::vector<std::string> lockDataspaces(const std::map<std::string, std::string>& dataspaceUris, bool lock);
19551955

19561956
/**
1957-
* A customer sends to a store to lock or unlock one or more dataspaces.
1957+
* Copy by reference some dataspaces into another one.
19581958
* This function should be used with caution if Dataspace OSDU Handlers have been overidden.
1959-
* It actually sends a message and block the current thread until a response has been received from the store.
1959+
* It actually sends a message and blocks the current thread until a response has been received from the store.
19601960
*
1961-
* @param dataspaceUris ETP general map where the values must be the URIs for the dataspaces the customer wants to lock or unlock.
1962-
* @param lock true for locking the dataspaces, false to unlock the dataspaces
1963-
* @param return The map keys corresponding to the dataspaces which have been successfully locked or unlocked.
1961+
* @param sourceDataspaceUris ETP general map : One each for each source dataspace to be copied. They are identified by their URI.
1962+
* @param targetDataspaceUri The URI of the ETP dataspace where the sourceDataspaces have to be copied by reference.
1963+
* @param return The map keys corresponding to the dataspaces which have been successfully copied into the target dataspace.
19641964
*/
1965-
std::vector<std::string> lockDataspaces(const std::map<std::string, std::string>& dataspaceUris, bool lock);
1965+
std::vector<std::string> copyDataspacesContent(const std::map<std::string, std::string>& sourceDataspaceUris, const std::string& targetDataspaceUri);
19661966

19671967
/**
19681968
* Copy by reference some dataobjects into another dataspace.
19691969
* This function should be used with caution if Dataspace OSDU Handlers have been overidden.
1970-
* It actually sends a message and block the current thread until a response has been received from the store.
1970+
* It actually sends a message and blocks the current thread until a response has been received from the store.
19711971
*
1972-
* @param sourceUris ETP general map : One each for each source dataobject to be copied. They are identified by their URI.
1973-
* @param targetDataspaceUri The URI of the ETP dataspace where the source dataobjects have to be copied by reference.
1974-
* @param return The map keys corresponding to the dataobjects which have been successfully copied into the target dataspace.
1972+
* @param sourceDataobjectUris ETP general map : One for each source dataobject to be copied. They are identified by their URI.
1973+
* @param targetDataspaceUri The URI of the ETP dataspace where the source dataobjects have to be copied by reference.
1974+
* @param return The map keys corresponding to the dataobjects which have been successfully copied into the target dataspace.
19751975
*/
1976-
std::vector<std::string> copyToDataspace(const std::map<std::string, std::string>& sourceUris, const std::string& targetDataspaceUri);
1976+
std::vector<std::string> copyToDataspace(const std::map<std::string, std::string>& sourceDataobjectUris, const std::string& targetDataspaceUri);
19771977

19781978
/****************
19791979
*** DISCOVERY ***
@@ -2051,6 +2051,26 @@ namespace ETP_NS
20512051
*/
20522052
std::vector<std::string> deleteDataObjects(const std::map<std::string, std::string>& uris);
20532053

2054+
/*********************
2055+
***** STORE OSDU *****
2056+
**********************/
2057+
2058+
/**
2059+
* A customer sends to a store to copy by value a dataobject in the same dataspace with potentially some of its sources based on their datatypes.
2060+
* This function should be used with caution if Store OSDU Handlers have been overidden.
2061+
* It actually sends a message and blocks the current thread until a response has been received from the store.
2062+
*
2063+
* @param sourceDataobjectUri The URI of the dataobject to be copied.
2064+
* @param sourcesDepth The "depth" or how many "levels" (or "jumps") in the data model (graph) from the starting point (specified by the URI) that you want to copy
2065+
* Depth MUST always be greater than zero.
2066+
* @param dataObjectTypes Optionally, specify the types of data objects that you want to copy.
2067+
* The default is an empty array, which means ALL data types negotiated for the current ETP session.
2068+
* They ARE case sensitive. EXAMPLES: "witsml20.Well", "witsml20.Wellbore", "prodml21.WellTest", "resqml20.obj_TectonicBoundaryFeature", "eml21.DataAssuranceRecord"
2069+
* To indicate that all data objects within a data schema version are supported, you can use a star (*) as a wildcard, EXAMPLE: "witsml20.*", "prodml21.*", "resqml20.*"
2070+
* @param return The received dataobjects in a map where the key makes the link between the asked uris and the received dataobjects.
2071+
*/
2072+
std::vector<std::string> copyDataObjectsByValue(const std::string& sourceDataobjectUri, int32_t sourcesDepth = 0, const std::vector<std::string>& dataObjectTypes = {});
2073+
20542074
/****************
20552075
** TRANSACTION **
20562076
****************/

src/etp/AbstractSession.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,15 @@ std::vector<std::string> AbstractSession::lockDataspaces(const std::map<std::str
276276
return result;
277277
}
278278

279-
std::vector<std::string> AbstractSession::copyToDataspace(const std::map<std::string, std::string>& sourceUris, const std::string& targetDataspaceUri)
279+
std::vector<std::string> AbstractSession::copyToDataspace(const std::map<std::string, std::string>& sourceDataobjectUris, const std::string& targetDataspaceUri)
280280
{
281281
std::shared_ptr<DataspaceOSDUHandlers> handlers = getDataspaceOSDUProtocolHandlers();
282282
if (handlers == nullptr) {
283283
throw std::logic_error("You did not register any dataspace OSDU protocol handlers.");
284284
}
285285

286286
Energistics::Etp::v12::Protocol::DataspaceOSDU::CopyToDataspace msg;
287-
msg.uris = sourceUris;
287+
msg.uris = sourceDataobjectUris;
288288
msg.dataspaceUri = targetDataspaceUri;
289289
sendAndBlock(msg, 0, 0x02);
290290
std::vector<std::string> result = handlers->getSuccessKeys();
@@ -441,15 +441,15 @@ std::vector<std::string> AbstractSession::deleteDataObjects(const std::map<std::
441441
***** STORE OSDU ****
442442
*********************/
443443

444-
std::vector<std::string> AbstractSession::copyDataObjectsByValue(const std::string& uri, int32_t sourcesDepth, const std::vector<std::string>& dataObjectTypes)
444+
std::vector<std::string> AbstractSession::copyDataObjectsByValue(const std::string& sourceDataobjectUri, int32_t sourcesDepth, const std::vector<std::string>& dataObjectTypes)
445445
{
446446
std::shared_ptr<StoreOSDUHandlers> handlers = getStoreOSDUProtocolHandlers();
447447
if (handlers == nullptr) {
448448
throw std::logic_error("You did not register any store OSDU protocol handlers.");
449449
}
450450

451451
Energistics::Etp::v12::Protocol::StoreOSDU::CopyDataObjectsByValue msg;
452-
msg.uri = uri;
452+
msg.uri = sourceDataobjectUri;
453453
msg.sourcesDepth = sourcesDepth;
454454
msg.dataObjectTypes = dataObjectTypes;
455455
sendAndBlock(msg, 0, 0x02);

0 commit comments

Comments
 (0)