|
| 1 | +package org.cloudfoundry.multiapps.controller.core.auditlogging.model; |
| 2 | + |
| 3 | +import org.cloudfoundry.multiapps.mta.model.ConfigurationIdentifier; |
| 4 | + |
| 5 | +import java.util.HashMap; |
| 6 | +import java.util.List; |
| 7 | +import java.util.Map; |
| 8 | + |
| 9 | +public class ExtentensionAuditLog extends CustomAuditLog { |
| 10 | + |
| 11 | + private String performedAction; |
| 12 | + private String configuration; |
| 13 | + private Map<String, String> parameters; |
| 14 | + public ExtentensionAuditLog(String userId, String spaceId, String performedAction, String configuration) { |
| 15 | + super(userId, spaceId); |
| 16 | + this.performedAction = performedAction; |
| 17 | + this.configuration = configuration; |
| 18 | + this.parameters = new HashMap<>(); |
| 19 | + } |
| 20 | + |
| 21 | + public ExtentensionAuditLog(String userId, String spaceId, String performedAction, String configuration, Map<String, String> parameters) { |
| 22 | + this(userId, spaceId, performedAction, configuration); |
| 23 | + this.parameters = parameters; |
| 24 | + } |
| 25 | + |
| 26 | + @Override |
| 27 | + public String getPerformedAction() { |
| 28 | + return performedAction; |
| 29 | + } |
| 30 | + |
| 31 | + @Override |
| 32 | + public String getConfigurationType() { |
| 33 | + return configuration; |
| 34 | + } |
| 35 | + |
| 36 | + @Override |
| 37 | + public String getConfigurationName() { |
| 38 | + return configuration; |
| 39 | + } |
| 40 | + |
| 41 | + @Override |
| 42 | + public List<ConfigurationIdentifier> getConfigurationIdentifiers() { |
| 43 | + List<ConfigurationIdentifier> configurationIdentifier = super.getConfigurationIdentifiers(); |
| 44 | + for (var parameter : parameters.entrySet()) { |
| 45 | + if (parameter.getValue() != null) { |
| 46 | + configurationIdentifier.add(new ConfigurationIdentifier(parameter.getKey(), parameter.getValue())); |
| 47 | + } |
| 48 | + } |
| 49 | + return configurationIdentifier; |
| 50 | + } |
| 51 | +} |
0 commit comments