public ArrayList<String> getUsedLunsMessages(List<LUNs> luns) { ArrayList<String> usedLunsMessages = new ArrayList<>(); UIMessages messages = ConstantsManager.getInstance().getMessages(); for (LUNs lun : luns) { if (lun.getStatus() == LunStatus.Used) { String reason = null; if (lun.getVolumeGroupId() != null && !lun.getVolumeGroupId().isEmpty()) { reason = messages.lunUsedByVG(lun.getVolumeGroupId()); } usedLunsMessages.add(reason == null ? lun.getLUNId() : messages.usedLunIdReason(lun.getLUNId(), reason)); } } return usedLunsMessages; }
/** * Ensures the right set of LUNs are returned. */ @Test public void testGetAllForVolumeGroup() { List<LUNs> result = dao.getAllForVolumeGroup(existingEntity.getVolumeGroupId()); assertNotNull(result); assertFalse(result.isEmpty()); for (LUNs lun : result) { assertEquals(existingEntity.getVolumeGroupId(), lun.getVolumeGroupId()); } }
model.setLunMapping(entity.getLunMapping()); if (entity.getVolumeGroupId() != null && !entity.getVolumeGroupId().isEmpty()) { model.setVolumeGroupId(entity.getVolumeGroupId());
@Override protected MapSqlParameterSource createFullParametersMapper(LUNs lun) { return createIdParameterMapper(lun.getId()) .addValue("physical_volume_id", lun.getPhysicalVolumeId()) .addValue("volume_group_id", lun.getVolumeGroupId()) .addValue("serial", lun.getSerial()) .addValue("lun_mapping", lun.getLunMapping()) .addValue("vendor_id", lun.getVendorId()) .addValue("product_id", lun.getProductId()) .addValue("device_size", lun.getDeviceSize()) .addValue("discard_max_size", lun.getDiscardMaxSize()); } }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getLUNId()) .append("physicalVolumeId", getPhysicalVolumeId()) .append("volumeGroupId", getVolumeGroupId()) .append("serial", getSerial()) .append("lunMapping", getLunMapping()) .append("vendorId", getVendorId()) .append("productId", getProductId()) .append("lunConnections", getLunConnections()) .append("deviceSize", getDeviceSize()) .append("pvSize", getPvSize()) .append("peCount", getPeCount()) .append("peAllocatedCount", getPeAllocatedCount()) .append("vendorName", getVendorName()) .append("pathsDictionary", getPathsDictionary()) .append("pathsCapacity", getPathsCapacity()) .append("lunType", getLunType()) .append("status", getStatus()) .append("diskId", getDiskId()) .append("diskAlias", getDiskAlias()) .append("storageDomainId", getStorageDomainId()) .append("storageDomainName", getStorageDomainName()) .append("discardMaxSize", getDiscardMaxSize()) .build(); }