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
Quintiq file version 2.0
#parent: #root
Method ChangeKeyChannelMeta (String systemGUID_i, String name_i, Boolean updateReferences_i, 
  LibDEF_IntegrationEvent event_i)
{
  Description: 'Update primary key combination System-GUID and name.'
  TextBody:
  [*
    // Jacky CHAN May-10-2016 (created)
    // raise error if not unique
    duplicatedChannelMeta := LibDEF_ChannelMeta::FindChannelMeta( this.System().DataBroker(), systemGUID_i, name_i, this );
    if( not isnull( duplicatedChannelMeta ) )
    {
      LibDEF_Util::EventLogError( event_i,
                                  "Failed to update Channel's primary key",
                                  "LibDEF_ChannelMeta::ChangeKeyChannelMeta fails due to duplicated entry of LibDEF_ChannelMeta" +
                                  duplicatedChannelMeta.GetInstanceKeyAsString() );
    }
    
    this.SystemGUID( systemGUID_i );
    this.Name      ( name_i );
    
    if( updateReferences_i )
    {
      // update references
      traverse( this, SetTypeMeta, st )
      {
        st.ChangeKeySetTypeMeta( systemGUID_i, name_i,        // modified keys
                                 st.Name(),                   // unchanged keys
                                 updateReferences_i,
                                 event_i );
    
        traverse( st, SetMeta, set )
        {
          set.ChangeKeySetMeta( systemGUID_i, name_i,             // modified keys
                                set.SetTypeName(), set.Name(),    // unchanged keys
                                event_i );
        }
      }
    }
  *]
}