Search in sources :

Example 1 with GuestContainer

use of org.ovirt.engine.core.common.businessentities.GuestContainer in project ovirt-engine by oVirt.

the class VdsBrokerObjectsBuilder method initGuestContainers.

private static void initGuestContainers(Map<String, Object> vmStruct, VmDynamic vm) {
    if (vmStruct.containsKey(VdsProperties.guest_containers)) {
        vm.setGuestContainers(new ArrayList<>());
        Object obj = vmStruct.get(VdsProperties.guest_containers);
        if (obj instanceof Object[]) {
            Object[] containers = (Object[]) obj;
            for (Object containerObj : containers) {
                Map<String, Object> container = (Map<String, Object>) containerObj;
                ArrayList<String> names = new ArrayList<>();
                for (Object o : (Object[]) container.get(VdsProperties.guest_container_names)) {
                    names.add((String) o);
                }
                vm.getGuestContainers().add(new GuestContainer((String) container.get(VdsProperties.guest_container_id), names, (String) container.get(VdsProperties.guest_container_image), (String) container.get(VdsProperties.guest_container_command), (String) container.get(VdsProperties.guest_container_status)));
            }
        }
    } else {
        vm.setGuestContainers(Collections.emptyList());
    }
}
Also used : ArrayList(java.util.ArrayList) GuestContainer(org.ovirt.engine.core.common.businessentities.GuestContainer) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with GuestContainer

use of org.ovirt.engine.core.common.businessentities.GuestContainer in project ovirt-engine by oVirt.

the class RegisterEntityInfoPanel method initContainersTable.

protected void initContainersTable() {
    containersTable = new EntityModelCellTable<>(false, true);
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getId().toString();
        }
    }, constants.idContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            // $NON-NLS-1$
            return String.join(", ", row.getNames());
        }
    }, constants.namesContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getImage();
        }
    }, constants.imageContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getCommand();
        }
    }, constants.commandContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getStatus();
        }
    }, constants.statusContainer());
    containersTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    containersTable.setWidth("100%");
    containersTable.setSelectionModel(new NoSelectionModel());
    containersTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RegisterEntityModel(org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel) GuestContainer(org.ovirt.engine.core.common.businessentities.GuestContainer)

Aggregations

GuestContainer (org.ovirt.engine.core.common.businessentities.GuestContainer)2 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 NoItemsLabel (org.ovirt.engine.ui.common.widget.label.NoItemsLabel)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1 RegisterEntityModel (org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel)1