use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType in project open-smart-grid-platform by OSGP.
the class SetActivityCalendarRequestBuilder method getWeekType.
private WeekType getWeekType(final String weekName) {
final WeekType wt = new WeekType();
final WeekProfile wp = this.activityCalendar.getWeekProfiles().get(weekName);
wt.setWeekProfileName(wp.getName());
wt.setMonday(this.getDayType(wp.getMondayDayId()));
wt.setTuesday(this.getDayType(wp.getTuesdayDayId()));
wt.setWednesday(this.getDayType(wp.getWednesdayDayId()));
wt.setThursday(this.getDayType(wp.getThursdayDayId()));
wt.setFriday(this.getDayType(wp.getFridayDayId()));
wt.setSaturday(this.getDayType(wp.getSaturdayDayId()));
wt.setSunday(this.getDayType(wp.getSundayDayId()));
return wt;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType in project open-smart-grid-platform by OSGP.
the class SetActivityCalendarRequestFactory method fetchActivityCalendar.
private static ActivityCalendarType fetchActivityCalendar() {
final ActivityCalendarType activityCalendarType = new ActivityCalendarType();
final String activatePassiveCalendarTime = "FFFFFFFEFFFFFFFFFF000000";
final byte[] decodedActivatePassiveCalendarTime;
try {
decodedActivatePassiveCalendarTime = Hex.decodeHex(activatePassiveCalendarTime.toCharArray());
activityCalendarType.setActivatePassiveCalendarTime(decodedActivatePassiveCalendarTime);
} catch (final DecoderException e) {
LOGGER.error("Unexpected exception during decode activatePassiveCalendarTime.", e);
}
activityCalendarType.setCalendarName("Cal Name");
final SeasonsType seasonsType = new SeasonsType();
final List<SeasonType> seasons = new ArrayList<>();
final SeasonType season = new SeasonType();
season.setSeasonProfileName("1");
final String seasonStart = "FFFF0C03FFFFFFFFFF000000";
final byte[] decodedSeasonStart;
try {
decodedSeasonStart = Hex.decodeHex(seasonStart.toCharArray());
season.setSeasonStart(decodedSeasonStart);
} catch (final DecoderException e) {
LOGGER.error("Unexpected exception during decode seasonStart.", e);
}
final WeekType weekType = new WeekType();
final DayType normalDay = createDayType(1, "06050000");
final DayType weekendDay = createDayType(2, "07050000");
weekType.setMonday(normalDay);
weekType.setTuesday(normalDay);
weekType.setWednesday(normalDay);
weekType.setThursday(normalDay);
weekType.setFriday(normalDay);
weekType.setSaturday(weekendDay);
weekType.setSunday(weekendDay);
weekType.setWeekProfileName("1");
season.setWeekProfile(weekType);
seasons.add(season);
seasonsType.getSeason().addAll(seasons);
activityCalendarType.setSeasonProfile(seasonsType);
return activityCalendarType;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType 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