X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sdnr%2Fwt%2Fdata-provider%2Fsetup%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fccsdk%2Ffeatures%2Fsdnr%2Fwt%2Fdataprovider%2Fsetup%2FReleaseInformation.java;h=ccae07c0ed4f1e879d20874ba5883661617f0240;hb=1745412d0e9684a97ce6ee5271f10b6fc9a16dc6;hp=f45d5e7d54b01bb78ac32263e58aa3549c97a430;hpb=a9c139f239c4f33a768617f4952fc913ba2381b5;p=ccsdk%2Ffeatures.git diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java index f45d5e7d5..ccae07c0e 100644 --- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java +++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java @@ -37,13 +37,17 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.guilin.GuilinReleaseIn public abstract class ReleaseInformation { + // variables private final Release release; private final Map dbMap; + // end of variables + // constructors public ReleaseInformation(Release r, Map dbMap) { this.release = r; this.dbMap = dbMap; } + // end of constructors /** * get database alias for component @@ -51,28 +55,37 @@ public abstract class ReleaseInformation { * @return alias or null if not exists */ public String getAlias(ComponentName name) { - return this.getAlias(name,""); + return this.getAlias(name, ""); } - public String getAlias(ComponentName name,String prefix) { - return dbMap.get(name) == null ? null : prefix+dbMap.get(name).alias; + + public String getAlias(ComponentName name, String prefix) { + return dbMap.get(name) == null ? null : prefix + dbMap.get(name).alias; } /** - * @param c - * @return + * get index name for component + * @param comp + * @return null if component does not exists in this release, otherwise index name */ - public String getIndex(ComponentName name) { - return this.getIndex(name,""); + public String getIndex(ComponentName comp) { + return this.getIndex(comp, ""); } - public String getIndex(ComponentName name,String prefix) { - return dbMap.get(name) == null ? null : (prefix+dbMap.get(name).getIndex(this.release.getDBSuffix())); + + /** + * get index name for component with prefix + * @param comp + * @param prefix + * @return null if component does not exists in this release, otherwise index name + */ + public String getIndex(ComponentName comp, String prefix) { + return dbMap.get(comp) == null ? null : (prefix + dbMap.get(comp).getIndex(this.release.getDBSuffix())); } /** - * get database datatype (doctype) for component - * @param name - * @return datatype or null if not exists - */ + * get database datatype (doctype) for component + * @param name + * @return datatype or null if not exists + */ public String getDataType(ComponentName name) { return dbMap.get(name) == null ? null : dbMap.get(name).doctype; } @@ -80,20 +93,22 @@ public abstract class ReleaseInformation { public String getDatabaseMapping(ComponentName name) { return dbMap.get(name) == null ? null : dbMap.get(name).getMapping(); } - /** + + /** * get database doctype definition for component * @param name * @return mappings or null if not exists */ - public String getDatabaseMapping(ComponentName name,boolean useStrict) { + public String getDatabaseMapping(ComponentName name, boolean useStrict) { return dbMap.get(name) == null ? null : dbMap.get(name).getMapping(useStrict); } + /** * get database settings definition for component * @param name * @return settings or null if not exists */ - public String getDatabaseSettings(ComponentName name,int shards,int replicas) { + public String getDatabaseSettings(ComponentName name, int shards, int replicas) { return dbMap.get(name) == null ? null : dbMap.get(name).getSettings(shards, replicas); } @@ -104,7 +119,7 @@ public abstract class ReleaseInformation { * @return */ public SearchHitConverter getConverter(Release dst, ComponentName comp) { - if(dst==this.release && this.getComponents().contains(comp)) { + if (dst == this.release && this.getComponents().contains(comp)) { return new KeepDataSearchHitConverter(comp); } return null; @@ -135,7 +150,7 @@ public abstract class ReleaseInformation { * @return */ public boolean hasOwnDbIndex(ComponentName component) { - return this.getDatabaseMapping(component)!=null; + return this.getDatabaseMapping(component) != null; } /** @@ -143,18 +158,18 @@ public abstract class ReleaseInformation { * @return true if components of this release are covered by the given indices */ protected boolean containsIndices(IndicesEntryList indices) { - - if(this.dbMap.size()<=0) { + + if (this.dbMap.size() <= 0) { return false; } - for(DatabaseInfo entry:this.dbMap.values()) { + for (DatabaseInfo entry : this.dbMap.values()) { String dbIndexName = entry.getIndex(this.release.getDBSuffix()); - if(indices.findByIndex(dbIndexName)==null) { + if (indices.findByIndex(dbIndexName) == null) { return false; } } return true; - + } /** @@ -163,13 +178,11 @@ public abstract class ReleaseInformation { */ protected abstract boolean runPreInitCommands(HtDatabaseClient dbClient); - /** * * @param dbClient * @return if succeeded or not */ protected abstract boolean runPostInitCommands(HtDatabaseClient dbClient); - }