/server/src/main/java/com/abiquo/abiserver/business/hibernate/pojohb/infrastructure/HypervisorHB.java

https://github.com/yangbenf/abiquo · Java · 181 lines · 115 code · 42 blank · 24 comment · 0 complexity · cbbb4d5cdb5d3e8eaee142ec7e5255a4 MD5 · raw file

  1. /**
  2. * Abiquo community edition
  3. * cloud management application for hybrid clouds
  4. * Copyright (C) 2008-2010 - Abiquo Holdings S.L.
  5. *
  6. * This application is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU LESSER GENERAL PUBLIC
  8. * LICENSE as published by the Free Software Foundation under
  9. * version 3 of the License
  10. *
  11. * This software is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * LESSER GENERAL PUBLIC LICENSE v.3 for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. package com.abiquo.abiserver.business.hibernate.pojohb.infrastructure;
  22. // Generated 16-oct-2008 16:52:14 by Hibernate Tools 3.2.1.GA
  23. import java.util.HashSet;
  24. import java.util.Set;
  25. import com.abiquo.abiserver.business.hibernate.pojohb.IPojoHB;
  26. import com.abiquo.abiserver.business.hibernate.pojohb.virtualappliance.VirtualmachineHB;
  27. import com.abiquo.abiserver.pojo.infrastructure.HyperVisor;
  28. import com.abiquo.abiserver.pojo.infrastructure.HyperVisorType;
  29. import com.abiquo.abiserver.pojo.infrastructure.PhysicalMachine;
  30. import com.abiquo.model.enumerator.HypervisorType;
  31. /**
  32. * Hypervisor generated by hbm2java
  33. */
  34. public class HypervisorHB implements java.io.Serializable, IPojoHB<HyperVisor>
  35. {
  36. private static final long serialVersionUID = -7337606409880143290L;
  37. private Integer idHyper;
  38. private Set<VirtualmachineHB> virtualmachines = new HashSet<VirtualmachineHB>(0);
  39. private String ip;
  40. private String ipService;
  41. private Integer port;
  42. private PhysicalmachineHB physicalMachine;
  43. private HypervisorType type;
  44. private String user;
  45. private String password;
  46. public HypervisorHB()
  47. {
  48. }
  49. public String getIpService()
  50. {
  51. return ipService;
  52. }
  53. public void setIpService(String ipService)
  54. {
  55. this.ipService = ipService;
  56. }
  57. public Integer getIdHyper()
  58. {
  59. return idHyper;
  60. }
  61. public void setIdHyper(Integer idHyper)
  62. {
  63. this.idHyper = idHyper;
  64. }
  65. public Set<VirtualmachineHB> getVirtualmachines()
  66. {
  67. return virtualmachines;
  68. }
  69. public void setVirtualmachines(Set<VirtualmachineHB> virtualmachines)
  70. {
  71. this.virtualmachines = virtualmachines;
  72. }
  73. public String getIp()
  74. {
  75. return ip;
  76. }
  77. public void setIp(String ip)
  78. {
  79. this.ip = ip;
  80. }
  81. public Integer getPort()
  82. {
  83. return port;
  84. }
  85. public void setPort(Integer port)
  86. {
  87. this.port = port;
  88. }
  89. public PhysicalmachineHB getPhysicalMachine()
  90. {
  91. return physicalMachine;
  92. }
  93. public void setPhysicalMachine(PhysicalmachineHB physicalMachine)
  94. {
  95. this.physicalMachine = physicalMachine;
  96. }
  97. public String getUser()
  98. {
  99. return user;
  100. }
  101. public void setUser(String user)
  102. {
  103. this.user = user;
  104. }
  105. public String getPassword()
  106. {
  107. return password;
  108. }
  109. public void setPassword(String password)
  110. {
  111. this.password = password;
  112. }
  113. public HyperVisor toPojo()
  114. {
  115. return toPojo(physicalMachine.toPojo());
  116. }
  117. public HyperVisor toPojo(PhysicalMachine physicalMachine)
  118. {
  119. HyperVisor hyperVisor = new HyperVisor();
  120. hyperVisor.setAssignedTo(physicalMachine);
  121. hyperVisor.setId(idHyper);
  122. hyperVisor.setName(getType().getValue());
  123. hyperVisor.setIp(ip);
  124. hyperVisor.setIpService(ipService);
  125. hyperVisor.setPort(port);
  126. hyperVisor.setType(new HyperVisorType(type));
  127. hyperVisor.setUser(user);
  128. hyperVisor.setPassword(password);
  129. return hyperVisor;
  130. }
  131. public HypervisorType getType()
  132. {
  133. return type;
  134. }
  135. public void setType(HypervisorType type)
  136. {
  137. this.type = type;
  138. }
  139. }