/*
 * Licensed Materials - Property of Perforce Software, Inc. 
 * © Copyright Perforce Software, Inc. 2014, 2021 
 * © Copyright IBM Corp. 2009, 2014
 * © Copyright ILOG 1996, 2009
 * All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
 * The Software and Documentation were developed at private expense and
 * are "Commercial Items" as that term is defined at 48 CFR 2.101,
 * consisting of "Commercial Computer Software" and
 * "Commercial Computer Software Documentation", as such terms are
 * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4,
 * as applicable.
 */

package service;

/**
 * 
 * A java bean that represents service data (link), to be used in the SDM model.
 * 
 * @since JViews 8.1
 */
public class ServiceLink {

  // data for service node are properties
  //// id is read only
  private String id = null;

  //// properties
  private String label;
  private boolean acknowledged;
  private boolean alarm;

  //// link edges
  private ServiceNode from;
  private ServiceNode to;

  // constructor

  /**
   * Default constructor, unused
   */
  public ServiceLink() {
  }

  /**
   * Constructs a ServiceLink
   * 
   * @param id
   *          ID of this link
   * @param from
   *          origin
   * @param to
   *          destination
   */
  public ServiceLink(String id, ServiceNode from, ServiceNode to) {
    this.id = id;
    this.from = from;
    this.to = to;
  }

  /**
   * Constructs a ServiceLink
   */
  public ServiceLink(String id, ServiceNode from, ServiceNode to, boolean ack, boolean alarm, String label) {
    this(id, from, to);
    setAcknowledged(ack);
    setAlarm(alarm);
    setLabel(label);
  }

  // property setters and getters

  /**
   * Returns the acknowledged.
   * 
   * @return the acknowledged.
   */
  public boolean isAcknowledged() {
    return acknowledged;
  }

  /**
   * Sets the acknowledged to set.
   * 
   * @param acknowledged
   *          The acknowledged to set
   */
  public void setAcknowledged(boolean acknowledged) {
    this.acknowledged = acknowledged;
  }

  /**
   * Returns the alarm.
   * 
   * @return the alarm.
   */
  public boolean isAlarm() {
    return alarm;
  }

  /**
   * Sets the alarm to set.
   * 
   * @param alarm
   *          The alarm to set
   */
  public void setAlarm(boolean alarm) {
    this.alarm = alarm;
  }

  /**
   * Returns the link origin.
   * 
   * @return the link origin.
   */
  public ServiceNode getFrom() {
    return from;
  }

  /**
   * Sets the link origin to set.
   * 
   * @param from
   *          The link origin to set
   */
  public void setFrom(ServiceNode from) {
    this.from = from;
  }

  /**
   * Returns the label.
   * 
   * @return the label.
   */
  public String getLabel() {
    return label;
  }

  /**
   * Sets the label to set.
   * 
   * @param label
   *          The label to set
   */
  public void setLabel(String label) {
    this.label = label;
  }

  /**
   * Returns the link destination.
   * 
   * @return the link destination.
   */
  public ServiceNode getTo() {
    return to;
  }

  /**
   * Sets the link destination to set.
   * 
   * @param to
   *          The link destination to set
   */
  public void setTo(ServiceNode to) {
    this.to = to;
  }

  /**
   * Returns the id.
   * 
   * @return the id.
   */
  public String getId() {
    return id;
  }

}