X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=sdnc-a1-controller%2Fnorthbound%2Fnonrt-ric-api%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fsdnc%2Fnorthbound%2Frestadapter%2FNearRicUrlProvider.java;h=b74d1031bcdae8f5e512aeca67d7799f34a8eb12;hb=a50be482f7f5fccf4898e622b83563a5f6365c29;hp=46d489bb3552987c0d3b67712dad0e990bdd18f2;hpb=63b84719a2f722598fdc626de5cf42fc9cd424da;p=nonrtric.git diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/NearRicUrlProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/NearRicUrlProvider.java index 46d489bb..b74d1031 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/NearRicUrlProvider.java +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/NearRicUrlProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,12 +31,10 @@ import org.springframework.web.util.UriComponentsBuilder; public class NearRicUrlProvider { - public NearRicUrlProvider() { - } - /** * Retrieve the base url of the Near-RIC * + * @param nearRtRicUrl the near-rt-ric url * @return the base url */ public String getBaseUrl(final String nearRtRicUrl) { @@ -45,45 +43,61 @@ public class NearRicUrlProvider { } /** - * Retrieve the policy type ids url + * Retrieve the policytypes url * - * @return the policytype ids url + * @param nearRtRicUrl the near-rt-ric url + * @return the policytypes url */ - public String getPolicyTypeIdentitiesUrl(final String nearRtRicUrl) { + public String policyTypesUrl(final String nearRtRicUrl) { return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicUrl)).pathSegment("policytypes") - .pathSegment("identities").build().toString(); + .build().toString(); } /** - * Retrieve the url of the policy instances + * Retrieve the policies url * - * @param policyTypeId Policy Type Id - * @return the policy ids url + * @param nearRtRicUrl the near-rt-ric url + * @return the policies url */ - public String getPolicyIdentitiesUrl(final String nearRtRicUrl) { + public String policiesUrl(final String nearRtRicUrl) { return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicUrl)).pathSegment("policies") - .pathSegment("identities").build().toString(); + .build().toString(); } /** * Retrieve the url of policy type * + * @param nearRtRicUrl the near-rt-ric url * @param policyTypeId Policy Type Id * @return the policy type url */ public String getPolicyTypeUrl(final String nearRtRicUrl, final String policyTypeId) { - return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicUrl)).pathSegment("policytypes") - .pathSegment(policyTypeId).build().toString(); + return UriComponentsBuilder.fromUriString(policyTypesUrl(nearRtRicUrl)).pathSegment(policyTypeId) + .build().toString(); } /** - * Retrieve the url of the policy instance id + * Retrieve the url of putPolicy * + * @param nearRtRicUrl the near-rt-ric url * @param policyId Policy Id - * @return the policy id url + * @param policyTypeId Policy Type Id + * @return the putPolicy url */ - public String getPolicyUrl(final String nearRtRicUrl, final String policyId) { - return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicUrl)).pathSegment("policies") - .pathSegment(policyId).build().toString(); + public String putPolicyUrl(final String nearRtRicUrl, final String policyId, final String policyTypeId) { + return UriComponentsBuilder.fromUriString(policiesUrl(nearRtRicUrl)) + .pathSegment(policyId + "?policyTypeId=" + policyTypeId).build().toString(); + } + + /** + * Retrieve the url of deletePolicy + * + * @param nearRtRicUrl the near-rt-ric url + * @param policyId Policy Id + * @return the deletePolicy url + */ + public String deletePolicyUrl(final String nearRtRicUrl, final String policyId) { + return UriComponentsBuilder.fromUriString(policiesUrl(nearRtRicUrl)).pathSegment(policyId) + .build().toString(); } }