Search in sources :

Example 1 with TariffSchedule

use of org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffSchedule in project open-smart-grid-platform by OSGP.

the class AuthorizeDeviceFunctionsSteps method setTariffSchedule.

private void setTariffSchedule(final Map<String, String> requestParameters) throws WebServiceSecurityException, GeneralSecurityException, IOException {
    final org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.SetScheduleRequest request = new org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.SetScheduleRequest();
    request.setDeviceIdentification(getString(requestParameters, PlatformPubliclightingKeys.KEY_DEVICE_IDENTIFICATION, PlatformPubliclightingDefaults.DEFAULT_DEVICE_IDENTIFICATION));
    final TariffSchedule schedule = new TariffSchedule();
    final TariffValue tariffValue = new TariffValue();
    tariffValue.setHigh(true);
    tariffValue.setIndex(1);
    schedule.getTariffValue().add(tariffValue);
    schedule.setIndex(0);
    schedule.setWeekDay(org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.WeekDayType.ALL);
    schedule.setTime(DateTime.now().toString());
    schedule.setIsEnabled(true);
    schedule.setMinimumLightsOn(10);
    request.getSchedules().add(schedule);
    ScenarioContext.current().put(PlatformPubliclightingKeys.RESPONSE, this.tariffSwitchingScheduleManagementClient.setSchedule(request));
}
Also used : TariffSchedule(org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffSchedule) TariffValue(org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffValue)

Example 2 with TariffSchedule

use of org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffSchedule in project open-smart-grid-platform by OSGP.

the class SetTariffScheduleSteps method addScheduleForRequest.

private void addScheduleForRequest(final SetScheduleRequest request, final WeekDayType weekDay, final String startDay, final String endDay, final String time, final String scheduleTariffValue) throws DatatypeConfigurationException {
    final TariffSchedule schedule = new TariffSchedule();
    schedule.setWeekDay(weekDay);
    if (!startDay.isEmpty()) {
        schedule.setStartDay(DatatypeFactory.newInstance().newXMLGregorianCalendar(DateTime.parse(startDay).toDateTime(DateTimeZone.UTC).toGregorianCalendar()));
    }
    if (!endDay.isEmpty()) {
        schedule.setEndDay(DatatypeFactory.newInstance().newXMLGregorianCalendar(DateTime.parse(endDay).toDateTime(DateTimeZone.UTC).toGregorianCalendar()));
    }
    schedule.setTime(time);
    for (final String tariffValue : scheduleTariffValue.split(";")) {
        final TariffValue lv = new TariffValue();
        final String[] tariffValues = tariffValue.split(",");
        lv.setIndex(Integer.parseInt(tariffValues[0]));
        lv.setHigh(Boolean.parseBoolean(tariffValues[1]));
        schedule.getTariffValue().add(lv);
    }
    request.getSchedules().add(schedule);
}
Also used : TariffSchedule(org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffSchedule) ReadSettingsHelper.getString(org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString) TariffValue(org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffValue)

Aggregations

TariffSchedule (org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffSchedule)2 TariffValue (org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.TariffValue)2 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)1