Synchronizing as Root Type

If our item type describes rather central or standalone items without much connection to other synchronized item types you should consider to add it to the root types of the synchronization instead of tweaking attributes as described before.

Context

All items of synchronization root types are evaluated at the beginning of a synchronizing operation and scheduled for synchronization if:

  • No counterpart item exists within the target catalog version, unless this has been disabled.

  • The source item modification time stamp is newer than last synchronizing time.

  • An item exists within the target catalog version but no longer in the source catalog version (by default this is disabled).

You can set add the new item to synchronization root types in the Multithreaded Synchronization in Backoffice.

Procedure

  1. Navigate to Start of the navigation pathSystem Next navigation step Multithreaded SynchronizationEnd of the navigation path.
  2. Select the synchronization from the list.
  3. Go to Start of the navigation pathAdministration Next navigation step UnboundEnd of the navigation path
  4. Add the new type to the Root types list.
  5. Of course this may also be put in code, preferably inside the createEssentialData method of your extension manager.
    public void createEssentialData(Map params, JspContext jspc) throws Exception
    {
       ...
       
       CatalogManager cm = CatalogManager.getInstance();
    
       // find source and target version
       CatalogVersion src = cm.getCatalog( "hwcatalog" ).getCatalogVersion( "staged" );
       CatalogVersion tgt = cm.getCatalog( "hwcatalog" ).getCatalogVersion( "online" );
    
       // find synchronization by source and target version
       SyncItemJob syncJob = cm.getSyncJob( src, tgt );
    
       // get modifieable list of root types
       List<ComposedType> rootTypes = new ArrayList<ComposedType>( syncJob.getRootTypes() );
    
       // insert our type at first position
       rootTypes.add( 
          0,
          TypeManager.getInstance().getComposedType( "Keyword" )
       );
    
       // dont forget to save them again
       syncJob.setRootTypes( rootTypes );
    
       ...
    }