use of eu.bcvsolutions.idm.acc.domain.ProvisioningContext in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningOperationService method deleteConfidentialStrings.
/**
* Deletes persisted confidential storage values
*
* @param provisioningOperation
*/
protected void deleteConfidentialStrings(SysProvisioningOperationDto provisioningOperation) {
Assert.notNull(provisioningOperation);
//
ProvisioningContext context = provisioningOperation.getProvisioningContext();
if (context == null) {
return;
}
Map<ProvisioningAttributeDto, Object> accountObject = context.getAccountObject();
if (accountObject != null) {
for (Entry<ProvisioningAttributeDto, Object> entry : accountObject.entrySet()) {
Object idmValue = entry.getValue();
if (idmValue == null) {
continue;
}
// single value
if (idmValue instanceof ConfidentialString) {
confidentialStorage.delete(provisioningOperation.getId(), SysProvisioningOperation.class, ((ConfidentialString) entry.getValue()).getKey());
} else // array
if (idmValue.getClass().isArray()) {
if (!idmValue.getClass().getComponentType().isPrimitive()) {
Object[] idmValues = (Object[]) idmValue;
for (int j = 0; j < idmValues.length; j++) {
Object singleValue = idmValues[j];
if (singleValue instanceof ConfidentialString) {
confidentialStorage.delete(provisioningOperation.getId(), SysProvisioningOperation.class, ((ConfidentialString) singleValue).getKey());
}
}
}
} else // collection
if (idmValue instanceof Collection) {
Collection<?> idmValues = (Collection<?>) idmValue;
idmValues.forEach(singleValue -> {
if (singleValue instanceof ConfidentialString) {
confidentialStorage.delete(provisioningOperation.getId(), SysProvisioningOperation.class, ((ConfidentialString) singleValue).getKey());
}
});
}
}
}
//
IcConnectorObject connectorObject = context.getConnectorObject();
if (connectorObject != null) {
connectorObject.getAttributes().forEach(attribute -> {
if (attribute.getValues() != null) {
attribute.getValues().forEach(attributeValue -> {
if (attributeValue instanceof ConfidentialString) {
confidentialStorage.delete(provisioningOperation.getId(), SysProvisioningOperation.class, ((ConfidentialString) attributeValue).getKey());
}
});
}
});
}
}
Aggregations