Search in sources :

Example 21 with ModelMapper

use of org.modelmapper.ModelMapper in project Internet-Software-Architectures by zivko11.

the class UserManager method Create.

public boolean Create(UserDTO dto) {
    ModelMapper mapper = new ModelMapper();
    User user;
    try {
        user = mapper.map(dto, User.class);
    } catch (Exception exc) {
        exc.printStackTrace();
        return false;
    }
    if (token == null) {
        return false;
    }
    Date expiration = new Date();
    expiration.setTime(expiration.getTime() + (24 * 60 * 60 * 1000));
    user.setToken(token);
    user.setExpiration(expiration);
    userRepository.save(user);
    return true;
}
Also used : User(com.management.entities.User) Date(java.util.Date) ModelMapper(org.modelmapper.ModelMapper)

Example 22 with ModelMapper

use of org.modelmapper.ModelMapper in project easy-tests by malinink.

the class UserEntity method map.

public void map(UserModelInterface userModel) {
    final ModelMapper modelMapper = new ModelMapper();
    modelMapper.map(userModel, this);
}
Also used : ModelMapper(org.modelmapper.ModelMapper)

Example 23 with ModelMapper

use of org.modelmapper.ModelMapper in project microservices by pwillhan.

the class ModelMapperAutoConfiguration method modelMapper.

@Bean
@ConditionalOnMissingBean
public ModelMapper modelMapper() {
    ModelMapper modelMapper = new ModelMapper();
    addMappings(modelMapper);
    addConverters(modelMapper);
    return modelMapper;
}
Also used : ModelMapper(org.modelmapper.ModelMapper) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 24 with ModelMapper

use of org.modelmapper.ModelMapper in project selenium_java by sergueik.

the class ExcelReportWriter method write.

@Override
public void write(ExceptionRecord record) {
    NormalRecord normalRecord = record.getNormalRecord();
    ModelMapper mapper = new ModelMapper();
    ExcelReport excelReport = mapper.map(normalRecord, ExcelReport.class);
    excelReport.setDetail(record.getStackTraceText());
    fillReport(normalRecord, ReportStatus.EXCEPTION, excelReport);
    utils.export(excelReport);
}
Also used : NormalRecord(com.surenpi.autotest.report.record.NormalRecord) ExcelReport(com.surenpi.autotest.report.excel.model.ExcelReport) ModelMapper(org.modelmapper.ModelMapper)

Example 25 with ModelMapper

use of org.modelmapper.ModelMapper in project useful-java-links by Vedenin.

the class ModelMapperHelloWorld method main.

public static void main(String[] args) {
    // init mapper
    PropertyMap<Source, Destination> orderMap = new PropertyMap<Source, Destination>() {

        protected void configure() {
            map().setText(source.getMessage());
        }
    };
    ModelMapper modelMapper = new ModelMapper();
    modelMapper.addMappings(orderMap);
    // convert
    Source source = new Source("Hello World!");
    Destination destObject = modelMapper.map(source, Destination.class);
    // print Hello World!
    destObject.print();
}
Also used : PropertyMap(org.modelmapper.PropertyMap) ModelMapper(org.modelmapper.ModelMapper)

Aggregations

ModelMapper (org.modelmapper.ModelMapper)78 ArrayList (java.util.ArrayList)16 Date (java.util.Date)5 Actor (com.management.entities.Actor)4 CinemaTheatre (com.management.entities.CinemaTheatre)4 Event (com.management.entities.Event)4 Hall (com.management.entities.Hall)4 Performance (com.management.entities.Performance)4 Props (com.management.entities.Props)4 Seat (com.management.entities.Seat)4 User (com.management.entities.User)4 Actorperformances (com.management.entities.Actorperformances)3 FanZone (com.management.entities.FanZone)3 Friendslist (com.management.entities.Friendslist)3 History (com.management.entities.History)3 OmcOrder (com.paascloud.provider.model.domain.OmcOrder)3 UacUserToken (com.paascloud.provider.model.domain.UacUserToken)3 Transactional (org.springframework.transaction.annotation.Transactional)3 SimpleExportXmEntityDto (com.icthh.xm.ms.entity.domain.SimpleExportXmEntityDto)2 ActorDTO (com.management.dto.ActorDTO)2