001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * Sonar is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019 */
020package org.sonar.wsclient.services;
021
022public class Dependency extends Model {
023
024  private String id;
025  private long fromId;
026  private long toId;
027  private String usage;
028  private int weight;
029  private String fromKey;
030  private String fromName;
031  private String fromQualifier;
032  private String toKey;
033  private String toName;
034  private String toQualifier;
035
036  public String getId() {
037    return id;
038  }
039
040  public Dependency setId(String id) {
041    this.id = id;
042    return this;
043  }
044
045  public long getFromId() {
046    return fromId;
047  }
048
049  public Dependency setFromId(long fromId) {
050    this.fromId = fromId;
051    return this;
052  }
053
054  public long getToId() {
055    return toId;
056  }
057
058  public Dependency setToId(long toId) {
059    this.toId = toId;
060    return this;
061  }
062
063  public String getFromKey() {
064    return fromKey;
065  }
066
067  public Dependency setFromKey(String fromKey) {
068    this.fromKey = fromKey;
069    return this;
070  }
071
072  public String getToKey() {
073    return toKey;
074  }
075
076  public Dependency setToKey(String toKey) {
077    this.toKey = toKey;
078    return this;
079  }
080
081  public String getUsage() {
082    return usage;
083  }
084
085  public Dependency setUsage(String usage) {
086    this.usage = usage;
087    return this;
088  }
089
090  public Integer getWeight() {
091    return weight;
092  }
093
094  public Dependency setWeight(Integer weight) {
095    this.weight = weight;
096    return this;
097  }
098
099  public String getFromName() {
100    return fromName;
101  }
102
103  public Dependency setFromName(String fromName) {
104    this.fromName = fromName;
105    return this;
106  }
107
108  public String getFromQualifier() {
109    return fromQualifier;
110  }
111
112  public Dependency setFromQualifier(String fromQualifier) {
113    this.fromQualifier = fromQualifier;
114    return this;
115  }
116
117  public String getToName() {
118    return toName;
119  }
120
121  public Dependency setToName(String toName) {
122    this.toName = toName;
123    return this;
124  }
125
126  public String getToQualifier() {
127    return toQualifier;
128  }
129
130  public Dependency setToQualifier(String toQualifier) {
131    this.toQualifier = toQualifier;
132    return this;
133  }
134
135  @Override
136  public boolean equals(Object o) {
137    if (this == o) {
138      return true;
139    }
140    if (o == null || getClass() != o.getClass()) {
141      return false;
142    }
143
144    Dependency that = (Dependency) o;
145    return id.equals(that.id);
146  }
147
148  @Override
149  public int hashCode() {
150    return id.hashCode();
151  }
152
153  @Override
154  public String toString() {
155    return new StringBuilder()
156        .append(fromKey)
157        .append(" -> ")
158        .append(toKey)
159        .toString();
160  }
161}