use of com.management.entities.History in project Internet-Software-Architectures by zivko11.
the class HistoryManager method Create.
public boolean Create(HistoryDTO dto) {
ModelMapper mapper = new ModelMapper();
History history;
try {
history = mapper.map(dto, History.class);
historyRepository.save(history);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
return true;
}
use of com.management.entities.History 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.entities.History 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;
}
use of com.management.entities.History in project Internet-Software-Architectures by zivko11.
the class HistoryManager method Update.
public boolean Update(HistoryDTO dto) {
ModelMapper mapper = new ModelMapper();
History tmp;
try {
tmp = mapper.map(dto, History.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
historyRepository.save(tmp);
return true;
}
Aggregations