Search in sources :

Example 1 with PolicyDevelopmentEntity

use of io.gravitee.management.model.PolicyDevelopmentEntity in project gravitee-management-rest-api by gravitee-io.

the class PolicyServiceImpl method convert.

private PolicyEntity convert(PolicyPlugin policyPlugin, boolean withPlugin) {
    PolicyEntity entity = new PolicyEntity();
    entity.setId(policyPlugin.id());
    entity.setDescription(policyPlugin.manifest().description());
    entity.setName(policyPlugin.manifest().name());
    entity.setVersion(policyPlugin.manifest().version());
    if (withPlugin) {
        // Plugin information
        Plugin plugin = policyPlugin;
        PluginEntity pluginEntity = new PluginEntity();
        pluginEntity.setPlugin(plugin.clazz());
        pluginEntity.setPath(plugin.path().toString());
        pluginEntity.setType(plugin.type().toString().toLowerCase());
        pluginEntity.setDependencies(plugin.dependencies());
        entity.setPlugin(pluginEntity);
        // Policy development information
        PolicyDevelopmentEntity developmentEntity = new PolicyDevelopmentEntity();
        developmentEntity.setClassName(policyPlugin.policy().getName());
        /*
            if (policy.configuration() != null) {
                developmentEntity.setConfiguration(policyDefinition.configuration().getName());
            }

            if (policyDefinition.onRequestMethod() != null) {
                developmentEntity.setOnRequestMethod(policyDefinition.onRequestMethod().toGenericString());
            }

            if (policyDefinition.onResponseMethod() != null) {
                developmentEntity.setOnResponseMethod(policyDefinition.onResponseMethod().toGenericString());
            }
            */
        entity.setDevelopment(developmentEntity);
    }
    return entity;
}
Also used : PluginEntity(io.gravitee.management.model.PluginEntity) PolicyEntity(io.gravitee.management.model.PolicyEntity) PolicyDevelopmentEntity(io.gravitee.management.model.PolicyDevelopmentEntity) Plugin(io.gravitee.plugin.core.api.Plugin) PolicyPlugin(io.gravitee.plugin.policy.PolicyPlugin)

Aggregations

PluginEntity (io.gravitee.management.model.PluginEntity)1 PolicyDevelopmentEntity (io.gravitee.management.model.PolicyDevelopmentEntity)1 PolicyEntity (io.gravitee.management.model.PolicyEntity)1 Plugin (io.gravitee.plugin.core.api.Plugin)1 PolicyPlugin (io.gravitee.plugin.policy.PolicyPlugin)1