Package com.gwtplatform.carstore.shared.dto

Examples of com.gwtplatform.carstore.shared.dto.CarDto


    ResourceDelegate<CarsResource> carsDelegate;

    @Test
    public void onEditCar(PlaceManager placeManager, ManufacturerDto manufacturerDto) {
        // Given
        CarDto carDto = mock(CarDto.class);
        given(carDto.getManufacturer()).willReturn(manufacturerDto);
        given(carProxyFactory.create(carDto, carDto.getManufacturer().getName() + carDto.getModel())).willReturn(proxy);
        given(proxy.getNameToken()).willReturn("token");

        PlaceRequest placeRequest = new PlaceRequest.Builder().nameToken("token").build();

        // When
View Full Code Here


    }

    @Test
    public void onDelete(HasData<CarDto> hasCarData, Range range, CarsResource carsResource, CarResource carResource) {
        // Given
        CarDto carDto = new CarDto();
        carDto.setId(3L);

        given(carsResource.car(carDto.getId())).willReturn(carResource);

        // We delete the car
        givenDelegate(carsDelegate).useResource(carsResource)
                .and().succeed()
                .when(carResource).delete();
View Full Code Here

    public static CarDto createDto(Car car) {
        if (car == null) {
            return null;
        }

        CarDto carDto = new CarDto();
        carDto.setCarProperties(CarProperties.createDto(car.getCarProperties()));
        carDto.setId(car.getId());
        carDto.setManufacturer(Manufacturer.createDto(car.getManufacturer()));
        carDto.setModel(car.getModel());

        return carDto;
    }
View Full Code Here

            carPropertiesLancer = carPropertiesDao.put(carPropertiesLancer);

            CarPropertiesDto carPropertiesMitsubishi = new CarPropertiesDto("Cow", 3, new Date());
            carPropertiesMitsubishi = carPropertiesDao.put(carPropertiesMitsubishi);

            CarDto civic = new CarDto("Civic", honda, carPropertiesCivic);
            CarDto accord = new CarDto("Accord", honda, carPropertiesAccord);
            CarDto lancer = new CarDto("Lancer", mitsubishi, carPropertiesLancer);
            CarDto galant = new CarDto("Galant", mitsubishi, carPropertiesMitsubishi);

            civic = Car.createDto(carDao.put(Car.create(civic)));
            accord = Car.createDto(carDao.put(Car.create(accord)));
            lancer = Car.createDto(carDao.put(Car.create(lancer)));
            galant = Car.createDto(carDao.put(Car.create(galant)));
View Full Code Here

public class ReportService {
    public List<ManufacturerRatingDto> getAverageCarRatings(List<RatingDto> ratingDtos) {
        HashMap<String, AveragingCounter> averages = new HashMap<>();

        for (RatingDto ratingDto : ratingDtos) {
            CarDto carDto = ratingDto.getCar();
            ManufacturerDto manufacturer = carDto.getManufacturer();
            String manufacturerName = manufacturer.getName();
            Double rating = Double.valueOf(ratingDto.getRating());

            if (averages.containsKey(manufacturerName)) {
                averages.get(manufacturerName).add(rating);
View Full Code Here

        this.carsDelegate = carsDelegate;
        this.manufacturersDelegate = manufacturersDelegate;
        this.messages = messages;
        this.placeManager = placeManager;
        this.carProxyFactory = carProxyFactory;
        this.carDto = carDto != null ? carDto : new CarDto();

        getView().setUiHandlers(this);
    }
View Full Code Here

    private void onCarSaved(CarDto oldCar, CarDto newCar) {
        DisplayMessageEvent.fire(CarPresenter.this, new Message(messages.carSaved(), MessageStyle.SUCCESS));
        CarAddedEvent.fire(CarPresenter.this, newCar, oldCar.getId() == null);

        if (oldCar.getId() == null) {
            carDto = new CarDto();
            getView().resetFields(carDto);

            MyProxy proxy = carProxyFactory.create(newCar, newCar.getManufacturer().getName() + newCar.getModel());

            placeManager.revealPlace(new PlaceRequest.Builder().nameToken(proxy.getNameToken()).build());
View Full Code Here

    }

    @Override
    protected void onBind() {
        addRegisteredHandler(ActionBarEvent.getType(), this);
        carProxyFactory.create(new CarDto(), NameTokens.NEW_CAR);
    }
View Full Code Here

TOP

Related Classes of com.gwtplatform.carstore.shared.dto.CarDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.