use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class CinemaTheatreManager method Create.
public boolean Create(CinemaTheatreDTO dto) {
ModelMapper mapper = new ModelMapper();
CinemaTheatre cinemaTheatre;
try {
cinemaTheatre = mapper.map(dto, CinemaTheatre.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
cinemaTheatreRepository.save(cinemaTheatre);
return true;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class CinemaTheatreManager method Update.
public boolean Update(CinemaTheatreDTO dto) {
ModelMapper mapper = new ModelMapper();
CinemaTheatre tmp;
try {
tmp = mapper.map(dto, CinemaTheatre.class);
} catch (Exception exc) {
exc.printStackTrace();
return false;
}
cinemaTheatreRepository.save(tmp);
return true;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class EventManager method Read.
public EventDTO Read(int id) {
ModelMapper mapper = new ModelMapper();
EventDTO dto;
try {
Event event = eventRepository.findOne(id);
dto = mapper.map(event, EventDTO.class);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
return dto;
}
use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.
the class EventManager method ReadAll.
public ArrayList<EventDTO> ReadAll() {
ModelMapper mapper = new ModelMapper();
ArrayList<Event> listEntities = (ArrayList<Event>) eventRepository.findAll();
ArrayList<EventDTO> listDTO = new ArrayList<EventDTO>();
for (Event tmp : listEntities) {
try {
EventDTO dto = mapper.map(tmp, EventDTO.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 FanZoneManager method ReadAll.
public ArrayList<FanZoneDTO> ReadAll() {
ModelMapper mapper = new ModelMapper();
ArrayList<FanZone> listEntities = (ArrayList<FanZone>) fanZoneRepository.findAll();
ArrayList<FanZoneDTO> listDTO = new ArrayList<FanZoneDTO>();
for (FanZone tmp : listEntities) {
try {
FanZoneDTO dto = mapper.map(tmp, FanZoneDTO.class);
listDTO.add(dto);
} catch (Exception exc) {
exc.printStackTrace();
return null;
}
}
return listDTO;
}
Aggregations