Exemplo n.º 1
0
  /** TODO VirtualmachineHB vMachine (can be null) */
  private NodeVirtualImageHB createNodeVirtualImage(
      VirtualimageHB vImage, VirtualmachineHB vMachine) throws PersistenceException {
    factorytest = HibernateDAOFactory.instance();
    NodeVirtualImageDAO daoNVI = factorytest.getNodeVirtualImageDAO();

    factorytest.beginConnection();

    NodeVirtualImageHB nVi = new NodeVirtualImageHB();
    // XXX nVi.setIdNode(idNode);
    nVi.setIdVirtualApp(vApp.getIdVirtualApp());
    nVi.setVirtualImageHB(vImage);
    nVi.setVirtualMachineHB(vMachine);

    nVi.setType(NodeTypeEnum.VIRTUAL_IMAGE);

    nVi.setName("test");

    nVi.setPosX(10);
    nVi.setPosY(10);

    daoNVI.makePersistent(nVi);

    factorytest.endConnection();

    return nVi;
  }
Exemplo n.º 2
0
  @Override
  public NodeVirtualImageHB toPojoHB() {
    NodeHB nodeHB = super.toPojoHB();
    NodeVirtualImageHB nodeVirtualImageHB = new NodeVirtualImageHB(nodeHB);

    // Adding NodeVirtualImage's fields
    nodeVirtualImageHB.setVirtualImageHB(virtualImage.toPojoHB());
    if (virtualMachine != null) {
      nodeVirtualImageHB.setVirtualMachineHB(virtualMachine.toPojoHB());
    } else {
      nodeVirtualImageHB.setVirtualMachineHB(null);
    }

    return nodeVirtualImageHB;
  }