Search in sources :

Example 1 with KildaFeatureTogglesRepository

use of org.openkilda.persistence.repositories.KildaFeatureTogglesRepository in project open-kilda by telstra.

the class AbstractYFlowTest method alterFeatureToggles.

protected void alterFeatureToggles(Boolean isCreateAllowed, Boolean isUpdateAllowed, Boolean isDeleteAllowed, Boolean isModifyYFlowEnabled) {
    KildaFeatureTogglesRepository repository = persistenceManager.getRepositoryFactory().createFeatureTogglesRepository();
    KildaFeatureToggles toggles = repository.find().orElseGet(() -> {
        KildaFeatureToggles newToggles = KildaFeatureToggles.builder().build();
        repository.add(newToggles);
        return newToggles;
    });
    if (isCreateAllowed != null) {
        toggles.setCreateFlowEnabled(isCreateAllowed);
    }
    if (isUpdateAllowed != null) {
        toggles.setUpdateFlowEnabled(isUpdateAllowed);
    }
    if (isDeleteAllowed != null) {
        toggles.setDeleteFlowEnabled(isDeleteAllowed);
    }
    if (isModifyYFlowEnabled != null) {
        toggles.setModifyYFlowEnabled(isModifyYFlowEnabled);
    }
}
Also used : KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) KildaFeatureTogglesRepository(org.openkilda.persistence.repositories.KildaFeatureTogglesRepository)

Example 2 with KildaFeatureTogglesRepository

use of org.openkilda.persistence.repositories.KildaFeatureTogglesRepository in project open-kilda by telstra.

the class AbstractFlowTest method alterFeatureToggles.

protected void alterFeatureToggles(Boolean isCreateAllowed, Boolean isUpdateAllowed, Boolean isDeleteAllowed) {
    KildaFeatureTogglesRepository repository = persistenceManager.getRepositoryFactory().createFeatureTogglesRepository();
    KildaFeatureToggles toggles = repository.find().orElseGet(() -> {
        KildaFeatureToggles newToggles = KildaFeatureToggles.builder().build();
        repository.add(newToggles);
        return newToggles;
    });
    if (isCreateAllowed != null) {
        toggles.setCreateFlowEnabled(isCreateAllowed);
    }
    if (isUpdateAllowed != null) {
        toggles.setUpdateFlowEnabled(isUpdateAllowed);
    }
    if (isDeleteAllowed != null) {
        toggles.setDeleteFlowEnabled(isDeleteAllowed);
    }
}
Also used : KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) KildaFeatureTogglesRepository(org.openkilda.persistence.repositories.KildaFeatureTogglesRepository)

Aggregations

KildaFeatureToggles (org.openkilda.model.KildaFeatureToggles)2 KildaFeatureTogglesRepository (org.openkilda.persistence.repositories.KildaFeatureTogglesRepository)2