@Override public int hashCode() { return Objects.hash( id, device, type, address, specParams, managed, plugged, getReadOnly(), alias, customProperties, snapshotId, logicalName, hostDevice ); }
@Override public Boolean getValue(VmDeviceFeEntity object) { return object.getVmDevice().getReadOnly(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof VmDevice)) { return false; } VmDevice other = (VmDevice) obj; return Objects.equals(id, other.id) && device.equals(other.device) && type.equals(other.type) && address.equals(other.address) && Objects.equals(specParams, other.specParams) && managed == other.managed && isPlugged() == other.isPlugged() && getReadOnly().equals(other.getReadOnly()) && alias.equals(other.alias) && Objects.equals(customProperties, other.customProperties) && Objects.equals(snapshotId, other.snapshotId) && Objects.equals(logicalName, other.logicalName) && Objects.equals(hostDevice, other.hostDevice); }
@SuppressWarnings("unchecked") public VmPayload(VmDevice dev) { super(dev.getId(), dev.getType(), dev.getDevice(), dev.getAddress(), dev.getSpecParams(), dev.isManaged(), dev.isPlugged(), dev.getReadOnly(), dev.getAlias(), dev.getCustomProperties(), dev.getSnapshotId(), dev.getLogicalName()); if (dev.getSpecParams() != null) { Map<String, Object> payload = (Map<String, Object>)dev.getSpecParams().get(SpecParamsPayload); this.volumeId = (String)payload.get(SpecParamsVolumeIdType); this.files = (HashMap<String, String>)payload.get(SpecParamsFileType); } }
private void writeVmDeviceInfo(VmDevice vmDevice) { _writer.writeElement(VMD_TYPE, String.valueOf(vmDevice.getType().getValue())); _writer.writeElement(VMD_DEVICE, String.valueOf(vmDevice.getDevice())); _writer.writeElement(VMD_ADDRESS, vmDevice.getAddress()); _writer.writeElement(VMD_BOOT_ORDER, String.valueOf(vmDevice.getBootOrder())); _writer.writeElement(VMD_IS_PLUGGED, String.valueOf(vmDevice.isPlugged())); _writer.writeElement(VMD_IS_READONLY, String.valueOf(vmDevice.getReadOnly())); _writer.writeElement(VMD_ALIAS, String.valueOf(vmDevice.getAlias())); if (vmDevice.getSpecParams() != null && vmDevice.getSpecParams().size() != 0 && !VmPayload.isPayload(vmDevice.getSpecParams())) { _writer.writeStartElement(VMD_SPEC_PARAMS); _writer.writeMap(vmDevice.getSpecParams()); _writer.writeEndElement(); } if (vmDevice.getCustomProperties() != null && !vmDevice.getCustomProperties().isEmpty()) { _writer.writeElement(VMD_CUSTOM_PROP, DevicePropertiesUtils.getInstance().convertProperties(vmDevice.getCustomProperties())); } if (vmDevice.getSnapshotId() != null) { _writer.writeElement(VMD_SNAPSHOT_PROP, String.valueOf(vmDevice.getSnapshotId())); } }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", id) .append("device", getDevice()) .append("type", getType()) .append("specParams", getSpecParams()) .append("address", getAddress()) .append("managed", isManaged()) .append("plugged", isPlugged()) .append("readOnly", getReadOnly()) .append("deviceAlias", getAlias()) .append("customProperties", getCustomProperties()) .append("snapshotId", getSnapshotId()) .append("logicalName", getLogicalName()) .append("hostDevice", getHostDevice()) .build(); }
@Override protected MapSqlParameterSource createFullParametersMapper(VmDevice entity) { return createIdParameterMapper(entity.getId()) .addValue("device", entity.getDevice()) .addValue("type", entity.getType().getValue()) .addValue("address", entity.getAddress()) .addValue("spec_params", SerializationFactory.getSerializer().serialize(entity.getSpecParams())) .addValue("is_managed", entity.isManaged()) .addValue("is_plugged", entity.isPlugged()) .addValue("is_readonly", entity.getReadOnly()) .addValue("alias", entity.getAlias()) .addValue("custom_properties", SerializationFactory.getSerializer().serialize(entity.getCustomProperties())) .addValue("snapshot_id", entity.getSnapshotId()) .addValue("logical_name", entity.getLogicalName()) .addValue("host_device", entity.getHostDevice()); }