use of eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl in project CzechIdMng by bcvsolutions.
the class ConnIdIcConvertUtil method convertConnIdConnectorConfiguration.
public static IcConnectorConfiguration convertConnIdConnectorConfiguration(APIConfiguration conf) {
if (conf == null) {
return null;
}
IcConnectorConfigurationImpl dto = new IcConnectorConfigurationImpl();
dto.setConnectorPoolingSupported(conf.isConnectorPoolingSupported());
dto.setProducerBufferSize(conf.getProducerBufferSize());
ConfigurationProperties properties = conf.getConfigurationProperties();
IcConfigurationPropertiesImpl propertiesDto = new IcConfigurationPropertiesImpl();
if (properties != null && properties.getPropertyNames() != null) {
List<String> propertyNames = properties.getPropertyNames();
for (String name : propertyNames) {
ConfigurationProperty property = properties.getProperty(name);
IcConfigurationPropertyImpl propertyDto = (IcConfigurationPropertyImpl) convertConnIdConfigurationProperty(property);
if (propertiesDto != null) {
propertiesDto.getProperties().add(propertyDto);
}
}
}
dto.setConfigurationProperties(propertiesDto);
IcObjectPoolConfigurationImpl connectorPoolConfiguration = (IcObjectPoolConfigurationImpl) convertConnIdPoolConfiguration(conf.getConnectorPoolConfiguration());
dto.setConnectorPoolConfiguration(connectorPoolConfiguration);
dto.setOperationOptions(Collections.emptyMap());
return dto;
}
use of eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl in project CzechIdMng by bcvsolutions.
the class ConnIdIcConvertUtil method convertConnIdConfigurationProperty.
public static IcConfigurationProperty convertConnIdConfigurationProperty(ConfigurationProperty property) {
if (property == null) {
return null;
}
IcConfigurationPropertyImpl dto = new IcConfigurationPropertyImpl();
dto.setConfidential(property.isConfidential());
dto.setDisplayName(property.getDisplayName(property.getName()));
dto.setGroup(property.getGroup(null));
dto.setHelpMessage(property.getHelpMessage(null));
dto.setName(property.getName());
dto.setRequired(property.isRequired());
dto.setType(property.getType() != null ? property.getType().getName() : null);
dto.setValue(property.getValue());
return dto;
}
use of eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl in project CzechIdMng by bcvsolutions.
the class CzechIdMIcConfigurationService method initDefaultConfiguration.
/**
* Create instance of default connector configuration
*
* @param configurationClass
* @return
*/
private IcConnectorConfiguration initDefaultConfiguration(Class<? extends ConfigurationClass> configurationClass) {
try {
ConfigurationClass configurationClassInstance = configurationClass.getDeclaredConstructor().newInstance();
List<IcConfigurationProperty> properties = new ArrayList<>();
PropertyDescriptor[] descriptors = Introspector.getBeanInfo(configurationClass).getPropertyDescriptors();
Lists.newArrayList(descriptors).stream().forEach(descriptor -> {
Method readMethod = descriptor.getReadMethod();
String propertyName = descriptor.getName();
ConfigurationClassProperty property = readMethod.getAnnotation(ConfigurationClassProperty.class);
if (property != null) {
IcConfigurationPropertyImpl icProperty = (IcConfigurationPropertyImpl) CzechIdMIcConvertUtil.convertConfigurationProperty(property);
icProperty.setName(propertyName);
icProperty.setType(readMethod.getGenericReturnType().getTypeName());
try {
icProperty.setValue(readMethod.invoke(configurationClassInstance));
} catch (IllegalArgumentException | ReflectiveOperationException e) {
throw new CoreException("Cannot read value of connector configuration property!", e);
}
properties.add(icProperty);
}
});
// Sort by order
properties.sort(Comparator.comparing(IcConfigurationProperty::getOrder));
IcConfigurationPropertiesImpl icProperties = new IcConfigurationPropertiesImpl();
icProperties.setProperties(properties);
IcConnectorConfigurationImpl configuration = new IcConnectorConfigurationImpl();
configuration.setConnectorPoolingSupported(false);
configuration.setConfigurationProperties(icProperties);
return configuration;
} catch (IntrospectionException | ReflectiveOperationException e) {
throw new CoreException("Cannot read connector configuration property!", e);
}
}
use of eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl in project CzechIdMng by bcvsolutions.
the class CzechIdMIcConvertUtil method convertConfigurationProperty.
public static IcConfigurationProperty convertConfigurationProperty(ConfigurationClassProperty property) {
if (property == null) {
return null;
}
IcConfigurationPropertyImpl icProperty = new IcConfigurationPropertyImpl();
icProperty.setConfidential(property.confidential());
icProperty.setDisplayName(property.displayName());
icProperty.setHelpMessage(property.helpMessage());
icProperty.setRequired(property.required());
icProperty.setOrder(property.order());
icProperty.setFace(property.face());
return icProperty;
}
use of eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl in project CzechIdMng by bcvsolutions.
the class AbstractFormPropertyConverter method toConnectorProperty.
@Override
public IcConfigurationProperty toConnectorProperty(IcConfigurationProperty propertyConfiguration, List<IdmFormValueDto> formValues) {
Assert.notNull(propertyConfiguration, "Property configuration is required");
//
IcConfigurationPropertyImpl property = new IcConfigurationPropertyImpl();
property.setName(propertyConfiguration.getName());
property.setValue(toConnectorPropertyValue(propertyConfiguration, formValues));
return property;
}
Aggregations