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;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class SeatManager method Read.
public SeatDTO Read(int id) {
ModelMapper mapper = new ModelMapper();
SeatDTO dto;
try {
Seat seat = seatRepository.findOne(id);
dto = mapper.map(seat, SeatDTO.class);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
return dto;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class SeatManager method Update.
public boolean Update(SeatDTO dto) {
ModelMapper mapper = new ModelMapper();
Seat tmp;
try {
tmp = mapper.map(dto, Seat.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
seatRepository.save(tmp);
return true;
}
Aggregations