package org.opennaas.extensions.sdnnetwork.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Julio Carlos Barrera * */ @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class NetworkConnection { private String id; private String name; private Port source; private Port destination; /** * Default constructor */ public NetworkConnection() { } /** * Copy constructor * * @param networkConnection * NetworkConnection to copy */ public NetworkConnection(NetworkConnection networkConnection) { this.id = networkConnection.id; this.name = networkConnection.name; this.source = new Port(networkConnection.source); this.destination = new Port(networkConnection.destination); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Port getSource() { return source; } public void setSource(Port source) { this.source = source; } public Port getDestination() { return destination; } public void setDestination(Port destination) { this.destination = destination; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((destination == null) ? 0 : destination.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NetworkConnection other = (NetworkConnection) obj; if (destination == null) { if (other.destination != null) return false; } else if (!destination.equals(other.destination)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (source == null) { if (other.source != null) return false; } else if (!source.equals(other.source)) return false; return true; } }