yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Quintiq file version 2.0
#parent: #root
Method SynchronizeCalendarData (
  LibDII_CalendarDataTransformation dataTransformation_i
) as LibDIF_IntegrationDataset
{
  Description:
  [*
    Synchronize calendar data to the planning-dataset.
    Is added as extension in library DII_Calendars.
  *]
  TextBody:
  [*
    // ToDo: should be input-arguments
    context  := "";
    doDelete := true;
    keepIfNotCreatedByIntegration := false;
    
    // Get the integration objects for the calendars...
    integrationCalendars := this.GetIntegrationObjects( dataTransformation_i );
    
    // ...and synchronize them.
    synchronizedCalendars := dataTransformation_i.SynchronizeCalendarData( integrationCalendars, context, doDelete, keepIfNotCreatedByIntegration );
    
    // Update the calendars that have been synchronized.
    traverse( synchronizedCalendars, Elements, calendar )
    {
      calendar.GenerateOccurrences();
    }
    
    // If applicable, delete the Calendars that were not present in the import.
    // This is done here at the end of the synchronization and not already in SynchronizeCalendars() because deleting calendars can result
    // in actions in the planning (DeleteNotImportedCalendars() can be overridden) that should only done at the end of the synchronization.
    
    if( doDelete )
    {
      info( ">>> TO BE LOOKED AT !!!" );
      //importExport_i.DeleteNotImportedCalendars( synchronizedCalendars, context_i, keepIfNotImported_i );
    }
    
    return this;
  *]
}