use of org.ff4j.couchdb.document.CouchDbFeature in project ff4j by ff4j.
the class FeatureStoreCouchDb method delete.
/**
* {@inheritDoc}
*/
@Override
public void delete(String uid) {
if (uid == null || uid.isEmpty()) {
throw new IllegalArgumentException(FEATURE_IDENTIFIER_CANNOT_BE_NULL_NOR_EMPTY);
}
if (!exist(uid)) {
throw new FeatureNotFoundException(uid);
}
CouchDbFeature couchDbFeature = getFeature(uid);
removeFeature(couchDbFeature);
}
use of org.ff4j.couchdb.document.CouchDbFeature in project ff4j by ff4j.
the class FeatureStoreCouchDb method enableGroup.
/**
* {@inheritDoc}
*/
@Override
public void enableGroup(String groupName) {
if (groupName == null || groupName.isEmpty()) {
throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY);
}
if (!existGroup(groupName)) {
throw new GroupNotFoundException(groupName);
}
List<CouchDbFeature> features = getFeatures(groupName);
if (null != features) {
features.forEach(f -> {
Feature feat = fromJson(f.getFeature());
if (null != feat) {
feat.setEnable(true);
f.setFeature(feat.toJson());
updateFeature(f);
}
});
}
}
Aggregations