diff options
Diffstat (limited to 'catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java')
-rw-r--r-- | catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java | 691 |
1 files changed, 357 insertions, 334 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java index f32acc81c4..ed546301fc 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java @@ -21,11 +21,10 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.EnumMap; -import java.util.TimeZone; -import java.util.UUID; +import java.util.*; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import com.datastax.driver.core.utils.UUIDs; @@ -40,334 +39,358 @@ import com.datastax.driver.mapping.annotations.Table; */ @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE) public class ExternalApiEvent extends AuditingGenericEvent { - @PartitionKey - protected UUID timebaseduuid; - - @ClusteringColumn() - protected Date timestamp1; - - @Column - protected String action; - @Column - protected String status; - - @Column(name = "description") - protected String desc; - - @Column(name = "consumer_id") - private String consumerId; - - @Column(name = "resource_url") - private String resourceURL; - - @Column(name = "resource_name") - private String resourceName; - - @Column(name = "resource_type") - private String resourceType; - - @Column(name = "service_instance_id") - protected String serviceInstanceId; - - @Column(name = "invariant_uuid") - protected String invariantUuid; - - @Column(name = "modifier") - private String modifier; - - @Column(name = "prev_version") - protected String prevVersion; - - @Column(name = "curr_version") - private String currVersion; - - @Column(name = "prev_state") - protected String prevState; - - @Column(name = "curr_state") - protected String currState; - - @Column(name = "prev_artifact_uuid") - private String prevArtifactUuid; - - @Column(name = "curr_artifact_uuid") - private String currArtifactUuid; - - @Column(name = "artifact_data") - private String artifactData; - - public ExternalApiEvent() { - super(); - timestamp1 = new Date(); - timebaseduuid = UUIDs.timeBased(); - } - - public ExternalApiEvent(EnumMap<AuditingFieldsKeysEnum, Object> auditingFields) { - this(); - Object value; - - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_ACTION); - if (value != null) { - setAction((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_STATUS); - if (value != null) { - setStatus((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_DESC); - if (value != null) { - setDesc((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID); - if (value != null) { - setConsumerId((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL); - if (value != null) { - setResourceURL((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME); - if (value != null) { - setResourceName((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE); - if (value != null) { - setResourceType((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID); - if (value != null) { - setServiceInstanceId((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID); - if (value != null) { - setInvariantUuid((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID); - if (value != null) { - setModifier((String) value); - } - - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION); - if (value != null) { - setPrevVersion((String) value); - } - - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION); - if (value != null) { - setCurrVersion((String) value); - } - - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE); - if (value != null) { - setPrevState((String) value); - } - - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE); - if (value != null) { - setCurrState((String) value); - } - - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID); - if (value != null) { - setPrevArtifactUuid((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID); - if (value != null) { - setCurrArtifactUuid((String) value); - } - value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_ARTIFACT_DATA); - if (value != null) { - setArtifactData((String) value); - } - } - - @Override - public void fillFields() { - fields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); - fields.put(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID.getDisplayName(), getInvariantUuid()); - fields.put(AuditingFieldsKeysEnum.AUDIT_ACTION.getDisplayName(), getAction()); - fields.put(AuditingFieldsKeysEnum.AUDIT_STATUS.getDisplayName(), getStatus()); - fields.put(AuditingFieldsKeysEnum.AUDIT_DESC.getDisplayName(), getDesc()); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); - simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - fields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1)); - fields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID.getDisplayName(), getConsumerId()); - fields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL.getDisplayName(), getResourceURL()); - fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME.getDisplayName(), getResourceName()); - fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE.getDisplayName(), getResourceType()); - fields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID.getDisplayName(), getModifier()); - - fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION.getDisplayName(), getPrevVersion()); - fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION.getDisplayName(), getCurrVersion()); - fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE.getDisplayName(), getPrevState()); - fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE.getDisplayName(), getCurrState()); - - fields.put(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID.getDisplayName(), getPrevArtifactUuid()); - fields.put(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID.getDisplayName(), getCurrArtifactUuid()); - fields.put(AuditingFieldsKeysEnum.AUDIT_ARTIFACT_DATA.getDisplayName(), getArtifactData()); - } - - public UUID getTimebaseduuid() { - return timebaseduuid; - } - - public void setTimebaseduuid(UUID timebaseduuid) { - this.timebaseduuid = timebaseduuid; - } - - public Date getTimestamp1() { - return timestamp1; - } - - public void setTimestamp1(Date timestamp1) { - this.timestamp1 = timestamp1; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public String getConsumerId() { - return consumerId; - } - - public void setConsumerId(String consumerId) { - this.consumerId = consumerId; - } - - public String getResourceURL() { - return resourceURL; - } - - public void setResourceURL(String resourceURL) { - this.resourceURL = resourceURL; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getInvariantUuid() { - return invariantUuid; - } - - public void setInvariantUuid(String invariantUuid) { - this.invariantUuid = invariantUuid; - } - - public String getModifier() { - return modifier; - } - - public void setModifier(String modifier) { - this.modifier = modifier; - } - - public String getPrevArtifactUuid() { - return prevArtifactUuid; - } - - public void setPrevArtifactUuid(String prevArtifactUuid) { - this.prevArtifactUuid = prevArtifactUuid; - } - - public String getCurrArtifactUuid() { - return currArtifactUuid; - } - - public void setCurrArtifactUuid(String currArtifactUuid) { - this.currArtifactUuid = currArtifactUuid; - } - - public String getArtifactData() { - return artifactData; - } - - public void setArtifactData(String artifactData) { - this.artifactData = artifactData; - } - - @Override - public String toString() { - return "ExternalApiEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", action=" + action - + ", status=" + status + ", desc=" + desc + ", consumerId=" + consumerId + ", resourceURL=" - + resourceURL + ", resourceName=" + resourceName + ", resourceType=" + resourceType - + ", serviceInstanceId=" + serviceInstanceId + ", invariantUuid=" + invariantUuid + ", modifier=" + modifier - + ", prevVersion=" + prevVersion+ ", currVersion=" + currVersion - + ", prevState=" + prevState + ", currState=" + currState - + ", prevArtifactUuid=" - + prevArtifactUuid + ", currArtifactUuid=" + currArtifactUuid + ", artifactData=" + artifactData + "]"; - } - - public String getPrevVersion() { - return prevVersion; - } - - public void setPrevVersion(String prevVersion) { - this.prevVersion = prevVersion; - } - - public String getCurrVersion() { - return currVersion; - } - - public void setCurrVersion(String currVersion) { - this.currVersion = currVersion; - } - - public String getPrevState() { - return prevState; - } - - public void setPrevState(String prevState) { - this.prevState = prevState; - } - - public String getCurrState() { - return currState; - } - - public void setCurrState(String currState) { - this.currState = currState; - } + @PartitionKey + protected UUID timebaseduuid; + + @ClusteringColumn() + protected Date timestamp1; + + @Column + protected String action; + @Column + protected String status; + + @Column(name = "description") + protected String desc; + + @Column(name = "consumer_id") + private String consumerId; + + @Column(name = "resource_url") + private String resourceURL; + + @Column(name = "resource_name") + private String resourceName; + + @Column(name = "resource_type") + private String resourceType; + + @Column(name = "service_instance_id") + protected String serviceInstanceId; + + @Column(name = "invariant_uuid") + protected String invariantUuid; + + @Column(name = "modifier") + private String modifier; + + @Column(name = "prev_version") + protected String prevVersion; + + @Column(name = "curr_version") + private String currVersion; + + @Column(name = "prev_state") + protected String prevState; + + @Column(name = "curr_state") + protected String currState; + + @Column(name = "prev_artifact_uuid") + private String prevArtifactUuid; + + @Column(name = "curr_artifact_uuid") + private String currArtifactUuid; + + @Column(name = "artifact_data") + private String artifactData; + + public ExternalApiEvent() { + super(); + timestamp1 = new Date(); + timebaseduuid = UUIDs.timeBased(); + } + + public ExternalApiEvent(Map<AuditingFieldsKeysEnum, Object> auditingFields) { + this(); + Object value; + + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_ACTION); + if (value != null) { + setAction((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_STATUS); + if (value != null) { + setStatus((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_DESC); + if (value != null) { + setDesc((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID); + if (value != null) { + setConsumerId((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL); + if (value != null) { + setResourceURL((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME); + if (value != null) { + setResourceName((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE); + if (value != null) { + setResourceType((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID); + if (value != null) { + setServiceInstanceId((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID); + if (value != null) { + setInvariantUuid((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID); + if (value != null) { + setModifier((String) value); + } + + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION); + if (value != null) { + setPrevVersion((String) value); + } + + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION); + if (value != null) { + setCurrVersion((String) value); + } + + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE); + if (value != null) { + setPrevState((String) value); + } + + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE); + if (value != null) { + setCurrState((String) value); + } + + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID); + if (value != null) { + setPrevArtifactUuid((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID); + if (value != null) { + setCurrArtifactUuid((String) value); + } + value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_ARTIFACT_DATA); + if (value != null) { + setArtifactData((String) value); + } + } + + public ExternalApiEvent(String action, CommonAuditData commonAuditData, String resourceType, String resourceName, + String distConsumerId, String distResourceUrl, ResourceAuditData prevParams, ResourceAuditData currParams, + String modifier, String invariantUuid, String artifactData) { + this(); + this.action = action; + this.status = commonAuditData.getStatus(); + this.desc = commonAuditData.getDescription(); + this.requestId = commonAuditData.getRequestId(); + this.consumerId = distConsumerId; + this.resourceURL = distResourceUrl; + this.resourceName = resourceName; + this.resourceType = resourceType; + this.serviceInstanceId = commonAuditData.getServiceInstanceId(); + this.invariantUuid = invariantUuid; + this.modifier = modifier; + this.prevVersion = prevParams.getVersion(); + this.prevState = prevParams.getState(); + this.prevArtifactUuid = prevParams.getArtifactUuid(); + this.currVersion = currParams.getVersion(); + this.currState = currParams.getState(); + this.currArtifactUuid = currParams.getArtifactUuid(); + this.artifactData = artifactData; + } + + @Override + public void fillFields() { + fields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); + fields.put(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID.getDisplayName(), getInvariantUuid()); + fields.put(AuditingFieldsKeysEnum.AUDIT_ACTION.getDisplayName(), getAction()); + fields.put(AuditingFieldsKeysEnum.AUDIT_STATUS.getDisplayName(), getStatus()); + fields.put(AuditingFieldsKeysEnum.AUDIT_DESC.getDisplayName(), getDesc()); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + fields.put(AuditingFieldsKeysEnum.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1)); + fields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID.getDisplayName(), getConsumerId()); + fields.put(AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL.getDisplayName(), getResourceURL()); + fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME.getDisplayName(), getResourceName()); + fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE.getDisplayName(), getResourceType()); + fields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID.getDisplayName(), getModifier()); + + fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION.getDisplayName(), getPrevVersion()); + fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION.getDisplayName(), getCurrVersion()); + fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE.getDisplayName(), getPrevState()); + fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE.getDisplayName(), getCurrState()); + + fields.put(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID.getDisplayName(), getPrevArtifactUuid()); + fields.put(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID.getDisplayName(), getCurrArtifactUuid()); + fields.put(AuditingFieldsKeysEnum.AUDIT_ARTIFACT_DATA.getDisplayName(), getArtifactData()); + } + + public UUID getTimebaseduuid() { + return timebaseduuid; + } + + public void setTimebaseduuid(UUID timebaseduuid) { + this.timebaseduuid = timebaseduuid; + } + + public Date getTimestamp1() { + return timestamp1; + } + + public void setTimestamp1(Date timestamp1) { + this.timestamp1 = timestamp1; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getConsumerId() { + return consumerId; + } + + public void setConsumerId(String consumerId) { + this.consumerId = consumerId; + } + + public String getResourceURL() { + return resourceURL; + } + + public void setResourceURL(String resourceURL) { + this.resourceURL = resourceURL; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getInvariantUuid() { + return invariantUuid; + } + + public void setInvariantUuid(String invariantUuid) { + this.invariantUuid = invariantUuid; + } + + public String getModifier() { + return modifier; + } + + public void setModifier(String modifier) { + this.modifier = modifier; + } + + public String getPrevArtifactUuid() { + return prevArtifactUuid; + } + + public void setPrevArtifactUuid(String prevArtifactUuid) { + this.prevArtifactUuid = prevArtifactUuid; + } + + public String getCurrArtifactUuid() { + return currArtifactUuid; + } + + public void setCurrArtifactUuid(String currArtifactUuid) { + this.currArtifactUuid = currArtifactUuid; + } + + public String getArtifactData() { + return artifactData; + } + + public void setArtifactData(String artifactData) { + this.artifactData = artifactData; + } + + @Override + public String toString() { + return "ExternalApiEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", action=" + action + + ", status=" + status + ", desc=" + desc + ", consumerId=" + consumerId + ", resourceURL=" + + resourceURL + ", resourceName=" + resourceName + ", resourceType=" + resourceType + + ", serviceInstanceId=" + serviceInstanceId + ", invariantUuid=" + invariantUuid + ", modifier=" + modifier + + ", prevVersion=" + prevVersion+ ", currVersion=" + currVersion + + ", prevState=" + prevState + ", currState=" + currState + + ", prevArtifactUuid=" + + prevArtifactUuid + ", currArtifactUuid=" + currArtifactUuid + ", artifactData=" + artifactData + "]"; + } + + public String getPrevVersion() { + return prevVersion; + } + + public void setPrevVersion(String prevVersion) { + this.prevVersion = prevVersion; + } + + public String getCurrVersion() { + return currVersion; + } + + public void setCurrVersion(String currVersion) { + this.currVersion = currVersion; + } + + public String getPrevState() { + return prevState; + } + + public void setPrevState(String prevState) { + this.prevState = prevState; + } + + public String getCurrState() { + return currState; + } + + public void setCurrState(String currState) { + this.currState = currState; + } } |