use of org.apache.syncope.common.lib.types.ConnConfProperty in project syncope by apache.
the class ConnectorRestClient method getExtAttrNames.
public List<String> getExtAttrNames(final String adminRealm, final String objectClass, final String connectorKey, final Collection<ConnConfProperty> conf) {
ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setAdminRealm(adminRealm);
connInstanceTO.setKey(connectorKey);
connInstanceTO.getConf().addAll(conf);
// SYNCOPE-156: use provided info to give schema names (and type!) by ObjectClass
Optional<ConnIdObjectClassTO> connIdObjectClass = buildObjectClassInfo(connInstanceTO, false).stream().filter(object -> object.getType().equalsIgnoreCase(objectClass)).findAny();
return connIdObjectClass.isPresent() ? connIdObjectClass.get().getAttributes() : new ArrayList<>();
}
use of org.apache.syncope.common.lib.types.ConnConfProperty in project syncope by apache.
the class ConnectorRestClient method create.
public ConnInstanceTO create(final ConnInstanceTO connectorTO) {
List<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConf());
connectorTO.getConf().clear();
connectorTO.getConf().addAll(filteredConf);
ConnectorService service = getService(ConnectorService.class);
Response response = service.create(connectorTO);
return getObject(service, response.getLocation(), ConnInstanceTO.class);
}
use of org.apache.syncope.common.lib.types.ConnConfProperty in project syncope by apache.
the class ConnConfPropertyListView method populateItem.
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void populateItem(final ListItem<ConnConfProperty> item) {
final ConnConfProperty property = item.getModelObject();
final String label = StringUtils.isBlank(property.getSchema().getDisplayName()) ? property.getSchema().getName() : property.getSchema().getDisplayName();
final FieldPanel<? extends Serializable> field;
boolean required = false;
boolean isArray = false;
if (property.getSchema().isConfidential() || Constants.GUARDED_STRING.equalsIgnoreCase(property.getSchema().getType()) || Constants.GUARDED_BYTE_ARRAY.equalsIgnoreCase(property.getSchema().getType())) {
field = new AjaxPasswordFieldPanel("panel", label, new Model<>(), false);
((PasswordTextField) field.getField()).setResetPassword(false);
required = property.getSchema().isRequired();
} else {
Class<?> propertySchemaClass;
try {
propertySchemaClass = ClassUtils.getClass(property.getSchema().getType());
if (ClassUtils.isPrimitiveOrWrapper(propertySchemaClass)) {
propertySchemaClass = org.apache.commons.lang3.ClassUtils.primitiveToWrapper(propertySchemaClass);
}
} catch (ClassNotFoundException e) {
LOG.error("Error parsing attribute type", e);
propertySchemaClass = String.class;
}
if (ClassUtils.isAssignable(Number.class, propertySchemaClass)) {
@SuppressWarnings("unchecked") Class<Number> numberClass = (Class<Number>) propertySchemaClass;
field = new AjaxSpinnerFieldPanel.Builder<>().build("panel", label, numberClass, new Model<>());
required = property.getSchema().isRequired();
} else if (ClassUtils.isAssignable(Boolean.class, propertySchemaClass)) {
field = new AjaxCheckBoxPanel("panel", label, new Model<>());
} else {
field = new AjaxTextFieldPanel("panel", label, new Model<>());
required = property.getSchema().isRequired();
}
if (propertySchemaClass.isArray()) {
isArray = true;
}
}
field.setIndex(item.getIndex());
field.setTitle(property.getSchema().getHelpMessage(), true);
final AbstractFieldPanel<? extends Serializable> fieldPanel;
if (isArray) {
final MultiFieldPanel multiFieldPanel = new MultiFieldPanel.Builder(new PropertyModel<>(property, "values")).setEventTemplate(true).build("panel", label, field);
item.add(multiFieldPanel);
fieldPanel = multiFieldPanel;
} else {
setNewFieldModel(field, property.getValues());
item.add(field);
fieldPanel = field;
}
if (required) {
fieldPanel.addRequiredLabel();
}
if (withOverridable) {
fieldPanel.showExternAction(addCheckboxToggle(property));
}
}
Aggregations