|
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-java/ |
|
String localFileName = "Calenar_with_exception.mpp"; |
|
String remoteFileName = TestInitializer.UploadFile(localFileName); |
|
|
|
GetCalendarExceptionsRequest request1 = new GetCalendarExceptionsRequest(remoteFileName, 1, null, null); |
|
CalendarExceptionsResponse result1 = TestInitializer.tasksApi.getCalendarExceptions(request1); |
|
assertNotNull(result1.getCalendarExceptions()); |
|
|
|
WorkingTime workingTime = new WorkingTime(); |
|
workingTime.setFromTime(OffsetDateTime.of(1, 1, 1, 9, 0, 0, 0, ZoneOffset.UTC)); |
|
workingTime.setToTime(OffsetDateTime.of(1, 1, 1, 17, 0, 0, 0, ZoneOffset.UTC)); |
|
CalendarException exception = result1.getCalendarExceptions().get(0); |
|
exception.setWorkingTimes(Collections.singletonList(workingTime)); |
|
exception.setDaysOfWeek(Arrays.asList(DayType.THURSDAY, DayType.FRIDAY)); |
|
exception.setOccurrences(10); |
|
exception.setEnteredByOccurrences(true); |
|
exception.setPeriod(1); |
|
exception.setName("Non-working day exception"); |
|
exception.setDayWorking(true); |
|
exception.setFromDate(OffsetDateTime.of(2014, 10, 27, 0, 0, 0, 0, ZoneOffset.UTC)); |
|
exception.setToDate(OffsetDateTime.of(2015, 8, 5, 23, 59, 0, 0, ZoneOffset.UTC)); |
|
|
|
PutCalendarExceptionRequest request2 = new PutCalendarExceptionRequest(remoteFileName, 1, exception.getIndex(), exception, null, null, null); |
|
AsposeResponse result2 = TestInitializer.tasksApi.putCalendarException(request2); |
|
assertNotNull(result2); |
|
assertEquals(200, (int) result2.getCode()); |