summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-12-18 13:15:28 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2023-12-18 13:15:39 +0530
commitde91a1ce57b39449d49b3a33da53190da2a364da (patch)
tree662d28a916671c490dee69c7fdb3d3683f3c207c /sdnr/wt/data-provider
parentdfd91573b7567e1dab482f17111ab8f809553d99 (diff)
Web Client context menu item display
Irrespective of connection state of the mountpoint Issue-ID: CCSDK-3975 Change-Id: I10f785024c7cca42e4c6dfe568ecb9f2412de213 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider')
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java47
1 files changed, 30 insertions, 17 deletions
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java
index e04e109cd..02930304b 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java
@@ -28,6 +28,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBConfig;
@@ -87,6 +88,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.mediator.server.list.output.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -474,27 +476,27 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
@Override
public ReadGuiCutThroughEntryOutputBuilder readGuiCutThroughEntry(EntityInput input) {
ReadGuiCutThroughEntryOutputBuilder outputBuilder = new ReadGuiCutThroughEntryOutputBuilder();
- QueryResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> result =
- this.guicutthroughRW.getData(input);
if (!guicutthroughOverride.isEmpty()) {
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> gcData =
- result.getResult();
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> updatedGcData =
- new ArrayList<>();
- for (int i = 0; i < gcData.size(); i++) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data gcDataItem =
- gcData.get(i);
- Guicutthrough gcItem =
- new GuicutthroughBuilder().setId(gcDataItem.getId()).setName(gcDataItem.getName())
- .setWeburi(guicutthroughOverride + "/" + gcDataItem.getId()).build();
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder gcDataBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder(
- gcItem);
- updatedGcData.add(gcDataBuilder.build());
+ if (input.getFilter() != null) {
+ // Iterate through the Filter map, get the ID and populate the GuicutThrough object accordingly.
+ Map<FilterKey, Filter> inputFilter = input.getFilter();
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> gcData =
+ new ArrayList<>();
+ for (FilterKey fk : inputFilter.keySet()) {
+ String fkVal = inputFilter.get(fk).getFiltervalue();
+ if (fkVal != null) {
+ addGcItem(gcData, fkVal);
+ }
+ for (String fkVals : inputFilter.get(fk).getFiltervalues()) {
+ addGcItem(gcData, fkVals);
+ }
+ }
+ outputBuilder.setData(gcData);
}
- outputBuilder.setData(updatedGcData);
} else {
+ QueryResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> result =
+ this.guicutthroughRW.getData(input);
outputBuilder.setData(result.getResult());
}
outputBuilder.setPagination(
@@ -503,6 +505,17 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
return outputBuilder;
}
+ private void addGcItem(
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> gcData,
+ String value) {
+ Guicutthrough gcItem = new GuicutthroughBuilder().setId(value).setName(value)
+ .setWeburi(guicutthroughOverride + "/" + value).build();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder gcDataBuilder =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder(
+ gcItem);
+ gcData.add(gcDataBuilder.build());
+ }
+
@Override
public boolean waitForYellowDatabaseStatus(long timeout, TimeUnit unit) {
return true;