@Override public String getValue(SnapshotModel snapshotModel) { return snapshotModel.getEntity().getDescription(); } }, constants.descriptionSnapshot(), "100px"); //$NON-NLS-1$
@Override protected org.ovirt.engine.core.common.businessentities.Snapshot getEntity(int index) { org.ovirt.engine.core.common.businessentities.Snapshot snapshot = mock(org.ovirt.engine.core.common.businessentities.Snapshot.class); when(snapshot.getId()).thenReturn(GUIDS[index]); when(snapshot.getDescription()).thenReturn(DESCRIPTIONS[index]); return snapshot; }
private String getDescription(Snapshot snapshot) { String description = SafeHtmlUtils.fromString(snapshot.getDescription()).asString(); if (snapshot.getStatus() == SnapshotStatus.IN_PREVIEW) { List<String> previewedItems = new ArrayList<>(Arrays.asList(constants.vmConfiguration())); previewedItems.addAll(Linq.getDiskAliases(snapshot.getDiskImages())); description = messages.snapshotPreviewing( description, String.join(", ", previewedItems)); //$NON-NLS-1$ } else if (snapshot.getType() == SnapshotType.STATELESS) { description = description + " (" + constants.readonlyLabel() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } else if (snapshot.getType() == SnapshotType.PREVIEW) { description = constants.snapshotDescriptionActiveVmBeforePreview(); } else if (snapshot.getType() == SnapshotType.ACTIVE) { description = constants.snapshotDescriptionActiveVm(); } else if (snapshot.getType() == SnapshotType.REGULAR && !snapshot.getDiskImages().isEmpty()) { description = messages.snapshotPreviewing( description, String.join(", ", Linq.getDiskAliases(snapshot.getDiskImages()))); //$NON-NLS-1$ } else if (snapshot.isVmConfigurationBroken()) { description = description + " (" + constants.brokenVmConfiguration() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } return description; }
@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; }
_writer.writeAttributeString(getOvfUri(), "id", snapshot.getId().toString()); _writer.writeElement("Type", snapshot.getType().name()); _writer.writeElement("Description", snapshot.getDescription()); _writer.writeElement("CreationDate", OvfParser.localDateToUtcDateString(snapshot.getCreationDate()));
private void commit() { if (getEntity() != null) { if (getWindow() != null) { return; } Snapshot snapshot = getSelectedItem(); ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().commitSnapshotTitle()); model.setHelpTag(HelpTag.commit_snapshot); model.setHashName("commit_snapshot"); //$NON-NLS-1$ model.setMessage(ConstantsManager.getInstance() .getMessages() .areYouSureYouWantToCommitSnapshot( DateTimeFormat.getFormat(DATE_FORMAT).format(snapshot.getCreationDate()), snapshot.getDescription())); model.getCommands().add(UICommand.createDefaultOkUiCommand("OnCommit", this)); //$NON-NLS-1$ model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); //$NON-NLS-1$ } }
private void remove() { if (getEntity() != null) { if (getWindow() != null) { return; } Snapshot snapshot = getSelectedItem(); ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().deleteSnapshotTitle()); model.setHelpTag(HelpTag.delete_snapshot); model.setHashName("delete_snapshot"); //$NON-NLS-1$ model.setMessage(ConstantsManager.getInstance() .getMessages() .areYouSureYouWantToDeleteSanpshot( DateTimeFormat.getFormat(DATE_FORMAT).format(snapshot.getCreationDate()), snapshot.getDescription())); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); //$NON-NLS-1$ model.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); //$NON-NLS-1$ model.getCommands().add(tempVar2); } }
@Override protected MapSqlParameterSource createFullParametersMapper(Snapshot entity) { return createIdParameterMapper(entity.getId()) .addValue("vm_id", entity.getVmId()) .addValue("snapshot_type", EnumUtils.nameOrNull(entity.getType())) .addValue("status", EnumUtils.nameOrNull(entity.getStatus())) .addValue("description", entity.getDescription()) .addValue("creation_date", entity.getCreationDate()) .addValue("app_list", entity.getAppList()) .addValue("vm_configuration", entity.getVmConfiguration()) .addValue("memory_dump_disk_id", entity.getMemoryDiskId()) .addValue("memory_metadata_disk_id", entity.getMetadataDiskId()) .addValue("vm_configuration_broken", entity.isVmConfigurationBroken()); }