Search in sources :

Example 1 with DayProfileActionType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType in project open-smart-grid-platform by OSGP.

the class SetActivityCalendarRequestBuilder method getDayProfileActionType.

private DayProfileActionType getDayProfileActionType(final DayProfileAction dpa) {
    final DayProfileActionType dpat = new DayProfileActionType();
    dpat.setStartTime(DatatypeConverter.parseHexBinary(dpa.getStartTime()));
    dpat.setScriptSelector(BigInteger.valueOf(dpa.getScriptId()));
    return dpat;
}
Also used : DayProfileActionType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType)

Example 2 with DayProfileActionType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType in project open-smart-grid-platform by OSGP.

the class SetActivityCalendarRequestFactory method createDayType.

private static DayType createDayType(final int dayId, final String startTime) {
    final DayType dayType = new DayType();
    dayType.setDayId(BigInteger.valueOf(dayId));
    final List<DayProfileActionType> dayProfileActionTypes = new ArrayList<>();
    final DayProfileActionType dayProfileActionType = new DayProfileActionType();
    dayProfileActionType.setScriptSelector(BigInteger.valueOf(1L));
    final byte[] decodedStartTime;
    try {
        decodedStartTime = Hex.decodeHex(startTime.toCharArray());
        dayProfileActionType.setStartTime(decodedStartTime);
    } catch (final DecoderException e) {
        LOGGER.error("Unexpected exception during decode startTime from dayProfileActionType.", e);
    }
    dayProfileActionTypes.add(dayProfileActionType);
    final DayProfileActionsType dayProfilesActionType = new DayProfileActionsType();
    dayProfilesActionType.getDayProfileAction().addAll(dayProfileActionTypes);
    dayType.setDaySchedule(dayProfilesActionType);
    return dayType;
}
Also used : DecoderException(org.apache.commons.codec.DecoderException) DayProfileActionType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType) DayType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType) ArrayList(java.util.ArrayList) DayProfileActionsType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionsType)

Example 3 with DayProfileActionType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType in project open-smart-grid-platform by OSGP.

the class ActivityCalendarTypeMappingTest method buildActivityCalendarTypeObject.

/**
 * Method to build an ActivityCalendarType object
 */
private ActivityCalendarType buildActivityCalendarTypeObject() {
    // Build a DayType
    final DayProfileActionsType dayProfileActionsType = new DayProfileActionsType();
    final DayProfileActionType dayProfileActionType = new DayProfileActionType();
    dayProfileActionType.setScriptSelector(BigInteger.ZERO);
    dayProfileActionType.setStartTime(COSEMTIME_BYTE_ARRAY);
    dayProfileActionsType.getDayProfileAction().add(dayProfileActionType);
    final DayType dayType = new DayType();
    dayType.setDayId(BigInteger.TEN);
    dayType.setDaySchedule(dayProfileActionsType);
    // Build a WeekType
    final WeekType weekType = new WeekType();
    weekType.setWeekProfileName(WEEKPROFILENAME);
    weekType.setSunday(dayType);
    weekType.setMonday(dayType);
    weekType.setTuesday(dayType);
    weekType.setWednesday(dayType);
    weekType.setThursday(dayType);
    weekType.setFriday(dayType);
    weekType.setSaturday(dayType);
    // Build a SeasonType
    final SeasonType seasonType = new SeasonType();
    seasonType.setSeasonProfileName(SEASONPROFILENAME);
    seasonType.setSeasonStart(COSEMDATETIME_BYTE_ARRAY);
    seasonType.setWeekProfile(weekType);
    // Build an ActivityCalendarType.
    final ActivityCalendarType activityCalendarType = new ActivityCalendarType();
    final SeasonsType seasonsType = new SeasonsType();
    seasonsType.getSeason().add(seasonType);
    activityCalendarType.setActivatePassiveCalendarTime(COSEMDATETIME_BYTE_ARRAY);
    activityCalendarType.setCalendarName(CALENDARNAME);
    activityCalendarType.setSeasonProfile(seasonsType);
    return activityCalendarType;
}
Also used : SeasonsType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonsType) SeasonType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType) DayProfileActionType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType) ActivityCalendarType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ActivityCalendarType) DayProfileActionsType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionsType) DayType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType) WeekType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)

Aggregations

DayProfileActionType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType)3 DayProfileActionsType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionsType)2 DayType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType)2 ArrayList (java.util.ArrayList)1 DecoderException (org.apache.commons.codec.DecoderException)1 ActivityCalendarType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ActivityCalendarType)1 SeasonType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType)1 SeasonsType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonsType)1 WeekType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)1