use of com.management.dto.HistoryDTO in project Internet-Software-Architectures by zivko11.
the class HistoryManager method ReadAll.
public ArrayList<HistoryDTO> ReadAll() {
ModelMapper mapper = new ModelMapper();
ArrayList<History> listEntities = (ArrayList<History>) historyRepository.findAll();
ArrayList<HistoryDTO> listDTO = new ArrayList<HistoryDTO>();
for (History tmp : listEntities) {
try {
HistoryDTO dto = mapper.map(tmp, HistoryDTO.class);
listDTO.add(dto);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
}
return listDTO;
}
use of com.management.dto.HistoryDTO in project Internet-Software-Architectures by zivko11.
the class HistoryManager method Read.
public HistoryDTO Read(int id) {
ModelMapper mapper = new ModelMapper();
HistoryDTO dto;
try {
History history = historyRepository.findOne(id);
dto = mapper.map(history, HistoryDTO.class);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
return dto;
}
Aggregations