aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/provider/src/main/java
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2020-02-26 06:41:50 +0100
committerKAPIL SINGAL <ks220y@att.com>2020-02-27 14:52:20 +0000
commitee75b19ee79f49b28a3137b6dcfdf02d6120f3de (patch)
tree49a6a7b10578ee5f9780ea38f8a9408cf4cf14c7 /sdnr/wt/data-provider/provider/src/main/java
parent8f762f215f49fd4b1d498adc2cc4f98093f0ddf3 (diff)
add data migration tool
add tool for data migration and initialization Issue-ID: SDNC-1085 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: Ibd1ffeffa95d2897ae65f7d964e98941d810ffcb Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/provider/src/main/java')
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java8
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java6
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java11
3 files changed, 18 insertions, 7 deletions
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java
index 45d989d6a..5ff7a5dec 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java
@@ -120,6 +120,7 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
}
}
+
}
/**
@@ -153,6 +154,7 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
* @param mountPointNodeName
* @return
*/
+ @SuppressWarnings("null")
private boolean isRequireNe(String mountPointNodeName) {
NetworkElementConnectionEntity ne = null;
if (requiredNeRW != null) {
@@ -161,7 +163,11 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
} else {
LOG.warn("cannot read db. no db reader writer initialized");
}
- return ne != null;
+ if (ne != null && ne.isIsRequired() != null) {
+ return ne.isIsRequired();
+ } else {
+ return false;
+ }
}
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java
index db527959c..6b3c89af9 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java
@@ -17,6 +17,7 @@
******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.dataprovider.data;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -40,6 +41,7 @@ import org.slf4j.LoggerFactory;
public class QueryByFilter {
private static final Logger LOG = LoggerFactory.getLogger(DataObjectAcessorPm.class);
+ private static final List<String> timestampValueNames = Arrays.asList("timestamp","start","end");
private QueryByFilter() {
//Hide
@@ -276,7 +278,7 @@ public class QueryByFilter {
// v=v.toLowerCase();
}
if (DbFilter.hasSearchParams(v)) {
- if(p!=null && "timestamp".equals(p.toLowerCase())) {
+ if(p!=null && timestampValueNames.contains(p.toLowerCase())) {
query = fromTimestampSearchFilter(p,v);
if(query!=null) {
return query;
@@ -311,7 +313,7 @@ public class QueryByFilter {
// v=v.toLowerCase();
}
if(DbFilter.hasSearchParams(v)) {
- if(p!=null && "timestamp".equals(p.toLowerCase())) {
+ if(p!=null && timestampValueNames.contains(p.toLowerCase())) {
tmpQuery=fromTimestampSearchFilter(p,v);
if(tmpQuery!=null) {
query.must(tmpQuery);
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java
index a846cd8f3..ccfbe98fd 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java
@@ -53,7 +53,10 @@ public class EsConfig implements Configuration, IEsConfig {
private static final String DEFAULT_ARCHIVE_INTERVAL_SEC = "0";
/** keep data for this time [in seconds] 30 days */
private static final String DEFAULT_ARCHIVE_LIMIT_SEC = String.valueOf(60L * 60L * 24L * 30L);
- private static final String DEFAULT_KEY_NODE = "elasticsearchnode";
+ //private static final String DEFAULT_KEY_NODE = "elasticsearchnode";
+ private static final String DEFAULT_VALUE_NODE = "elasticsearchnode";
+ private static final String DEFAULT_VALUE_DBUSERNAME = "${SDNRDBUSERNAME}";
+ private static final String DEFAULT_VALUE_DBPASSWORD = "${SDNRDBPASSWORD}";
private final ConfigurationFileRepresentation configuration;
@@ -138,9 +141,9 @@ public class EsConfig implements Configuration, IEsConfig {
configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_CLUSTER, DEFAULT_VALUE_CLUSTER);
configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_ARCHIVE_INTERVAL,
DEFAULT_ARCHIVE_INTERVAL_SEC);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_NODE, DEFAULT_KEY_NODE);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_USERNAME, "");
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_PASSWORD, "");
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_NODE, DEFAULT_VALUE_NODE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_USERNAME, DEFAULT_VALUE_DBUSERNAME);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_PASSWORD, DEFAULT_VALUE_DBPASSWORD);
}
@Override