use of it.istat.mec.catalog.dto.DesktopApplicationDto in project catalogo-strumenti by istat-methodology.
the class Translators method translate.
public static CatalogToolDTO translate(CatalogTool x) {
final ModelMapper modelMapper = new ModelMapper();
TypeMap<CatalogTool, CatalogToolDTO> typeMap = modelMapper.createTypeMap(CatalogTool.class, CatalogToolDTO.class);
typeMap.include(DesktopApplication.class, CatalogToolDTO.class).include(StatisticalService.class, CatalogToolDTO.class).include(SoftwareProcedure.class, CatalogToolDTO.class);
modelMapper.typeMap(DesktopApplication.class, CatalogToolDTO.class).setProvider(new Provider<CatalogToolDTO>() {
public CatalogToolDTO get(ProvisionRequest<CatalogToolDTO> request) {
return new DesktopApplicationDto();
}
});
modelMapper.typeMap(StatisticalService.class, CatalogToolDTO.class).setProvider(new Provider<CatalogToolDTO>() {
public CatalogToolDTO get(ProvisionRequest<CatalogToolDTO> request) {
return new StatisticalServiceDto();
}
});
modelMapper.typeMap(SoftwareProcedure.class, CatalogToolDTO.class).setProvider(new Provider<CatalogToolDTO>() {
public CatalogToolDTO get(ProvisionRequest<CatalogToolDTO> request) {
return new SoftwareProcedureDto();
}
});
CatalogToolDTO dTO = null;
if (x instanceof StatisticalService)
dTO = modelMapper.map(x, StatisticalServiceDto.class);
if (x instanceof DesktopApplication)
dTO = modelMapper.map(x, DesktopApplicationDto.class);
if (x instanceof SoftwareProcedure)
dTO = modelMapper.map(x, SoftwareProcedureDto.class);
return dTO;
}
use of it.istat.mec.catalog.dto.DesktopApplicationDto in project catalogo-strumenti by istat-methodology.
the class Translators method translate.
public static List<CatalogToolDTO> translate(List<CatalogTool> list) {
final ModelMapper modelMapper = new ModelMapper();
TypeMap<CatalogTool, CatalogToolDTO> typeMap = modelMapper.createTypeMap(CatalogTool.class, CatalogToolDTO.class);
typeMap.include(DesktopApplication.class, DesktopApplicationDto.class).include(StatisticalService.class, StatisticalServiceDto.class).include(SoftwareProcedure.class, SoftwareProcedureDto.class);
typeMap.include(DesktopApplication.class, CatalogToolDTO.class).include(StatisticalService.class, CatalogToolDTO.class).include(SoftwareProcedure.class, CatalogToolDTO.class);
modelMapper.typeMap(DesktopApplication.class, CatalogToolDTO.class).setProvider(new Provider<CatalogToolDTO>() {
public CatalogToolDTO get(ProvisionRequest<CatalogToolDTO> request) {
return new DesktopApplicationDto();
}
});
modelMapper.typeMap(StatisticalService.class, CatalogToolDTO.class).setProvider(new Provider<CatalogToolDTO>() {
public CatalogToolDTO get(ProvisionRequest<CatalogToolDTO> request) {
return new StatisticalServiceDto();
}
});
modelMapper.typeMap(SoftwareProcedure.class, CatalogToolDTO.class).setProvider(new Provider<CatalogToolDTO>() {
public CatalogToolDTO get(ProvisionRequest<CatalogToolDTO> request) {
return new SoftwareProcedureDto();
}
});
return mapList(list, CatalogToolDTO.class, modelMapper);
}
Aggregations