Search in sources :

Example 1 with ArangoDBFeature

use of org.ff4j.arangodb.document.ArangoDBFeature in project ff4j by ff4j.

the class FeatureStoreArangoDB method updateFeature.

private void updateFeature(Feature fp) {
    try {
        ArangoDBFeature arangoDBFeature = StoreMapper.toFeatureStore(fp);
        featureClient.replaceDocument(fp.getUid(), arangoDBFeature);
    } catch (ArangoDBException e) {
        throw new FeatureAccessException(fp.getUid(), e);
    }
}
Also used : FeatureAccessException(org.ff4j.exception.FeatureAccessException) ArangoDBFeature(org.ff4j.arangodb.document.ArangoDBFeature) ArangoDBException(com.arangodb.ArangoDBException)

Example 2 with ArangoDBFeature

use of org.ff4j.arangodb.document.ArangoDBFeature in project ff4j by ff4j.

the class FeatureStoreArangoDB method create.

/**
 * {@inheritDoc}
 */
@Override
public void create(final Feature fp) {
    assertFeatureNotNull(fp);
    assertFeatureNotExist(fp.getUid());
    ArangoDBFeature arangoDbFeature = StoreMapper.toFeatureStore(fp);
    insertFeature(arangoDbFeature);
}
Also used : ArangoDBFeature(org.ff4j.arangodb.document.ArangoDBFeature)

Example 3 with ArangoDBFeature

use of org.ff4j.arangodb.document.ArangoDBFeature in project ff4j by ff4j.

the class StoreMapper method fromFeatureStore.

public static Feature fromFeatureStore(ArangoDBFeature f) {
    Map<String, Property<?>> customProperties = convertMap(f.getCustomProperties(), StoreMapper::fromPropertyStore);
    Feature feature = new Feature(f.getId());
    feature.setEnable(f.isEnable());
    feature.setDescription(f.getDescription());
    feature.setGroup(f.getGroup());
    feature.setPermissions(f.getPermissions());
    feature.setFlippingStrategy(f.getFlippingStrategy());
    feature.setCustomProperties(customProperties);
    return feature;
}
Also used : ArangoDBProperty(org.ff4j.arangodb.document.ArangoDBProperty) Property(org.ff4j.property.Property) ArangoDBFeature(org.ff4j.arangodb.document.ArangoDBFeature) Feature(org.ff4j.core.Feature)

Aggregations

ArangoDBFeature (org.ff4j.arangodb.document.ArangoDBFeature)3 ArangoDBException (com.arangodb.ArangoDBException)1 ArangoDBProperty (org.ff4j.arangodb.document.ArangoDBProperty)1 Feature (org.ff4j.core.Feature)1 FeatureAccessException (org.ff4j.exception.FeatureAccessException)1 Property (org.ff4j.property.Property)1