* <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
*
* @param body YANG Patch body
+ * @param uriInfo URI info
* @param ar {@link AsyncResponse} which needs to be completed with a {@link PatchStatusContext}
*/
@PATCH
MediaTypes.APPLICATION_YANG_DATA_JSON,
MediaTypes.APPLICATION_YANG_DATA_XML
})
- public void dataYangJsonPATCH(final InputStream body, @Suspended final AsyncResponse ar) {
+ public void dataYangJsonPATCH(final InputStream body, @Context final UriInfo uriInfo,
+ @Suspended final AsyncResponse ar) {
try (var jsonBody = new JsonPatchBody(body)) {
- completeDataYangPATCH(server.dataPATCH(jsonBody), ar);
+ completeDataYangPATCH(server.dataPATCH(QueryParams.normalize(uriInfo), jsonBody), ar);
}
}
*
* @param identifier path to target
* @param body YANG Patch body
+ * @param uriInfo URI info
* @param ar {@link AsyncResponse} which needs to be completed with a {@link PatchStatusContext}
*/
@PATCH
MediaTypes.APPLICATION_YANG_DATA_XML
})
public void dataYangJsonPATCH(@Encoded @PathParam("identifier") final ApiPath identifier, final InputStream body,
- @Suspended final AsyncResponse ar) {
+ @Context final UriInfo uriInfo, @Suspended final AsyncResponse ar) {
try (var jsonBody = new JsonPatchBody(body)) {
- completeDataYangPATCH(server.dataPATCH(identifier, jsonBody), ar);
+ completeDataYangPATCH(server.dataPATCH(identifier, QueryParams.normalize(uriInfo), jsonBody), ar);
}
}
* <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
*
* @param body YANG Patch body
+ * @param uriInfo URI info
* @param ar {@link AsyncResponse} which needs to be completed with a {@link PatchStatusContext}
*/
@PATCH
MediaTypes.APPLICATION_YANG_DATA_JSON,
MediaTypes.APPLICATION_YANG_DATA_XML
})
- public void dataYangXmlPATCH(final InputStream body, @Suspended final AsyncResponse ar) {
+ public void dataYangXmlPATCH(final InputStream body, @Context final UriInfo uriInfo,
+ @Suspended final AsyncResponse ar) {
try (var xmlBody = new XmlPatchBody(body)) {
- completeDataYangPATCH(server.dataPATCH(xmlBody), ar);
+ completeDataYangPATCH(server.dataPATCH(QueryParams.normalize(uriInfo), xmlBody), ar);
}
}
* <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
*
* @param identifier path to target
+ * @param uriInfo URI info
* @param body YANG Patch body
* @param ar {@link AsyncResponse} which needs to be completed with a {@link PatchStatusContext}
*/
MediaTypes.APPLICATION_YANG_DATA_XML
})
public void dataYangXmlPATCH(@Encoded @PathParam("identifier") final ApiPath identifier, final InputStream body,
- @Suspended final AsyncResponse ar) {
+ @Context final UriInfo uriInfo, @Suspended final AsyncResponse ar) {
try (var xmlBody = new XmlPatchBody(body)) {
- completeDataYangPATCH(server.dataPATCH(identifier, xmlBody), ar);
+ completeDataYangPATCH(server.dataPATCH(identifier, QueryParams.normalize(uriInfo), xmlBody), ar);
}
}
* Ordered list of edits that are applied to the datastore by the server, as defined in
* <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
*
+ * @param queryParameters query parameters
* @param body YANG Patch body
* @return A {@link RestconfFuture} of the {@link DataYangPatchResult} content
*/
- RestconfFuture<DataYangPatchResult> dataPATCH(PatchBody body);
+ RestconfFuture<DataYangPatchResult> dataPATCH(Map<String, String> queryParameters, PatchBody body);
/**
* Ordered list of edits that are applied to the datastore by the server, as defined in
* <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
*
* @param identifier path to target
+ * @param queryParameters query parameters
* @param body YANG Patch body
* @return A {@link RestconfFuture} of the {@link DataYangPatchResult} content
*/
- RestconfFuture<DataYangPatchResult> dataPATCH(ApiPath identifier, PatchBody body);
+ RestconfFuture<DataYangPatchResult> dataPATCH(ApiPath identifier, Map<String, String> queryParameters,
+ PatchBody body);
RestconfFuture<CreateResourceResult> dataPOST(ChildBody body, Map<String, String> queryParameters);
}
@Override
- public RestconfFuture<DataYangPatchResult> dataPATCH(final PatchBody body) {
- return localStrategy().dataPATCH(ApiPath.empty(), body);
+ public RestconfFuture<DataYangPatchResult> dataPATCH(final Map<String, String> queryParameters,
+ final PatchBody body) {
+ return localStrategy().dataPATCH(ApiPath.empty(), queryParameters, body);
}
@Override
- public RestconfFuture<DataYangPatchResult> dataPATCH(final ApiPath identifier, final PatchBody body) {
+ public RestconfFuture<DataYangPatchResult> dataPATCH(final ApiPath identifier,
+ final Map<String, String> queryParameters, final PatchBody body) {
final StrategyAndTail strategyAndTail;
try {
strategyAndTail = localStrategy().resolveStrategy(identifier);
} catch (RestconfDocumentedException e) {
return RestconfFuture.failed(e);
}
- return strategyAndTail.strategy().dataPATCH(strategyAndTail.tail(), body);
+ return strategyAndTail.strategy().dataPATCH(strategyAndTail.tail(), queryParameters, body);
}
@Override
import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFalseFluentFuture;
import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateTrueFluentFuture;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.UriInfo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
class RestconfDataPatchTest extends AbstractRestconfTest {
@Mock
private DOMDataTreeReadWriteTransaction tx;
+ @Mock
+ private UriInfo uriInfo;
@BeforeEach
void beforeEach() {
doReturn(tx).when(dataBroker).newReadWriteTransaction();
+ doReturn(new MultivaluedHashMap<>()).when(uriInfo).getQueryParameters();
}
@Test
}
]
}
- }"""), ar));
+ }"""), uriInfo, ar));
assertFormat("""
{"ietf-yang-patch:yang-patch-status":{"patch-id":"test patch id","ok":[null]}}""", body::formatToJSON);
}
]
}
- }"""), ar));
+ }"""), uriInfo, ar));
assertFormat("""
{"ietf-yang-patch:yang-patch-status":{"patch-id":"test patch id","edit-status":{"edit":[\
<operation>delete</operation>
<target>/example-jukebox:jukebox/player/gap</target>
</edit>
- </yang-patch>"""), ar));
+ </yang-patch>"""), uriInfo, ar));
assertFormat("""
<yang-patch-status xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-patch">\