org.thevortex.lighting.jinks.robot.Effect.java Source code

Java tutorial

Introduction

Here is the source code for org.thevortex.lighting.jinks.robot.Effect.java

Source

/*
 * Copyright (c) 2014 by the author(s).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License 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 org.thevortex.lighting.jinks.robot;

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.thevortex.lighting.jinks.scenes.Scene;

/**
 * The effect(s) of causes that slipped through restrictions.
 *
 * @author E. A. Graham Jr.
 */
public class Effect {
    protected String id;
    protected Scene scene;
    protected String recipientId;
    protected RecipientType recipientType;
    protected NotificationType notificationType;
    protected String note;

    @JsonProperty("effect_id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    /**
     * refers to scene that would be activated
     */
    public Scene getScene() {
        return scene;
    }

    public void setScene(Scene scene) {
        this.scene = scene;
    }

    /**
     * refers to a user that would get a notification of some type
     */
    public String getRecipientId() {
        return recipientId;
    }

    public void setRecipientId(String recipientId) {
        this.recipientId = recipientId;
    }

    /**
     * refers to the type of actor, currently just "user"
     */
    public RecipientType getRecipientType() {
        return recipientType;
    }

    public void setRecipientType(RecipientType recipientType) {
        this.recipientType = recipientType;
    }

    /**
     * notification type to send ("email" and "push")
     */
    public NotificationType getNotificationType() {
        return notificationType;
    }

    public void setNotificationType(NotificationType notificationType) {
        this.notificationType = notificationType;
    }

    /**
     * refers to an associated custom text
     */
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null)
            return false;
        if (this == o)
            return true;

        if (o instanceof Effect) {
            Effect effect = (Effect) o;
            return Objects.equals(id, effect.id) && Objects.equals(scene, effect.scene)
                    && Objects.equals(recipientId, effect.recipientId) && recipientType == effect.recipientType
                    && notificationType == effect.notificationType && Objects.equals(note, effect.note);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, scene, recipientId, recipientType, notificationType, note);
    }
}