use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemService method getConnectorConfiguration.
@Override
@Transactional
public IcConnectorConfiguration getConnectorConfiguration(SysSystemDto system) {
Assert.notNull(system);
if (system.getConnectorKey() == null) {
return null;
}
IcConnectorConfiguration connectorConfig = null;
// load connector properties, different between local and remote
IcConnectorInstance connectorInstance = system.getConnectorInstance();
if (system.isRemote() && connectorInstance.getConnectorServer() != null) {
connectorInstance.getConnectorServer().setPassword(confidentialStorage.getGuardedString(system.getId(), SysSystem.class, SysSystemService.REMOTE_SERVER_PASSWORD));
}
connectorConfig = icConfigurationFacade.getConnectorConfiguration(connectorInstance);
// load filled form values
IdmFormDefinitionDto formDefinition = getConnectorFormDefinition(system.getConnectorInstance());
IdmFormInstanceDto formValues = getFormService().getFormInstance(system, formDefinition);
Map<String, List<IdmFormValueDto>> attributeValues = formValues.toValueMap();
// fill connector configuration from form values
IcConnectorConfigurationImpl icConf = null;
if (SysSystemService.CONNECTOR_FRAMEWORK_CZECHIDM.equals(connectorInstance.getConnectorKey().getFramework())) {
// For CzechIdM connector framework is needs system ID (exactly for virtual systems).
icConf = new IcConnectorConfigurationCzechIdMImpl();
((IcConnectorConfigurationCzechIdMImpl) icConf).setSystemId(system.getId());
} else {
icConf = new IcConnectorConfigurationImpl();
}
IcConfigurationProperties properties = new IcConfigurationPropertiesImpl();
icConf.setConfigurationProperties(properties);
//
for (short seq = 0; seq < connectorConfig.getConfigurationProperties().getProperties().size(); seq++) {
IcConfigurationProperty propertyConfig = connectorConfig.getConfigurationProperties().getProperties().get(seq);
IdmFormAttributeDto formAttribute = formDefinition.getMappedAttributeByCode(propertyConfig.getName());
List<IdmFormValueDto> eavAttributeValues = attributeValues.get(formAttribute.getCode());
// create property instance from configuration
IcConfigurationProperty property = formPropertyManager.toConnectorProperty(propertyConfig, eavAttributeValues);
if (property.getValue() != null) {
// only filled values to configuration
properties.getProperties().add(property);
}
}
return icConf;
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemService method createConnectorFormDefinition.
/**
* Create form definition to given connectorInstance by connector properties
*
* @param connectorKey
* @return
*/
private synchronized IdmFormDefinitionDto createConnectorFormDefinition(IcConnectorInstance connectorInstance) {
IcConnectorConfiguration conf = icConfigurationFacade.getConnectorConfiguration(connectorInstance);
if (conf == null) {
throw new IllegalStateException(MessageFormat.format("Connector with key [{0}] was not found on classpath.", connectorInstance.getConnectorKey().getFullName()));
}
//
List<IdmFormAttributeDto> formAttributes = new ArrayList<>();
for (short seq = 0; seq < conf.getConfigurationProperties().getProperties().size(); seq++) {
IcConfigurationProperty property = conf.getConfigurationProperties().getProperties().get(seq);
IdmFormAttributeDto attribute = formPropertyManager.toFormAttribute(property);
attribute.setSeq(seq);
formAttributes.add(attribute);
}
return getFormService().createDefinition(SysSystem.class.getName(), connectorInstance.getConnectorKey().getFullName(), formAttributes);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class IdentityReportExecutor method getFormAttributes.
/**
* Filter form attributes:
* - enabled / disabled identities
*/
@Override
protected List<IdmFormAttributeDto> getFormAttributes() {
IdmFormAttributeDto disabled = new IdmFormAttributeDto(IdmIdentityFilter.PARAMETER_DISABLED, "Disabled identities", PersistentType.BOOLEAN);
// we want select box instead simple checkbox (null value is needed)
disabled.setFaceType(BaseFaceType.BOOLEAN_SELECT);
disabled.setPlaceholder("All identities or select ...");
return Lists.newArrayList(disabled);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class BasicVirtualConnector method updateFormDefinition.
/**
* Create/Update form definition and attributes
*
* @param key
* @param type
* @param system
* @param virtualConfiguration
* @return
*/
private IdmFormDefinitionDto updateFormDefinition(String key, String type, SysSystemDto system, BasicVirtualConfiguration virtualConfiguration) {
// TODO: delete attribute definitions
IdmFormDefinitionDto definition = this.formService.getDefinition(type, key);
List<IdmFormAttributeDto> formAttributes = new ArrayList<>();
Arrays.asList(virtualConfiguration.getAttributes()).forEach(virtualAttirbute -> {
IdmFormAttributeDto formAttribute = formAttributeService.findAttribute(type, key, virtualAttirbute);
if (formAttribute == null) {
formAttribute = createFromAttribute(virtualAttirbute);
formAttribute.setFormDefinition(definition == null ? null : definition.getId());
formAttributes.add(formAttribute);
}
});
if (definition == null) {
IdmFormDefinitionDto createdDefinition = this.formService.createDefinition(type, key, formAttributes);
createdDefinition.setName(MessageFormat.format("Virtual system for [{0}]", system.getName()));
createdDefinition.setUnmodifiable(true);
return this.formService.saveDefinition(createdDefinition);
} else {
formAttributes.forEach(formAttribute -> {
this.formService.saveAttribute(formAttribute);
});
return definition;
}
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto in project CzechIdMng by bcvsolutions.
the class BasicVirtualConnector method createFromAttribute.
private IdmFormAttributeDto createFromAttribute(String virtualAttirbute) {
IdmFormAttributeDto formAttribute = new IdmFormAttributeDto();
formAttribute.setCode(virtualAttirbute);
formAttribute.setConfidential(false);
formAttribute.setPersistentType(PersistentType.TEXT);
formAttribute.setMultiple(false);
formAttribute.setName(virtualAttirbute);
formAttribute.setRequired(false);
return formAttribute;
}
Aggregations