List of subcomponent types that are available to configure for a particular parent component.
225 if (parent == null) {
226 throw new NotFoundException(
"Could not find parent component");
228 if (subtype == null) {
229 throw new BadRequestException(
"must specify a subtype");
231 Class<? extends Provider> providerClass = null;
233 providerClass = (Class<? extends Provider>)Class.forName(subtype);
234 }
catch (ClassNotFoundException e) {
235 throw new RuntimeException(e);
237 List<ComponentTypeRepresentation> subcomponents =
new LinkedList<>();
239 ComponentTypeRepresentation rep =
new ComponentTypeRepresentation();
240 rep.setId(factory.getId());
241 if (!(factory instanceof ComponentFactory)) {
244 ComponentFactory componentFactory = (ComponentFactory)factory;
246 rep.setHelpText(componentFactory.getHelpText());
247 List<ProviderConfigProperty> props = null;
248 Map<String, Object> metadata = null;
249 if (factory instanceof SubComponentFactory) {
250 props = ((SubComponentFactory)factory).getConfigProperties(
realm, parent);
251 metadata = ((SubComponentFactory)factory).getTypeMetadata(
realm, parent);
254 props = componentFactory.getConfigProperties();
255 metadata = componentFactory.getTypeMetadata();
258 List<ConfigPropertyRepresentation> propReps = ModelToRepresentation.toRepresentation(props);
259 rep.setProperties(propReps);
260 rep.setMetadata(metadata);
261 subcomponents.add(rep);
263 return subcomponents;
List< ProviderFactory > getProviderFactories(Class<? extends Provider > clazz)
KeycloakSession session
Definition: ComponentResource.java:83
KeycloakSessionFactory getKeycloakSessionFactory()
RealmPermissionEvaluator realm()
ComponentModel getComponent(String id)
AdminPermissionEvaluator auth
Definition: ComponentResource.java:75
RealmModel realm
Definition: ComponentResource.java:73