parameters: (self, destination_archive_id,
                       archive_id,
                       source_connection_id=None,
                       source_deferred_connection_id=None,
                       update_destination_sql_catalog=None,
                       update_archive_sql_catalog=None,
                       clear_destination_sql_catalog=None,
                       clear_archive_sql_catalog=None,
                       REQUEST=None, RESPONSE=None)
docstring: This method is used to populate an archive from the current catalog
      It is base on hot reindexing, we start from a current catalog
      in order to create a new current catalog plus an archive catalog.
      Archives are defined in portal_archives, they are predicate thus
      we use test method to know in which catalog objects must go.
      At the end it creates inventories in order to have
      consistent data within the new catalog
docstring_summary: This method is used to populate an archive from the current catalog
      It is base on hot reindexing, we start from a current catalog
      in order to create a new current catalog plus an archive catalog.
      Archives are defined in portal_archives, they are predicate thus
      we use test method to know in which catalog objects must go.
      At the end it creates inventories in order to have
      consistent data within the new catalog
docstring_tokens: This method is used to populate an archive from the current catalog It is base on hot reindexing we start from a current catalog in order to create a new current catalog plus an archive catalog . Archives are defined in portal_archives they are predicate thus we use test method to know in which catalog objects must go . At the end it creates inventories in order to have consistent data within the new catalog
function: def manage_archive(self, destination_archive_id,
                       archive_id,
                       source_connection_id=None,
                       source_deferred_connection_id=None,
                       update_destination_sql_catalog=None,
                       update_archive_sql_catalog=None,
                       clear_destination_sql_catalog=None,
                       clear_archive_sql_catalog=None,
                       REQUEST=None, RESPONSE=None):
      """
      This method is used to populate an archive from the current catalog
      It is base on hot reindexing, we start from a current catalog
      in order to create a new current catalog plus an archive catalog.
      Archives are defined in portal_archives, they are predicate thus
      we use test method to know in which catalog objects must go.
      At the end it creates inventories in order to have
      consistent data within the new catalog
      """
      # First check parameter for destination catalog
      if destination_archive_id == archive_id:
        raise ValueError("Archive and destination archive can't be the same")
      portal_catalog =self.portal_catalog
      # Guess connection id from current catalog
      source_catalog = portal_catalog.getSQLCatalog()
      source_catalog_id = source_catalog.getId()
  
      source_connection_id = source_catalog.getConnectionId()
      source_deferred_connection_id = source_catalog.getConnectionId(deferred=True)
  
      if source_connection_id is None or source_deferred_connection_id is None:
        raise ValueError("Unable to determine connection id for the current catalog")
  
      # Get destination property from archive
      destination_archive_id = destination_archive_id.split(' - ')[0]
      destination_archive = self._getOb(destination_archive_id)
      destination_sql_catalog_id = destination_archive.getCatalogId()
      destination_connection_id = destination_archive.getConnectionId()
      destination_deferred_connection_id = destination_archive.getDeferredConnectionId()
  
      # Get archive property from archive
      archive_id = archive_id.split(' - ')[0]
      archive = self._getOb(archive_id)
      archive_sql_catalog_id = archive.getCatalogId()
      archive_connection_id = archive.getConnectionId()
      archive_deferred_connection_id = archive.getDeferredConnectionId()
  
      # Check we don't use same connection id for source and destination
      if destination_sql_catalog_id == source_catalog_id:
        raise ValueError("Destination and source catalog can't be the same")
      if destination_connection_id == source_connection_id:
        raise ValueError("Destination and source connection can't be the same")
      if destination_deferred_connection_id == source_deferred_connection_id:
        raise ValueError("Destination and source deferred connection can't be the same")
      # Same for source and archive
      if archive_sql_catalog_id == source_catalog_id:
        raise ValueError("Archive and source catalog can't be the same")
      if archive_connection_id == source_connection_id:
        raise ValueError("Archive and source connection can't be the same")
      if archive_deferred_connection_id == source_deferred_connection_id:
        raise ValueError("Archive and source deferred connection can't be the same")
      # Same for destination and archive
      if archive_sql_catalog_id == destination_sql_catalog_id:
        raise ValueError("Archive and destination catalog can't be the same")
      if archive_connection_id == destination_connection_id:
        raise ValueError("Archive and destination connection can't be the same")
      if archive_deferred_connection_id == destination_deferred_connection_id:
        raise ValueError("Archive and destination deferred connection can't be the same")
  
      # Update connection id in destination and archive catalog if asked
      destination_sql_catalog = getattr(portal_catalog, destination_sql_catalog_id)
      if update_destination_sql_catalog:
        sql_connection_id_dict = {source_connection_id : destination_connection_id,
                                  source_deferred_connection_id : destination_deferred_connection_id}
        portal_catalog.changeSQLConnectionIds(destination_sql_catalog,
                                    sql_connection_id_dict)
  
      archive_sql_catalog = getattr(portal_catalog, archive_sql_catalog_id)
      if update_archive_sql_catalog:
        sql_connection_id_dict = {source_connection_id : archive_connection_id,
                                  source_deferred_connection_id : archive_deferred_connection_id}
        portal_catalog.changeSQLConnectionIds(archive_sql_catalog,
                                    sql_connection_id_dict)
  
      # Clear destination and archive catalog if asked
      if clear_destination_sql_catalog:
        portal_catalog.manage_catalogClear(sql_catalog_id=destination_sql_catalog_id)
      if clear_archive_sql_catalog:
        portal_catalog.manage_catalogClear(sql_catalog_id=archive_sql_catalog_id)
  
      # validate archive
      archive.validate()
      destination_archive.validate()
  
      # Call hot reindexing
      portal_catalog.manage_hotReindexAll(source_sql_catalog_id=source_catalog_id,
                                               destination_sql_catalog_id=destination_sql_catalog_id,
                                               archive_path=archive.getPath(),
                                               source_sql_connection_id_list=[source_connection_id, \
                                                                              source_deferred_connection_id],
                                               destination_sql_connection_id_list=[destination_connection_id, \
                                                                                   destination_deferred_connection_id],
                                               REQUEST=REQUEST, RESPONSE=RESPONSE)
  
      # Create inventory just before finish of hot reindexing
      inventory_date = archive.getStopDateRangeMax()
      self.activate(after_method_id=('playBackRecordedObjectList'),
                    priority=5).runInventoryMethod(archive.id,
                                                   source_connection_id,
                                                   destination_sql_catalog_id,
                                                   inventory_date
                                                   )
  
  
      self.activate(after_method_id=('runInventoryMethod'),
                    after_tag="runInventoryMethod",
                    priority=5).InventoryModule_reindexMovementList(sql_catalog_id=destination_sql_catalog_id,
                                                                    final_activity_tag="InventoryModule_reindexMovementList"
                                                                    )
  
      if RESPONSE is not None:
        URL1 = REQUEST.get('URL1')
        RESPONSE.redirect(URL1 + '/portal_archives?portal_status_message=Archiving%20Started')
function_tokens: def manage_archive ( self , destination_archive_id , archive_id , source_connection_id = None , source_deferred_connection_id = None , update_destination_sql_catalog = None , update_archive_sql_catalog = None , clear_destination_sql_catalog = None , clear_archive_sql_catalog = None , REQUEST = None , RESPONSE = None ) : # First check parameter for destination catalog if destination_archive_id == archive_id : raise ValueError ( "Archive and destination archive can't be the same" ) portal_catalog = self . portal_catalog # Guess connection id from current catalog source_catalog = portal_catalog . getSQLCatalog ( ) source_catalog_id = source_catalog . getId ( ) source_connection_id = source_catalog . getConnectionId ( ) source_deferred_connection_id = source_catalog . getConnectionId ( deferred = True ) if source_connection_id is None or source_deferred_connection_id is None : raise ValueError ( "Unable to determine connection id for the current catalog" ) # Get destination property from archive destination_archive_id = destination_archive_id . split ( ' - ' ) [ 0 ] destination_archive = self . _getOb ( destination_archive_id ) destination_sql_catalog_id = destination_archive . getCatalogId ( ) destination_connection_id = destination_archive . getConnectionId ( ) destination_deferred_connection_id = destination_archive . getDeferredConnectionId ( ) # Get archive property from archive archive_id = archive_id . split ( ' - ' ) [ 0 ] archive = self . _getOb ( archive_id ) archive_sql_catalog_id = archive . getCatalogId ( ) archive_connection_id = archive . getConnectionId ( ) archive_deferred_connection_id = archive . getDeferredConnectionId ( ) # Check we don't use same connection id for source and destination if destination_sql_catalog_id == source_catalog_id : raise ValueError ( "Destination and source catalog can't be the same" ) if destination_connection_id == source_connection_id : raise ValueError ( "Destination and source connection can't be the same" ) if destination_deferred_connection_id == source_deferred_connection_id : raise ValueError ( "Destination and source deferred connection can't be the same" ) # Same for source and archive if archive_sql_catalog_id == source_catalog_id : raise ValueError ( "Archive and source catalog can't be the same" ) if archive_connection_id == source_connection_id : raise ValueError ( "Archive and source connection can't be the same" ) if archive_deferred_connection_id == source_deferred_connection_id : raise ValueError ( "Archive and source deferred connection can't be the same" ) # Same for destination and archive if archive_sql_catalog_id == destination_sql_catalog_id : raise ValueError ( "Archive and destination catalog can't be the same" ) if archive_connection_id == destination_connection_id : raise ValueError ( "Archive and destination connection can't be the same" ) if archive_deferred_connection_id == destination_deferred_connection_id : raise ValueError ( "Archive and destination deferred connection can't be the same" ) # Update connection id in destination and archive catalog if asked destination_sql_catalog = getattr ( portal_catalog , destination_sql_catalog_id ) if update_destination_sql_catalog : sql_connection_id_dict = { source_connection_id : destination_connection_id , source_deferred_connection_id : destination_deferred_connection_id } portal_catalog . changeSQLConnectionIds ( destination_sql_catalog , sql_connection_id_dict ) archive_sql_catalog = getattr ( portal_catalog , archive_sql_catalog_id ) if update_archive_sql_catalog : sql_connection_id_dict = { source_connection_id : archive_connection_id , source_deferred_connection_id : archive_deferred_connection_id } portal_catalog . changeSQLConnectionIds ( archive_sql_catalog , sql_connection_id_dict ) # Clear destination and archive catalog if asked if clear_destination_sql_catalog : portal_catalog . manage_catalogClear ( sql_catalog_id = destination_sql_catalog_id ) if clear_archive_sql_catalog : portal_catalog . manage_catalogClear ( sql_catalog_id = archive_sql_catalog_id ) # validate archive archive . validate ( ) destination_archive . validate ( ) # Call hot reindexing portal_catalog . manage_hotReindexAll ( source_sql_catalog_id = source_catalog_id , destination_sql_catalog_id = destination_sql_catalog_id , archive_path = archive . getPath ( ) , source_sql_connection_id_list = [ source_connection_id , source_deferred_connection_id ] , destination_sql_connection_id_list = [ destination_connection_id , destination_deferred_connection_id ] , REQUEST = REQUEST , RESPONSE = RESPONSE ) # Create inventory just before finish of hot reindexing inventory_date = archive . getStopDateRangeMax ( ) self . activate ( after_method_id = ( 'playBackRecordedObjectList' ) , priority = 5 ) . runInventoryMethod ( archive . id , source_connection_id , destination_sql_catalog_id , inventory_date ) self . activate ( after_method_id = ( 'runInventoryMethod' ) , after_tag = "runInventoryMethod" , priority = 5 ) . InventoryModule_reindexMovementList ( sql_catalog_id = destination_sql_catalog_id , final_activity_tag = "InventoryModule_reindexMovementList" ) if RESPONSE is not None : URL1 = REQUEST . get ( 'URL1' ) RESPONSE . redirect ( URL1 + '/portal_archives?portal_status_message=Archiving%20Started' )