use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class HallManager method ReadAll.
public ArrayList<HallDTO> ReadAll() {
ModelMapper mapper = new ModelMapper();
ArrayList<Hall> listEntities = (ArrayList<Hall>) hallRepository.findAll();
ArrayList<HallDTO> listDTO = new ArrayList<HallDTO>();
for (Hall tmp : listEntities) {
try {
HallDTO dto = mapper.map(tmp, HallDTO.class);
listDTO.add(dto);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
}
return listDTO;
}
use of org.modelmapper.ModelMapper 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 org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class PropsManager method Read.
public PropsDTO Read(int id) {
ModelMapper mapper = new ModelMapper();
PropsDTO dto;
try {
Props props = propsRepository.findOne(id);
dto = mapper.map(props, PropsDTO.class);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
return dto;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class PropsManager method ReadAll.
public ArrayList<PropsDTO> ReadAll() {
ModelMapper mapper = new ModelMapper();
ArrayList<Props> listEntities = (ArrayList<Props>) propsRepository.findAll();
ArrayList<PropsDTO> listDTO = new ArrayList<PropsDTO>();
for (Props tmp : listEntities) {
try {
PropsDTO dto = mapper.map(tmp, PropsDTO.class);
listDTO.add(dto);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
}
return listDTO;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class SeatManager method Create.
public boolean Create(SeatDTO dto) {
ModelMapper mapper = new ModelMapper();
Seat seat;
try {
seat = mapper.map(dto, Seat.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
seatRepository.save(seat);
return true;
}
Aggregations