- CPS-731Getting issue details... STATUS
Scope
It should be able to query all cm handles with a given set of public cm handle properties.
Requirements
- We want all cm-Handles where both things are true.
- Those properties also need to exist.
- If query body does not follow supported structure return 400.
- Empty query will return all cm-Handles.
A/C:
- Demo - with "and" behavior
- CI Test - two attributes
Issues/Decisions
Issue | Notes | Decision | |
---|---|---|---|
1 | Does request body need to declare "publicCmHandleProperties"? | Do we need to explcitly declare "publicCmHandleProperties"? Will there be another possible variation to this in the future? { "publicCmHandleProperties" : { "Name-1" : "some-value", "Name-2" : "other-value" } } | Not another variation but there will be "modules" included in future implementations. |
2 | Do we need to consider if cm handle exists? | ||
3 | Are public properties always be in the format of "name" : x, "value": y? | In the fragment table there are example that follow this format { "name": "Contact", "value": "newemailforstore@bookstore.com" } | Yes. |
4 | Will there only ever be 2 kv pairs in public properties? | Yes | |
5 | Does the order matter? | Does { "publicCmHandleProperties" : { "Name-1" : "some-value", "Name-2" : "other-value" } } == { "publicCmHandleProperties" : { "Name-2" : "other-value", "Name-1" : "some-value" } } | No, they are independent but they however will need to in this order in the database. |
6 | Should search be case sensitive? |
Analysis/Implementation Proposal
High level Jiras:
- - CPS-901Getting issue details... STATUS
- - CPS-902Getting issue details... STATUS
- - CPS-903Getting issue details... STATUS
- - CPS-904Getting issue details... STATUS
Possible High-Level Implementation Steps:
Match all xpaths that contain "public" in fragment table
SELECT xpath, attributes #>> '{}' FROM fragment WHERE fragment.xpath LIKE '%public%';
Iterate over the list and retrieve all attributes
- Iterate over the attributes and collect those instances that match
- Return collected list of cm handles
Interface Proposal
# | URI | Design Notes | Comment(s) |
---|---|---|---|
1 | POST /ncmp/v1/data/ch/searches | Scenario : Request received to return all cm handles matching properties given Request Body { "publicCmHandleProperties" : { "Name-1" : "some-value", "Name-2" : "other-value" } } Response Body [ "cmHandle1", "cmHandle2", ..., "cmHandleN" ] |
Below is a sample yaml for OpenAPI.
Public Properties are stored in the fragment table in CPS as seen below:
Future Example (Out-of-scope)
POST /ncmp/v1/data/ch/searches
{ "publicCmHandleProperties" : { "publicPropertyName-1" : "publicPropertyValue-1", "publicPropertyName-2" : "publicPropertyValue-2" }, "modules": [ { "moduleName": "", (Mandatory) "revision": "" (Optional) } ] }
Modules in the example are to demonstrate future intentions but is out of scope for this user story.
References
CPS Swagger: http://localhost:8883/swagger-ui/index.html?configUrl=%2Fv3%2Fapi-docs%2Fswagger-config