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;
}
Aggregations