@Override protected boolean canEdit(SnapshotModel snapshotModel) { boolean containsMemory = snapshotModel.getEntity().containsMemory(); SnapshotModel selectedSnapshotModel = previewSnapshotModel.getSnapshotModel(); return containsMemory && snapshotModel == selectedSnapshotModel; }
@Override public void render(Context context, SnapshotModel snapshotModel, SafeHtmlBuilder sb) { if (snapshotModel.getEntity().containsMemory()) { super.render(context, snapshotModel, sb); } else { sb.appendEscaped(constants.notAvailableLabel()); } } };
_writer.writeElement("CreationDate", OvfParser.localDateToUtcDateString(snapshot.getCreationDate())); if (snapshot.containsMemory()) { DiskImage memoryDump = memoryDisks.get(snapshot.getMemoryDiskId()); DiskImage memoryConf = memoryDisks.get(snapshot.getMetadataDiskId());
@Override protected IsWidget createIcon() { Span iconSpan = new Span(); iconSpan.addStyleName(Styles.FONT_AWESOME_BASE); if (SnapshotStatus.IN_PREVIEW.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.EYE.getCssName()); } else if (SnapshotStatus.LOCKED.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.LOCK.getCssName()); } else if (getEntity().containsMemory()) { iconSpan.addStyleName(IconType.MICROCHIP.getCssName()); } else { iconSpan.addStyleName(IconType.CAMERA.getCssName()); } iconSpan.addStyleName(PatternflyConstants.PF_LIST_VIEW_ICON_SM); iconPanel.add(iconSpan); return iconPanel; }
@Mapping(from = org.ovirt.engine.core.common.businessentities.Snapshot.class, to = Snapshot.class) public static Snapshot map(org.ovirt.engine.core.common.businessentities.Snapshot entity, Snapshot template) { Snapshot model = template != null ? template : new Snapshot(); model.setId(entity.getId().toString()); if (entity.getDescription() != null) { model.setDescription(entity.getDescription()); } if (entity.getCreationDate() != null) { model.setDate(DateMapper.map(entity.getCreationDate(), null)); } if (entity.getStatus() != null) { model.setSnapshotStatus(map(entity.getStatus(), null)); } if (entity.getType() != null) { model.setSnapshotType(map(entity.getType(), null)); } model.setPersistMemorystate(entity.containsMemory()); return model; }
List<DiskImage> disksExcludedFromSnapshot = imagesSubtract(getVmDisks(), snapshotDisks); boolean showMemorySnapshotWarning = isMemorySnapshotSupported() && snapshot.containsMemory(); boolean showPartialSnapshotWarning = !disksExcludedFromSnapshot.isEmpty();
private Container createGeneralItemContainerPanel(Snapshot snapshot, VmSnapshotListModel listModel) { Row content = new Row(); Column column = new Column(ColumnSize.MD_12); content.add(column); DListElement dl = Document.get().createDLElement(); dl.addClassName(DL_HORIZONTAL); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.dateSnapshot()), SafeHtmlUtils.fromString(getCreateDateString(snapshot)), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.statusSnapshot()), SafeHtmlUtils.fromString(snapshot.getStatus().name()), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.memorySnapshot()), SafeHtmlUtils.fromString(String.valueOf(snapshot.containsMemory())), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.descriptionSnapshot()), SafeHtmlUtils.fromTrustedString(getDescription(snapshot)), dl); VM entity = listModel.getEntity(); if (entity != null) { addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.definedMemoryVm()), SafeHtmlUtils.fromString(messages.megabytes(String.valueOf(entity.getVmMemSizeMb()))), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.physMemGauranteedVm()), SafeHtmlUtils.fromString(messages.megabytes(String.valueOf(entity.getMinAllocatedMem()))), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.numOfCpuCoresVm()), SafeHtmlUtils.fromString(messages.cpuInfoLabel(entity.getNumOfCpus(), entity.getNumOfSockets(), entity.getCpuPerSocket(), entity.getThreadsPerCpu())), dl); } column.getElement().appendChild(dl); return createItemContainerPanel(content); }