com.sap.cloud.mt.subscription.DbIdentifiersHana Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-tenant-subscription Show documentation
Show all versions of multi-tenant-subscription Show documentation
Spring Boot Enablement Parent
/******************************************************************************
* © 2020 SAP SE or an SAP affiliate company. All rights reserved. *
******************************************************************************/
package com.sap.cloud.mt.subscription;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class DbIdentifiersHana implements DbIdentifiers {
private final Set dbIds = ConcurrentHashMap.newKeySet();
public DbIdentifiersHana(Set dbIds) {
if (dbIds != null) {
this.dbIds.addAll(dbIds);
}
}
public DbIdentifiersHana(DbIdentifiersHana dbIdentifiers) {
this(dbIdentifiers != null ? dbIdentifiers.getDbIds() : null);
}
public Set getDbIds() {
return Collections.unmodifiableSet(dbIds);
}
public void add(String dbId) {
dbIds.add(dbId);
}
public void remove(String dbId) {
dbIds.remove(dbId);
}
@Override
public boolean areSet() {
return dbIds != null && !dbIds.isEmpty();
}
@Override
public DB getDB() {
return DB.HANA;
}
@Override
public DbIdentifiers createCopy() {
return new DbIdentifiersHana(this);
}
}