use of org.keycloak.component.SubComponentFactory in project keycloak by keycloak.
the class ComponentResource method toComponentTypeRepresentation.
private ComponentTypeRepresentation toComponentTypeRepresentation(ProviderFactory factory, ComponentModel parent) {
ComponentTypeRepresentation rep = new ComponentTypeRepresentation();
rep.setId(factory.getId());
ComponentFactory componentFactory = (ComponentFactory) factory;
rep.setHelpText(componentFactory.getHelpText());
List<ProviderConfigProperty> props;
Map<String, Object> metadata;
if (factory instanceof SubComponentFactory) {
props = ((SubComponentFactory) factory).getConfigProperties(realm, parent);
metadata = ((SubComponentFactory) factory).getTypeMetadata(realm, parent);
} else {
props = componentFactory.getConfigProperties();
metadata = componentFactory.getTypeMetadata();
}
List<ConfigPropertyRepresentation> propReps = ModelToRepresentation.toRepresentation(props);
rep.setProperties(propReps);
rep.setMetadata(metadata);
return rep;
}
Aggregations