diff options
Diffstat (limited to 'catalog-dao/src/main/java')
3 files changed, 10 insertions, 22 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java index 09d37ac03d..bae33384e4 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java @@ -26,8 +26,14 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; public final class AuditRecordFactory { public static AuditingGenericEvent createAuditRecord(Map<AuditingFieldsKeysEnum, Object> auditingFields) { + if (auditingFields == null) { + return null; + } AuditingActionEnum actionEnum = AuditingActionEnum .getActionByName((String) auditingFields.get(AuditingFieldsKeysEnum.AUDIT_ACTION)); + if (actionEnum == null) { + return null; + } String tableName = actionEnum.getAuditingEsType(); AuditingGenericEvent event = null; switch (tableName) { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java index e810925fcd..0c1352f4ec 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java @@ -104,19 +104,12 @@ public enum AuditingActionEnum { GET_ASSET_METADATA("GetAssetMetadata", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), GET_TOSCA_MODEL("GetToscaModel", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE); - private String name; - // private Class<? extends AuditingGenericEvent> auditingEsType; - private String auditingEsType; + private final String name; + private final String auditingEsType; private static Logger log = LoggerFactory.getLogger(AuditingActionEnum.class.getName()); - // AuditingActionEnum(String name, Class<? extends AuditingGenericEvent> - // auditingEsType){ - // this.name = name; - // this.auditingEsType = auditingEsType; - // } - - AuditingActionEnum(String name, String auditingEsType) { + private AuditingActionEnum(String name, String auditingEsType) { this.name = name; this.auditingEsType = auditingEsType; } @@ -125,15 +118,11 @@ public enum AuditingActionEnum { return name; } - // public Class<? extends AuditingGenericEvent> getAuditingEsType(){ - // return auditingEsType; - // } - public String getAuditingEsType() { return auditingEsType; } - public static AuditingActionEnum getActionByName(String name) { + public static AuditingActionEnum getActionByName(String name) { AuditingActionEnum res = null; AuditingActionEnum[] values = values(); for (AuditingActionEnum value : values) { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java index 9e220bf8da..7789e47766 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java @@ -76,13 +76,6 @@ public class AuditingGenericEvent extends ESTimeBasedEvent { public void setDesc(String desc) { this.desc = desc; } - // public Map<String, Object> getFields() { - // return fields; - // } - // - // public void setFields(Map<String, Object> fields) { - // this.fields = fields; - // } public void fillFields() { |