package org.opennaas.core.resources.api.model;
/*
* #%L
* OpenNaaS :: Core :: Resources
* %%
* Copyright (C) 2007 - 2014 FundaciĆ³ Privada i2CAT, Internet i InnovaciĆ³ a Catalunya
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* #L%
*/
import java.io.Serializable;
import java.util.Collection;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import org.opennaas.core.resources.ILifecycle.State;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ResourceInfo implements Serializable {
private static final long serialVersionUID = -6248762144882626023L;
private String resourceId;
private String name;
private String type;
private State state;
@XmlElementWrapper(name = "capabilities")
private Collection<String> capability;
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Collection<String> getCapabilityNames() {
return capability;
}
public void setCapabilityNames(Collection<String> capabilityNames) {
this.capability = capabilityNames;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((capability == null) ? 0 : capability.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode());
result = prime * result + ((state == null) ? 0 : state.hashCode());
result = prime * result + ((type == null) ? 0 : type.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;
ResourceInfo other = (ResourceInfo) obj;
if (capability == null) {
if (other.capability != null)
return false;
} else if (!capability.equals(other.capability))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (resourceId == null) {
if (other.resourceId != null)
return false;
} else if (!resourceId.equals(other.resourceId))
return false;
if (state != other.state)
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}
}