/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is available at http://www.abiquo.com/.....
*
* The Initial Developer of the Original Code is Soluciones Grid, S.L. (www.abiquo.com),
* Consell de Cent 296, Principal 2�, 08007 Barcelona, Spain.
*
* No portions of the Code have been created by third parties.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* Graphical User Interface of this software may be used under the terms
* of the Common Public Attribution License Version 1.0 (the "CPAL License",
* available at http://cpal.abiquo.com/), in which case the
* provisions of CPAL License are applicable instead of those above. In relation
* of this portions of the Code, a Legal Notice according to Exhibits A and B of
* CPAL Licence should be provided in any distribution of the corresponding Code
* to Graphical User Interface.
*/
package com.abiquo.abiserver.business.hibernate.pojohb.infrastructure;
// Generated 16-oct-2008 16:52:14 by Hibernate Tools 3.2.1.GA
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import com.abiquo.abiserver.business.hibernate.pojohb.IPojoHB;
import com.abiquo.abiserver.business.hibernate.pojohb.user.UserHB;
import com.abiquo.abiserver.pojo.IPojo;
import com.abiquo.abiserver.pojo.infrastructure.DNS;
import com.abiquo.abiserver.pojo.infrastructure.NetworkModule;
/**
* Networkmodule generated by hbm2java
*/
public class NetworkmoduleHB implements java.io.Serializable, IPojoHB {
private static final long serialVersionUID = -7656626810665919331L;
private NetworkmoduleIdHB id;
private UserHB userHBByIdUserLastModification;
private UserHB userHBByIdUserCreation;
private PhysicalmachineHB physicalmachine;
private int dhcp;
private String ip;
private String gateway;
private String subnetMask;
private BigDecimal bw;
private Date creationDate;
private Date lastModifcationDate;
private Set<DnsHB> dnses = new HashSet<DnsHB>(0);
public NetworkmoduleHB() {
}
public NetworkmoduleHB(NetworkmoduleIdHB id, UserHB userHBByIdUserCreation,
PhysicalmachineHB physicalmachine, int dhcp, Date creationDate) {
this.id = id;
this.userHBByIdUserCreation = userHBByIdUserCreation;
this.physicalmachine = physicalmachine;
this.dhcp = dhcp;
this.creationDate = creationDate;
}
public NetworkmoduleHB(NetworkmoduleIdHB id, UserHB userHBByIdUserLastModification,
UserHB userHBByIdUserCreation, PhysicalmachineHB physicalmachine,
int dhcp, String ip, String gateway, BigDecimal bw,
Date creationDate, Date lastModifcationDate, Set<DnsHB> dnses) {
this.id = id;
this.userHBByIdUserLastModification = userHBByIdUserLastModification;
this.userHBByIdUserCreation = userHBByIdUserCreation;
this.physicalmachine = physicalmachine;
this.dhcp = dhcp;
this.ip = ip;
this.gateway = gateway;
this.bw = bw;
this.creationDate = creationDate;
this.lastModifcationDate = lastModifcationDate;
this.dnses = dnses;
}
public NetworkmoduleIdHB getId() {
return this.id;
}
public void setId(NetworkmoduleIdHB id) {
this.id = id;
}
public UserHB getUserHBByIdUserLastModification() {
return this.userHBByIdUserLastModification;
}
public void setUserHBByIdUserLastModification(
UserHB userHBByIdUserLastModification) {
this.userHBByIdUserLastModification = userHBByIdUserLastModification;
}
public UserHB getUserHBByIdUserCreation() {
return this.userHBByIdUserCreation;
}
public void setUserHBByIdUserCreation(UserHB userHBByIdUserCreation) {
this.userHBByIdUserCreation = userHBByIdUserCreation;
}
public PhysicalmachineHB getPhysicalmachine() {
return this.physicalmachine;
}
public void setPhysicalmachine(PhysicalmachineHB physicalmachine) {
this.physicalmachine = physicalmachine;
}
public int getDhcp() {
return this.dhcp;
}
public void setDhcp(int dhcp) {
this.dhcp = dhcp;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getsubnetMask() {
return this.subnetMask;
}
public void setsubnetMask(String subnetMask) {
this.subnetMask = subnetMask;
}
public String getGateway() {
return this.gateway;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public BigDecimal getBw() {
return this.bw;
}
public void setBw(BigDecimal bw) {
this.bw = bw;
}
public Date getCreationDate() {
return this.creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getLastModifcationDate() {
return this.lastModifcationDate;
}
public void setLastModifcationDate(Date lastModifcationDate) {
this.lastModifcationDate = lastModifcationDate;
}
public Set<DnsHB> getDnses() {
return this.dnses;
}
public void setDnses(Set<DnsHB> dnses) {
this.dnses = dnses;
}
public IPojo toPojo()
{
NetworkModule networkModule = new NetworkModule();
networkModule.setId(this.id.getIdNetworkModule());
networkModule.setDhcp(this.dhcp == 1 ? true:false);
networkModule.setIp(this.ip);
networkModule.setSubNetMask(this.subnetMask);
networkModule.setGateway(this.gateway);
networkModule.setBw(this.bw);
networkModule.setDhcp(this.dhcp == 1 ? true:false);
//Setting DNS
ArrayList<DNS> dnsList = new ArrayList<DNS>();
for (DnsHB dns: this.dnses)
{
dnsList.add((DNS)dns.toPojo());
}
networkModule.setDns(dnsList);
return networkModule;
}
}