Search in sources :

Example 61 with ModelMapper

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;
}
Also used : PropsDTO(com.management.dto.PropsDTO) Props(com.management.entities.Props) ModelMapper(org.modelmapper.ModelMapper)

Example 62 with ModelMapper

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;
}
Also used : PropsDTO(com.management.dto.PropsDTO) ArrayList(java.util.ArrayList) Props(com.management.entities.Props) ModelMapper(org.modelmapper.ModelMapper)

Example 63 with ModelMapper

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;
}
Also used : Seat(com.management.entities.Seat) ModelMapper(org.modelmapper.ModelMapper)

Example 64 with ModelMapper

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;
}
Also used : SeatDTO(com.management.dto.SeatDTO) Seat(com.management.entities.Seat) ModelMapper(org.modelmapper.ModelMapper)

Example 65 with ModelMapper

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;
}
Also used : Seat(com.management.entities.Seat) ModelMapper(org.modelmapper.ModelMapper)

Aggregations

ModelMapper (org.modelmapper.ModelMapper)187 Bean (org.springframework.context.annotation.Bean)37 ArrayList (java.util.ArrayList)18 Date (java.util.Date)6 LocalDate (java.time.LocalDate)5 List (java.util.List)5 Map (java.util.Map)5 Optional (java.util.Optional)5 Actor (com.management.entities.Actor)4 CinemaTheatre (com.management.entities.CinemaTheatre)4 Event (com.management.entities.Event)4 Performance (com.management.entities.Performance)4 Props (com.management.entities.Props)4 User (com.management.entities.User)4 Collectors (java.util.stream.Collectors)4 PutMessageRequestType (no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Actorperformances (com.management.entities.Actorperformances)3 FanZone (com.management.entities.FanZone)3