@Transactional(readOnly = true) @Override public List<DropDownObject> getBatteryList() { List<DropDownObject> dropDownObjectList = new ArrayList<DropDownObject>(); List<Battery> batteryList = batteryRepository.getBatteryList(); for (Battery battery : batteryList) { dropDownObjectList.add( new DropDownObject(battery.getBatteryId().toString(), battery.getName())); } return dropDownObjectList; }
public BatteryInfo convertToBatteryItem(Battery battery) { if (battery == null) { return null; } BatteryInfo batteryInfo = new BatteryInfo(); batteryInfo.setBatteryId(battery.getBatteryId()); batteryInfo.setName(battery.getName()); batteryInfo.setDisabled(battery.isDisabled()); batteryInfo.setDescription(battery.getDescription()); batteryInfo.setDateCreated(battery.getDateCreated()); return batteryInfo; }
@Transactional(readOnly = true) @Override public Set<BatteryDto> getBatteryDtoSet() { Set<BatteryDto> batteryDtoList = Sets.newTreeSet(); List<Battery> batteryList = batteryRepository.getBatteryList(); for (Battery battery : batteryList) { BatteryDto batterycDto = new BatteryDto(); batterycDto.setBatteryId(battery.getBatteryId()); batterycDto.setBatteryName(battery.getName()); batteryDtoList.add(batterycDto); } return batteryDtoList; }