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;
}
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;
}
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;
}
Aggregations