Package org.vaadin.spring.samples.mvp.dto

Examples of org.vaadin.spring.samples.mvp.dto.DSRUpdateHourlyDTO


    // construct data for any day up to effective date of assetOwner
    public List<DSRUpdateDTO> getDSRHourly(DateTime day, String assetOwner) {
        List<DSRUpdateDTO> result = new ArrayList<>();
        DSRUpdateDTO dto = new DSRUpdateDTO();
        List<DSRUpdateHourlyDTO> hourlies = new ArrayList<>();
        DSRUpdateHourlyDTO h;
        DateTime hour;
        if (data.allParticipants().keySet().contains(assetOwner) && day.isBefore(MockData.TERMINATION_DATE)) {
            dto = new DSRUpdateDTO();
            dto.getId().setDay(SSTimeUtil.dateTimeToIsoDay(day));
            for (DSRUpdateHourlyDTO hourly: data.allDsrHourlyUpdates()) {
                if (assetOwner.equals(hourly.getId().getAssetOwner())) {
                    h = new DSRUpdateHourlyDTO();
                    h.setCommitStatus(hourly.getCommitStatus());
                    h.setEconomicMax(hourly.getEconomicMax());
                    h.setEconomicMin(hourly.getEconomicMin());
                    h.getId().setAssetOwner(hourly.getId().getAssetOwner());
                    h.getId().setLocation(hourly.getId().getLocation());
                    int parsedHour = Integer.parseInt(hourly.getId().getHour());
                    if (parsedHour >= 0 && parsedHour < 24) {
                        hour = day.plusHours(parsedHour);
                    } else {
                        hour = day.plusDays(1);
                    }
                    h.getId().setHour(SSTimeUtil.dateTimeToIsoNoMillis(hour));
                    hourlies.add(h);
                }
            }
            dto.setRecords(hourlies);
            result.add(dto);
View Full Code Here


    }

    public List<DSRUpdateHourlyDTO> allDsrHourlyUpdates() {
        List<DSRUpdateHourlyDTO> beans = new ArrayList<>();

        DSRUpdateHourlyDTO dto = null;
        String[] commitStatii = new String[] { CommitStatusType.ECONOMIC.getValue(), CommitStatusType.MUST_RUN.getValue(), CommitStatusType.UNAVAILABLE.getValue(),
                CommitStatusType.UNAVAILABLE.getValue(), CommitStatusType.UNAVAILABLE.getValue(), CommitStatusType.ECONOMIC.getValue(),
                CommitStatusType.ECONOMIC.getValue(), CommitStatusType.MUST_RUN.getValue(), CommitStatusType.UNAVAILABLE.getValue(),
                CommitStatusType.ECONOMIC.getValue(), CommitStatusType.ECONOMIC.getValue(), CommitStatusType.ECONOMIC.getValue(),
                CommitStatusType.ECONOMIC.getValue(), CommitStatusType.ECONOMIC.getValue(), CommitStatusType.ECONOMIC.getValue(),
                CommitStatusType.MUST_RUN.getValue(), CommitStatusType.MUST_RUN.getValue(), CommitStatusType.MUST_RUN.getValue(),
                CommitStatusType.MUST_RUN.getValue(), CommitStatusType.MUST_RUN.getValue(), CommitStatusType.MUST_RUN.getValue(),
                CommitStatusType.ECONOMIC.getValue(), CommitStatusType.MUST_RUN.getValue(), CommitStatusType.UNAVAILABLE.getValue()
        };
        BigDecimal[] ecoMin = new BigDecimal[] { new BigDecimal(10.1), new BigDecimal(10.2), new BigDecimal(10.3),
                new BigDecimal(10.1), new BigDecimal(10.1), new BigDecimal(10.4),
                new BigDecimal(10.4), new BigDecimal(10.5), new BigDecimal(10.1),
                new BigDecimal(10.1), new BigDecimal(10.2), new BigDecimal(10.2),
                new BigDecimal(10.2), new BigDecimal(10.2), new BigDecimal(10.6),
                new BigDecimal(10.5), new BigDecimal(10.2), new BigDecimal(10.5),
                new BigDecimal(10.5), new BigDecimal(10.5), new BigDecimal(10.5),
                new BigDecimal(10.3), new BigDecimal(10.2), new BigDecimal(10.4)};
        BigDecimal[] ecoMax = new BigDecimal[] { new BigDecimal(15.1), new BigDecimal(15.2), new BigDecimal(15.3),
                new BigDecimal(15.1), new BigDecimal(15.1), new BigDecimal(15.4),
                new BigDecimal(15.4), new BigDecimal(15.5), new BigDecimal(15.1),
                new BigDecimal(15.1), new BigDecimal(15.2), new BigDecimal(15.2),
                new BigDecimal(15.2), new BigDecimal(15.2), new BigDecimal(15.6),
                new BigDecimal(15.5), new BigDecimal(15.2), new BigDecimal(15.5),
                new BigDecimal(15.5), new BigDecimal(15.5), new BigDecimal(15.5),
                new BigDecimal(15.3), new BigDecimal(15.2), new BigDecimal(15.4)};

        String[] hours = new String[] {"24", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"};

        String[] locations = new String[] { "Bruderheim", "Immerhof", "Desseldorf"};

        for (int j = 0; j < 2; j++) {
            for (int i = 0; i < 24; i++) {
                dto = new DSRUpdateHourlyDTO();
                dto.setCommitStatus(commitStatii[i]);
                dto.setEconomicMax(ecoMax[i]);
                dto.setEconomicMin(ecoMin[i]);
                dto.getId().setHour(hours[i]);
                dto.getId().setAssetOwner("U0336H");
                dto.getId().setLocation(locations[j]);
                beans.add(dto);
            }
        }

        for (int i = 0; i < 24; i++) {
            dto = new DSRUpdateHourlyDTO();
            dto.setCommitStatus(commitStatii[i]);
            dto.setEconomicMax(ecoMax[i]);
            dto.setEconomicMin(ecoMin[i]);
            dto.getId().setHour(hours[i]);
            dto.getId().setAssetOwner("U0567H");
            dto.getId().setLocation(locations[2]);
            beans.add(dto);
        }

        return beans;
    }
View Full Code Here

TOP

Related Classes of org.vaadin.spring.samples.mvp.dto.DSRUpdateHourlyDTO

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.