package org.opennaas.extensions.genericnetwork.model; /* * #%L * OpenNaaS :: OF Network * %% * Copyright (C) 2007 - 2014 FundaciĆ³ Privada i2CAT, Internet i InnovaciĆ³ a Catalunya * %% * 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. * #L% */ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import org.opennaas.extensions.openflowswitch.model.OFFlow; /** * A Flow additionally storing the resourceID of the resource the Flow belongs to. * * @author Isart Canyameres Gimenez (i2cat) * */ @XmlRootElement(namespace = "opennaas.api") @XmlAccessorType(XmlAccessType.FIELD) public class NetOFFlow extends OFFlow { /** * <resource ID> ID of the resource this OFFlow belongs to */ protected String resourceId; /** * Default constructor */ public NetOFFlow() { } /** * Copy constructor * * @param ofFlow */ public NetOFFlow(NetOFFlow flow) { super(flow); this.resourceId = flow.resourceId; } /** * Copy constructor based on OFFlow and resourceId * * @param ofFlow * OFFlow to copy * @param resourceId */ public NetOFFlow(OFFlow ofFlow, String switchId) { super(ofFlow); this.resourceId = switchId; } /** * @return the resourceId */ public String getResourceId() { return resourceId; } /** * @param resourceId * the resourceId to set */ public void setResourceId(String resourceId) { this.resourceId = resourceId; } /* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((actions == null) ? 0 : actions.hashCode()); result = prime * result + (active ? 1231 : 1237); result = prime * result + ((match == null) ? 0 : match.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((priority == null) ? 0 : priority.hashCode()); result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode()); return result; } /* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NetOFFlow other = (NetOFFlow) obj; if (actions == null) { if (other.actions != null) return false; } else if (!actions.equals(other.actions)) return false; if (active != other.active) return false; if (match == null) { if (other.match != null) return false; } else if (!match.equals(other.match)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (priority == null) { if (other.priority != null) return false; } else if (!priority.equals(other.priority)) return false; if (resourceId == null) { if (other.resourceId != null) return false; } else if (!resourceId.equals(other.resourceId)) return false; return true; } public boolean equalsIgnoringName(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NetOFFlow other = (NetOFFlow) obj; if (actions == null) { if (other.actions != null) return false; } else if (!actions.equals(other.actions)) return false; if (active != other.active) return false; if (match == null) { if (other.match != null) return false; } else if (!match.equals(other.match)) return false; if (priority == null) { if (other.priority != null) return false; } else if (!priority.equals(other.priority)) return false; if (resourceId == null) { if (other.resourceId != null) return false; } else if (!resourceId.equals(other.resourceId)) return false; return true; } }