com.amazonaws.services.redshift.model.Event Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi Show documentation
/*
 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.amazonaws.services.redshift.model;
import java.io.Serializable;
/**
 * 
 * Describes an event.
 * 
 */
public class Event implements Serializable, Cloneable {
    /**
     * 
     * The identifier for the source of the event.
     * 
     */
    private String sourceIdentifier;
    /**
     * 
     * The source type for this event.
     * 
     */
    private String sourceType;
    /**
     * 
     * The text of this event.
     * 
     */
    private String message;
    /**
     * 
     * A list of the event categories.
     * 
     * 
     * Values: Configuration, Management, Monitoring, Security
     * 
     */
    private com.amazonaws.internal.SdkInternalList eventCategories;
    /**
     * 
     * The severity of the event.
     * 
     * 
     * Values: ERROR, INFO
     * 
     */
    private String severity;
    /**
     * 
     * The date and time of the event.
     * 
     */
    private java.util.Date dateValue;
    /**
     * 
     * The identifier of the event.
     * 
     */
    private String eventId;
    /**
     * 
     * The identifier for the source of the event.
     * 
     * 
     * @param sourceIdentifier
     *        The identifier for the source of the event.
     */
    public void setSourceIdentifier(String sourceIdentifier) {
        this.sourceIdentifier = sourceIdentifier;
    }
    /**
     * 
     * The identifier for the source of the event.
     * 
     * 
     * @return The identifier for the source of the event.
     */
    public String getSourceIdentifier() {
        return this.sourceIdentifier;
    }
    /**
     * 
     * The identifier for the source of the event.
     * 
     * 
     * @param sourceIdentifier
     *        The identifier for the source of the event.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withSourceIdentifier(String sourceIdentifier) {
        setSourceIdentifier(sourceIdentifier);
        return this;
    }
    /**
     * 
     * The source type for this event.
     * 
     * 
     * @param sourceType
     *        The source type for this event.
     * @see SourceType
     */
    public void setSourceType(String sourceType) {
        this.sourceType = sourceType;
    }
    /**
     * 
     * The source type for this event.
     * 
     * 
     * @return The source type for this event.
     * @see SourceType
     */
    public String getSourceType() {
        return this.sourceType;
    }
    /**
     * 
     * The source type for this event.
     * 
     * 
     * @param sourceType
     *        The source type for this event.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see SourceType
     */
    public Event withSourceType(String sourceType) {
        setSourceType(sourceType);
        return this;
    }
    /**
     * 
     * The source type for this event.
     * 
     * 
     * @param sourceType
     *        The source type for this event.
     * @see SourceType
     */
    public void setSourceType(SourceType sourceType) {
        this.sourceType = sourceType.toString();
    }
    /**
     * 
     * The source type for this event.
     * 
     * 
     * @param sourceType
     *        The source type for this event.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see SourceType
     */
    public Event withSourceType(SourceType sourceType) {
        setSourceType(sourceType);
        return this;
    }
    /**
     * 
     * The text of this event.
     * 
     * 
     * @param message
     *        The text of this event.
     */
    public void setMessage(String message) {
        this.message = message;
    }
    /**
     * 
     * The text of this event.
     * 
     * 
     * @return The text of this event.
     */
    public String getMessage() {
        return this.message;
    }
    /**
     * 
     * The text of this event.
     * 
     * 
     * @param message
     *        The text of this event.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withMessage(String message) {
        setMessage(message);
        return this;
    }
    /**
     * 
     * A list of the event categories.
     * 
     * 
     * Values: Configuration, Management, Monitoring, Security
     * 
     * 
     * @return A list of the event categories. 
     *         
     *         Values: Configuration, Management, Monitoring, Security
     */
    public java.util.List getEventCategories() {
        if (eventCategories == null) {
            eventCategories = new com.amazonaws.internal.SdkInternalList();
        }
        return eventCategories;
    }
    /**
     * 
     * A list of the event categories.
     * 
     * 
     * Values: Configuration, Management, Monitoring, Security
     * 
     * 
     * @param eventCategories
     *        A list of the event categories.   
     *        
     *        Values: Configuration, Management, Monitoring, Security
     */
    public void setEventCategories(java.util.Collection eventCategories) {
        if (eventCategories == null) {
            this.eventCategories = null;
            return;
        }
        this.eventCategories = new com.amazonaws.internal.SdkInternalList(
                eventCategories);
    }
    /**
     * 
     * A list of the event categories.
     * 
     * 
     * Values: Configuration, Management, Monitoring, Security
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setEventCategories(java.util.Collection)} or
     * {@link #withEventCategories(java.util.Collection)} if you want to
     * override the existing values.
     * 
     * 
     * @param eventCategories
     *        A list of the event categories.   
     *        
     *        Values: Configuration, Management, Monitoring, Security
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withEventCategories(String... eventCategories) {
        if (this.eventCategories == null) {
            setEventCategories(new com.amazonaws.internal.SdkInternalList(
                    eventCategories.length));
        }
        for (String ele : eventCategories) {
            this.eventCategories.add(ele);
        }
        return this;
    }
    /**
     * 
     * A list of the event categories.
     * 
     * 
     * Values: Configuration, Management, Monitoring, Security
     * 
     * 
     * @param eventCategories
     *        A list of the event categories.  
     *        
     *        Values: Configuration, Management, Monitoring, Security
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withEventCategories(
            java.util.Collection eventCategories) {
        setEventCategories(eventCategories);
        return this;
    }
    /**
     * 
     * The severity of the event.
     * 
     * 
     * Values: ERROR, INFO
     * 
     * 
     * @param severity
     *        The severity of the event. 
     *        
     *        Values: ERROR, INFO
     */
    public void setSeverity(String severity) {
        this.severity = severity;
    }
    /**
     * 
     * The severity of the event.
     * 
     * 
     * Values: ERROR, INFO
     * 
     * 
     * @return The severity of the event.
     *         
     *         Values: ERROR, INFO
     */
    public String getSeverity() {
        return this.severity;
    }
    /**
     * 
     * The severity of the event.
     * 
     * 
     * Values: ERROR, INFO
     * 
     * 
     * @param severity
     *        The severity of the event.
     *        
     *        Values: ERROR, INFO
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withSeverity(String severity) {
        setSeverity(severity);
        return this;
    }
    /**
     * 
     * The date and time of the event.
     * 
     * 
     * @param dateValue
     *        The date and time of the event.
     */
    public void setDate(java.util.Date dateValue) {
        this.dateValue = dateValue;
    }
    /**
     * 
     * The date and time of the event.
     * 
     * 
     * @return The date and time of the event.
     */
    public java.util.Date getDate() {
        return this.dateValue;
    }
    /**
     * 
     * The date and time of the event.
     * 
     * 
     * @param dateValue
     *        The date and time of the event.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withDate(java.util.Date dateValue) {
        setDate(dateValue);
        return this;
    }
    /**
     * 
     * The identifier of the event.
     * 
     * 
     * @param eventId
     *        The identifier of the event.
     */
    public void setEventId(String eventId) {
        this.eventId = eventId;
    }
    /**
     * 
     * The identifier of the event.
     * 
     * 
     * @return The identifier of the event.
     */
    public String getEventId() {
        return this.eventId;
    }
    /**
     * 
     * The identifier of the event.
     * 
     * 
     * @param eventId
     *        The identifier of the event.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Event withEventId(String eventId) {
        setEventId(eventId);
        return this;
    }
    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getSourceIdentifier() != null)
            sb.append("SourceIdentifier: " + getSourceIdentifier() + ",");
        if (getSourceType() != null)
            sb.append("SourceType: " + getSourceType() + ",");
        if (getMessage() != null)
            sb.append("Message: " + getMessage() + ",");
        if (getEventCategories() != null)
            sb.append("EventCategories: " + getEventCategories() + ",");
        if (getSeverity() != null)
            sb.append("Severity: " + getSeverity() + ",");
        if (getDate() != null)
            sb.append("Date: " + getDate() + ",");
        if (getEventId() != null)
            sb.append("EventId: " + getEventId());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof Event == false)
            return false;
        Event other = (Event) obj;
        if (other.getSourceIdentifier() == null
                ^ this.getSourceIdentifier() == null)
            return false;
        if (other.getSourceIdentifier() != null
                && other.getSourceIdentifier().equals(
                        this.getSourceIdentifier()) == false)
            return false;
        if (other.getSourceType() == null ^ this.getSourceType() == null)
            return false;
        if (other.getSourceType() != null
                && other.getSourceType().equals(this.getSourceType()) == false)
            return false;
        if (other.getMessage() == null ^ this.getMessage() == null)
            return false;
        if (other.getMessage() != null
                && other.getMessage().equals(this.getMessage()) == false)
            return false;
        if (other.getEventCategories() == null
                ^ this.getEventCategories() == null)
            return false;
        if (other.getEventCategories() != null
                && other.getEventCategories().equals(this.getEventCategories()) == false)
            return false;
        if (other.getSeverity() == null ^ this.getSeverity() == null)
            return false;
        if (other.getSeverity() != null
                && other.getSeverity().equals(this.getSeverity()) == false)
            return false;
        if (other.getDate() == null ^ this.getDate() == null)
            return false;
        if (other.getDate() != null
                && other.getDate().equals(this.getDate()) == false)
            return false;
        if (other.getEventId() == null ^ this.getEventId() == null)
            return false;
        if (other.getEventId() != null
                && other.getEventId().equals(this.getEventId()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime
                * hashCode
                + ((getSourceIdentifier() == null) ? 0 : getSourceIdentifier()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getSourceType() == null) ? 0 : getSourceType().hashCode());
        hashCode = prime * hashCode
                + ((getMessage() == null) ? 0 : getMessage().hashCode());
        hashCode = prime
                * hashCode
                + ((getEventCategories() == null) ? 0 : getEventCategories()
                        .hashCode());
        hashCode = prime * hashCode
                + ((getSeverity() == null) ? 0 : getSeverity().hashCode());
        hashCode = prime * hashCode
                + ((getDate() == null) ? 0 : getDate().hashCode());
        hashCode = prime * hashCode
                + ((getEventId() == null) ? 0 : getEventId().hashCode());
        return hashCode;
    }
    @Override
    public Event clone() {
        try {
            return (Event) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}