private void marshal(APIQueryVolumeSnapshotTreeReply reply) { if (reply.getInventories() == null) { // this is for count return; } for (VolumeSnapshotTreeInventory inv : reply.getInventories()) { SimpleQuery<VolumeSnapshotVO> sq = dbf.createQuery(VolumeSnapshotVO.class); sq.add(VolumeSnapshotVO_.treeUuid, Op.EQ, inv.getUuid()); List<VolumeSnapshotVO> vos = sq.list(); VolumeSnapshotTree tree = VolumeSnapshotTree.fromVOs(vos); inv.setTree(tree.getRoot().toLeafInventory()); } }
List<VolumeSnapshotVO> vos = q.list(); VolumeSnapshotTree tree = VolumeSnapshotTree.fromVOs(vos); inv.setTree(tree.getRoot().toLeafInventory()); reply.setInventories(Arrays.asList(inv)); } else if (msg.getVolumeUuid() != null) { List<VolumeSnapshotVO> vos = sq.list(); VolumeSnapshotTree tree = VolumeSnapshotTree.fromVOs(vos); inv.setTree(tree.getRoot().toLeafInventory()); treeInventories.add(inv);
public static APIQueryVolumeSnapshotTreeReply __example__() { APIQueryVolumeSnapshotTreeReply reply = new APIQueryVolumeSnapshotTreeReply(); VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setUuid(uuid()); inv.setName("My Snapshot 2"); inv.setPrimaryStorageUuid(uuid()); inv.setFormat("qcow2"); inv.setVolumeUuid(uuid()); inv.setLatest(false); inv.setPrimaryStorageUuid("/zstack_ps/rootVolumes/acct-e77f16d460ea46e18262547b56972273/vol-13c66bb52d0949398e520183b917f813/snapshots/2fa6979af5c6479fa98f37d316f44b5f.qcow2"); inv.setSize(1310720); inv.setStatus(VolumeSnapshotStatus.Ready.toString()); inv.setState(VolumeSnapshotState.Enabled.toString()); inv.setVolumeType(VolumeType.Root.toString()); VolumeSnapshotTree.SnapshotLeafInventory linv = new VolumeSnapshotTree.SnapshotLeafInventory(); linv.setInventory(inv); linv.setParentUuid(uuid()); VolumeSnapshotTreeInventory tinv = new VolumeSnapshotTreeInventory(); tinv.setUuid(uuid()); tinv.setCurrent(false); tinv.setVolumeUuid(inv.getVolumeUuid()); tinv.setTree(linv); return reply; }