<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> import copy <EOL> class DBPortSpec ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , name = None , type = None , spec = None ) : <EOL> self . __db_id = id <EOL> self . __db_name = name <EOL> self . __db_type = type <EOL> self . __db_spec = spec <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBPortSpec ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> cp . db_type = self . db_type <EOL> cp . db_spec = self . db_spec <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBPortSpec ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> cp . db_type = self . db_type <EOL> cp . db_spec = self . db_spec <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_type ( self ) : <EOL> return self . __db_type <EOL> def __set_db_type ( self , type ) : <EOL> self . __db_type = type <EOL> self . is_dirty = True <EOL> db_type = property ( __get_db_type , __set_db_type ) <EOL> def db_add_type ( self , type ) : <EOL> self . __db_type = type <EOL> def db_change_type ( self , type ) : <EOL> self . __db_type = type <EOL> def db_delete_type ( self , type ) : <EOL> self . __db_type = None <EOL> def __get_db_spec ( self ) : <EOL> return self . __db_spec <EOL> def __set_db_spec ( self , spec ) : <EOL> self . __db_spec = spec <EOL> self . is_dirty = True <EOL> db_spec = property ( __get_db_spec , __set_db_spec ) <EOL> def db_add_spec ( self , spec ) : <EOL> self . __db_spec = spec <EOL> def db_change_spec ( self , spec ) : <EOL> self . __db_spec = spec <EOL> def db_delete_spec ( self , spec ) : <EOL> self . __db_spec = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBModule ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , cache = None , abstraction = None , name = None , package = None , version = None , location = None , functions = None , annotations = None , portSpecs = None ) : <EOL> self . __db_id = id <EOL> self . __db_cache = cache <EOL> self . __db_abstraction = abstraction <EOL> self . __db_name = name <EOL> self . __db_package = package <EOL> self . __db_version = version <EOL> self . __db_location = location <EOL> self . db_functions_id_index = { } <EOL> if functions is None : <EOL> self . __db_functions = [ ] <EOL> else : <EOL> self . __db_functions = functions <EOL> for v in self . __db_functions : <EOL> self . db_functions_id_index [ v . db_id ] = v <EOL> self . db_annotations_id_index = { } <EOL> self . db_annotations_key_index = { } <EOL> if annotations is None : <EOL> self . __db_annotations = [ ] <EOL> else : <EOL> self . __db_annotations = annotations <EOL> for v in self . __db_annotations : <EOL> self . db_annotations_id_index [ v . db_id ] = v <EOL> self . db_annotations_key_index [ v . db_key ] = v <EOL> self . db_portSpecs_id_index = { } <EOL> self . db_portSpecs_name_index = { } <EOL> if portSpecs is None : <EOL> self . __db_portSpecs = [ ] <EOL> else : <EOL> self . __db_portSpecs = portSpecs <EOL> for v in self . __db_portSpecs : <EOL> self . db_portSpecs_id_index [ v . db_id ] = v <EOL> self . db_portSpecs_name_index [ v . db_name ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBModule ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_cache = self . db_cache <EOL> cp . db_abstraction = self . db_abstraction <EOL> cp . db_name = self . db_name <EOL> cp . db_package = self . db_package <EOL> cp . db_version = self . db_version <EOL> cp . db_location = self . db_location <EOL> if self . db_functions is None : <EOL> cp . db_functions = None <EOL> else : <EOL> cp . db_functions = [ copy . copy ( v ) for v in self . db_functions ] <EOL> for v in cp . __db_functions : <EOL> cp . db_functions_id_index [ v . db_id ] = v <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = None <EOL> else : <EOL> cp . db_annotations = [ copy . copy ( v ) for v in self . db_annotations ] <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> cp . db_annotations_key_index [ v . db_key ] = v <EOL> if self . db_portSpecs is None : <EOL> cp . db_portSpecs = None <EOL> else : <EOL> cp . db_portSpecs = [ copy . copy ( v ) for v in self . db_portSpecs ] <EOL> for v in cp . __db_portSpecs : <EOL> cp . db_portSpecs_id_index [ v . db_id ] = v <EOL> cp . db_portSpecs_name_index [ v . db_name ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBModule ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_cache = self . db_cache <EOL> cp . db_abstraction = self . db_abstraction <EOL> cp . db_name = self . db_name <EOL> cp . db_package = self . db_package <EOL> cp . db_version = self . db_version <EOL> if self . db_location is not None : <EOL> cp . db_location = self . db_location . do_copy ( new_ids , id_scope , id_remap ) <EOL> if self . db_functions is None : <EOL> cp . db_functions = [ ] <EOL> else : <EOL> cp . db_functions = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_functions ] <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = [ ] <EOL> else : <EOL> cp . db_annotations = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_annotations ] <EOL> if self . db_portSpecs is None : <EOL> cp . db_portSpecs = [ ] <EOL> else : <EOL> cp . db_portSpecs = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_portSpecs ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_functions : <EOL> cp . db_functions_id_index [ v . db_id ] = v <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> cp . db_annotations_key_index [ v . db_key ] = v <EOL> for v in cp . __db_portSpecs : <EOL> cp . db_portSpecs_id_index [ v . db_id ] = v <EOL> cp . db_portSpecs_name_index [ v . db_name ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> if self . db_location is not None : <EOL> children . extend ( self . db_location . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> self . db_location = None <EOL> to_del = [ ] <EOL> for child in self . db_functions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_function ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_annotation ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_portSpecs : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_portSpec ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> if self . db_location is not None and self . db_location . has_changes ( ) : <EOL> return True <EOL> for child in self . db_functions : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_annotations : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_portSpecs : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_cache ( self ) : <EOL> return self . __db_cache <EOL> def __set_db_cache ( self , cache ) : <EOL> self . __db_cache = cache <EOL> self . is_dirty = True <EOL> db_cache = property ( __get_db_cache , __set_db_cache ) <EOL> def db_add_cache ( self , cache ) : <EOL> self . __db_cache = cache <EOL> def db_change_cache ( self , cache ) : <EOL> self . __db_cache = cache <EOL> def db_delete_cache ( self , cache ) : <EOL> self . __db_cache = None <EOL> def __get_db_abstraction ( self ) : <EOL> return self . __db_abstraction <EOL> def __set_db_abstraction ( self , abstraction ) : <EOL> self . __db_abstraction = abstraction <EOL> self . is_dirty = True <EOL> db_abstraction = property ( __get_db_abstraction , __set_db_abstraction ) <EOL> def db_add_abstraction ( self , abstraction ) : <EOL> self . __db_abstraction = abstraction <EOL> def db_change_abstraction ( self , abstraction ) : <EOL> self . __db_abstraction = abstraction <EOL> def db_delete_abstraction ( self , abstraction ) : <EOL> self . __db_abstraction = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_package ( self ) : <EOL> return self . __db_package <EOL> def __set_db_package ( self , package ) : <EOL> self . __db_package = package <EOL> self . is_dirty = True <EOL> db_package = property ( __get_db_package , __set_db_package ) <EOL> def db_add_package ( self , package ) : <EOL> self . __db_package = package <EOL> def db_change_package ( self , package ) : <EOL> self . __db_package = package <EOL> def db_delete_package ( self , package ) : <EOL> self . __db_package = None <EOL> def __get_db_version ( self ) : <EOL> return self . __db_version <EOL> def __set_db_version ( self , version ) : <EOL> self . __db_version = version <EOL> self . is_dirty = True <EOL> db_version = property ( __get_db_version , __set_db_version ) <EOL> def db_add_version ( self , version ) : <EOL> self . __db_version = version <EOL> def db_change_version ( self , version ) : <EOL> self . __db_version = version <EOL> def db_delete_version ( self , version ) : <EOL> self . __db_version = None <EOL> def __get_db_location ( self ) : <EOL> return self . __db_location <EOL> def __set_db_location ( self , location ) : <EOL> self . __db_location = location <EOL> self . is_dirty = True <EOL> db_location = property ( __get_db_location , __set_db_location ) <EOL> def db_add_location ( self , location ) : <EOL> self . __db_location = location <EOL> def db_change_location ( self , location ) : <EOL> self . __db_location = location <EOL> def db_delete_location ( self , location ) : <EOL> self . __db_location = None <EOL> def __get_db_functions ( self ) : <EOL> return self . __db_functions <EOL> def __set_db_functions ( self , functions ) : <EOL> self . __db_functions = functions <EOL> self . is_dirty = True <EOL> db_functions = property ( __get_db_functions , __set_db_functions ) <EOL> def db_get_functions ( self ) : <EOL> return self . __db_functions <EOL> def db_add_function ( self , function ) : <EOL> self . is_dirty = True <EOL> self . __db_functions . append ( function ) <EOL> self . db_functions_id_index [ function . db_id ] = function <EOL> def db_change_function ( self , function ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_functions ) ) : <EOL> if self . __db_functions [ i ] . db_id == function . db_id : <EOL> self . __db_functions [ i ] = function <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_functions . append ( function ) <EOL> self . db_functions_id_index [ function . db_id ] = function <EOL> def db_delete_function ( self , function ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_functions ) ) : <EOL> if self . __db_functions [ i ] . db_id == function . db_id : <EOL> del self . __db_functions [ i ] <EOL> break <EOL> del self . db_functions_id_index [ function . db_id ] <EOL> def db_get_function ( self , key ) : <EOL> for i in xrange ( len ( self . __db_functions ) ) : <EOL> if self . __db_functions [ i ] . db_id == key : <EOL> return self . __db_functions [ i ] <EOL> return None <EOL> def db_get_function_by_id ( self , key ) : <EOL> return self . db_functions_id_index [ key ] <EOL> def db_has_function_with_id ( self , key ) : <EOL> return self . db_functions_id_index . has_key ( key ) <EOL> def __get_db_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def __set_db_annotations ( self , annotations ) : <EOL> self . __db_annotations = annotations <EOL> self . is_dirty = True <EOL> db_annotations = property ( __get_db_annotations , __set_db_annotations ) <EOL> def db_get_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def db_add_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> self . db_annotations_key_index [ annotation . db_key ] = annotation <EOL> def db_change_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> self . __db_annotations [ i ] = annotation <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> self . db_annotations_key_index [ annotation . db_key ] = annotation <EOL> def db_delete_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> del self . __db_annotations [ i ] <EOL> break <EOL> del self . db_annotations_id_index [ annotation . db_id ] <EOL> del self . db_annotations_key_index [ annotation . db_key ] <EOL> def db_get_annotation ( self , key ) : <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == key : <EOL> return self . __db_annotations [ i ] <EOL> return None <EOL> def db_get_annotation_by_id ( self , key ) : <EOL> return self . db_annotations_id_index [ key ] <EOL> def db_has_annotation_with_id ( self , key ) : <EOL> return self . db_annotations_id_index . has_key ( key ) <EOL> def db_get_annotation_by_key ( self , key ) : <EOL> return self . db_annotations_key_index [ key ] <EOL> def db_has_annotation_with_key ( self , key ) : <EOL> return self . db_annotations_key_index . has_key ( key ) <EOL> def __get_db_portSpecs ( self ) : <EOL> return self . __db_portSpecs <EOL> def __set_db_portSpecs ( self , portSpecs ) : <EOL> self . __db_portSpecs = portSpecs <EOL> self . is_dirty = True <EOL> db_portSpecs = property ( __get_db_portSpecs , __set_db_portSpecs ) <EOL> def db_get_portSpecs ( self ) : <EOL> return self . __db_portSpecs <EOL> def db_add_portSpec ( self , portSpec ) : <EOL> self . is_dirty = True <EOL> self . __db_portSpecs . append ( portSpec ) <EOL> self . db_portSpecs_id_index [ portSpec . db_id ] = portSpec <EOL> self . db_portSpecs_name_index [ portSpec . db_name ] = portSpec <EOL> def db_change_portSpec ( self , portSpec ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_portSpecs ) ) : <EOL> if self . __db_portSpecs [ i ] . db_id == portSpec . db_id : <EOL> self . __db_portSpecs [ i ] = portSpec <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_portSpecs . append ( portSpec ) <EOL> self . db_portSpecs_id_index [ portSpec . db_id ] = portSpec <EOL> self . db_portSpecs_name_index [ portSpec . db_name ] = portSpec <EOL> def db_delete_portSpec ( self , portSpec ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_portSpecs ) ) : <EOL> if self . __db_portSpecs [ i ] . db_id == portSpec . db_id : <EOL> del self . __db_portSpecs [ i ] <EOL> break <EOL> del self . db_portSpecs_id_index [ portSpec . db_id ] <EOL> del self . db_portSpecs_name_index [ portSpec . db_name ] <EOL> def db_get_portSpec ( self , key ) : <EOL> for i in xrange ( len ( self . __db_portSpecs ) ) : <EOL> if self . __db_portSpecs [ i ] . db_id == key : <EOL> return self . __db_portSpecs [ i ] <EOL> return None <EOL> def db_get_portSpec_by_id ( self , key ) : <EOL> return self . db_portSpecs_id_index [ key ] <EOL> def db_has_portSpec_with_id ( self , key ) : <EOL> return self . db_portSpecs_id_index . has_key ( key ) <EOL> def db_get_portSpec_by_name ( self , key ) : <EOL> return self . db_portSpecs_name_index [ key ] <EOL> def db_has_portSpec_with_name ( self , key ) : <EOL> return self . db_portSpecs_name_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBTag ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , name = None ) : <EOL> self . __db_id = id <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBTag ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBTag ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT:action>' , self . db_id ) ) : <EOL> cp . db_id = id_remap [ ( '<STR_LIT:action>' , self . db_id ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBPort ( object ) : <EOL> vtType = '<STR_LIT:port>' <EOL> def __init__ ( self , id = None , type = None , moduleId = None , moduleName = None , name = None , spec = None ) : <EOL> self . __db_id = id <EOL> self . __db_type = type <EOL> self . __db_moduleId = moduleId <EOL> self . __db_moduleName = moduleName <EOL> self . __db_name = name <EOL> self . __db_spec = spec <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBPort ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_type = self . db_type <EOL> cp . db_moduleId = self . db_moduleId <EOL> cp . db_moduleName = self . db_moduleName <EOL> cp . db_name = self . db_name <EOL> cp . db_spec = self . db_spec <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBPort ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_type = self . db_type <EOL> cp . db_moduleId = self . db_moduleId <EOL> cp . db_moduleName = self . db_moduleName <EOL> cp . db_name = self . db_name <EOL> cp . db_spec = self . db_spec <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_moduleId ) ) : <EOL> cp . db_moduleId = id_remap [ ( '<STR_LIT>' , self . db_moduleId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_type ( self ) : <EOL> return self . __db_type <EOL> def __set_db_type ( self , type ) : <EOL> self . __db_type = type <EOL> self . is_dirty = True <EOL> db_type = property ( __get_db_type , __set_db_type ) <EOL> def db_add_type ( self , type ) : <EOL> self . __db_type = type <EOL> def db_change_type ( self , type ) : <EOL> self . __db_type = type <EOL> def db_delete_type ( self , type ) : <EOL> self . __db_type = None <EOL> def __get_db_moduleId ( self ) : <EOL> return self . __db_moduleId <EOL> def __set_db_moduleId ( self , moduleId ) : <EOL> self . __db_moduleId = moduleId <EOL> self . is_dirty = True <EOL> db_moduleId = property ( __get_db_moduleId , __set_db_moduleId ) <EOL> def db_add_moduleId ( self , moduleId ) : <EOL> self . __db_moduleId = moduleId <EOL> def db_change_moduleId ( self , moduleId ) : <EOL> self . __db_moduleId = moduleId <EOL> def db_delete_moduleId ( self , moduleId ) : <EOL> self . __db_moduleId = None <EOL> def __get_db_moduleName ( self ) : <EOL> return self . __db_moduleName <EOL> def __set_db_moduleName ( self , moduleName ) : <EOL> self . __db_moduleName = moduleName <EOL> self . is_dirty = True <EOL> db_moduleName = property ( __get_db_moduleName , __set_db_moduleName ) <EOL> def db_add_moduleName ( self , moduleName ) : <EOL> self . __db_moduleName = moduleName <EOL> def db_change_moduleName ( self , moduleName ) : <EOL> self . __db_moduleName = moduleName <EOL> def db_delete_moduleName ( self , moduleName ) : <EOL> self . __db_moduleName = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_spec ( self ) : <EOL> return self . __db_spec <EOL> def __set_db_spec ( self , spec ) : <EOL> self . __db_spec = spec <EOL> self . is_dirty = True <EOL> db_spec = property ( __get_db_spec , __set_db_spec ) <EOL> def db_add_spec ( self , spec ) : <EOL> self . __db_spec = spec <EOL> def db_change_spec ( self , spec ) : <EOL> self . __db_spec = spec <EOL> def db_delete_spec ( self , spec ) : <EOL> self . __db_spec = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBLog ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , workflow_execs = None , machines = None ) : <EOL> self . __db_id = id <EOL> self . db_workflow_execs_id_index = { } <EOL> if workflow_execs is None : <EOL> self . __db_workflow_execs = [ ] <EOL> else : <EOL> self . __db_workflow_execs = workflow_execs <EOL> for v in self . __db_workflow_execs : <EOL> self . db_workflow_execs_id_index [ v . db_id ] = v <EOL> self . db_machines_id_index = { } <EOL> if machines is None : <EOL> self . __db_machines = [ ] <EOL> else : <EOL> self . __db_machines = machines <EOL> for v in self . __db_machines : <EOL> self . db_machines_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBLog ( ) <EOL> cp . db_id = self . db_id <EOL> if self . db_workflow_execs is None : <EOL> cp . db_workflow_execs = None <EOL> else : <EOL> cp . db_workflow_execs = [ copy . copy ( v ) for v in self . db_workflow_execs ] <EOL> for v in cp . __db_workflow_execs : <EOL> cp . db_workflow_execs_id_index [ v . db_id ] = v <EOL> if self . db_machines is None : <EOL> cp . db_machines = None <EOL> else : <EOL> cp . db_machines = [ copy . copy ( v ) for v in self . db_machines ] <EOL> for v in cp . __db_machines : <EOL> cp . db_machines_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBLog ( ) <EOL> cp . db_id = self . db_id <EOL> if self . db_workflow_execs is None : <EOL> cp . db_workflow_execs = [ ] <EOL> else : <EOL> cp . db_workflow_execs = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_workflow_execs ] <EOL> if self . db_machines is None : <EOL> cp . db_machines = [ ] <EOL> else : <EOL> cp . db_machines = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_machines ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_workflow_execs : <EOL> cp . db_workflow_execs_id_index [ v . db_id ] = v <EOL> for v in cp . __db_machines : <EOL> cp . db_machines_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_workflow_execs : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_workflow_exec ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_machines : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_machine ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_workflow_execs : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_machines : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_workflow_execs ( self ) : <EOL> return self . __db_workflow_execs <EOL> def __set_db_workflow_execs ( self , workflow_execs ) : <EOL> self . __db_workflow_execs = workflow_execs <EOL> self . is_dirty = True <EOL> db_workflow_execs = property ( __get_db_workflow_execs , __set_db_workflow_execs ) <EOL> def db_get_workflow_execs ( self ) : <EOL> return self . __db_workflow_execs <EOL> def db_add_workflow_exec ( self , workflow_exec ) : <EOL> self . is_dirty = True <EOL> self . __db_workflow_execs . append ( workflow_exec ) <EOL> self . db_workflow_execs_id_index [ workflow_exec . db_id ] = workflow_exec <EOL> def db_change_workflow_exec ( self , workflow_exec ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_workflow_execs ) ) : <EOL> if self . __db_workflow_execs [ i ] . db_id == workflow_exec . db_id : <EOL> self . __db_workflow_execs [ i ] = workflow_exec <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_workflow_execs . append ( workflow_exec ) <EOL> self . db_workflow_execs_id_index [ workflow_exec . db_id ] = workflow_exec <EOL> def db_delete_workflow_exec ( self , workflow_exec ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_workflow_execs ) ) : <EOL> if self . __db_workflow_execs [ i ] . db_id == workflow_exec . db_id : <EOL> del self . __db_workflow_execs [ i ] <EOL> break <EOL> del self . db_workflow_execs_id_index [ workflow_exec . db_id ] <EOL> def db_get_workflow_exec ( self , key ) : <EOL> for i in xrange ( len ( self . __db_workflow_execs ) ) : <EOL> if self . __db_workflow_execs [ i ] . db_id == key : <EOL> return self . __db_workflow_execs [ i ] <EOL> return None <EOL> def db_get_workflow_exec_by_id ( self , key ) : <EOL> return self . db_workflow_execs_id_index [ key ] <EOL> def db_has_workflow_exec_with_id ( self , key ) : <EOL> return self . db_workflow_execs_id_index . has_key ( key ) <EOL> def __get_db_machines ( self ) : <EOL> return self . __db_machines <EOL> def __set_db_machines ( self , machines ) : <EOL> self . __db_machines = machines <EOL> self . is_dirty = True <EOL> db_machines = property ( __get_db_machines , __set_db_machines ) <EOL> def db_get_machines ( self ) : <EOL> return self . __db_machines <EOL> def db_add_machine ( self , machine ) : <EOL> self . is_dirty = True <EOL> self . __db_machines . append ( machine ) <EOL> self . db_machines_id_index [ machine . db_id ] = machine <EOL> def db_change_machine ( self , machine ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_machines ) ) : <EOL> if self . __db_machines [ i ] . db_id == machine . db_id : <EOL> self . __db_machines [ i ] = machine <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_machines . append ( machine ) <EOL> self . db_machines_id_index [ machine . db_id ] = machine <EOL> def db_delete_machine ( self , machine ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_machines ) ) : <EOL> if self . __db_machines [ i ] . db_id == machine . db_id : <EOL> del self . __db_machines [ i ] <EOL> break <EOL> del self . db_machines_id_index [ machine . db_id ] <EOL> def db_get_machine ( self , key ) : <EOL> for i in xrange ( len ( self . __db_machines ) ) : <EOL> if self . __db_machines [ i ] . db_id == key : <EOL> return self . __db_machines [ i ] <EOL> return None <EOL> def db_get_machine_by_id ( self , key ) : <EOL> return self . db_machines_id_index [ key ] <EOL> def db_has_machine_with_id ( self , key ) : <EOL> return self . db_machines_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBMachine ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , name = None , os = None , architecture = None , processor = None , ram = None , module_execs = None ) : <EOL> self . __db_id = id <EOL> self . __db_name = name <EOL> self . __db_os = os <EOL> self . __db_architecture = architecture <EOL> self . __db_processor = processor <EOL> self . __db_ram = ram <EOL> self . db_module_execs_id_index = { } <EOL> if module_execs is None : <EOL> self . __db_module_execs = [ ] <EOL> else : <EOL> self . __db_module_execs = module_execs <EOL> for v in self . __db_module_execs : <EOL> self . db_module_execs_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBMachine ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> cp . db_os = self . db_os <EOL> cp . db_architecture = self . db_architecture <EOL> cp . db_processor = self . db_processor <EOL> cp . db_ram = self . db_ram <EOL> if self . db_module_execs is None : <EOL> cp . db_module_execs = None <EOL> else : <EOL> cp . db_module_execs = [ copy . copy ( v ) for v in self . db_module_execs ] <EOL> for v in cp . __db_module_execs : <EOL> cp . db_module_execs_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBMachine ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> cp . db_os = self . db_os <EOL> cp . db_architecture = self . db_architecture <EOL> cp . db_processor = self . db_processor <EOL> cp . db_ram = self . db_ram <EOL> if self . db_module_execs is None : <EOL> cp . db_module_execs = [ ] <EOL> else : <EOL> cp . db_module_execs = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_module_execs ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_module_execs : <EOL> cp . db_module_execs_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_module_execs : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_module_exec ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_module_execs : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_os ( self ) : <EOL> return self . __db_os <EOL> def __set_db_os ( self , os ) : <EOL> self . __db_os = os <EOL> self . is_dirty = True <EOL> db_os = property ( __get_db_os , __set_db_os ) <EOL> def db_add_os ( self , os ) : <EOL> self . __db_os = os <EOL> def db_change_os ( self , os ) : <EOL> self . __db_os = os <EOL> def db_delete_os ( self , os ) : <EOL> self . __db_os = None <EOL> def __get_db_architecture ( self ) : <EOL> return self . __db_architecture <EOL> def __set_db_architecture ( self , architecture ) : <EOL> self . __db_architecture = architecture <EOL> self . is_dirty = True <EOL> db_architecture = property ( __get_db_architecture , __set_db_architecture ) <EOL> def db_add_architecture ( self , architecture ) : <EOL> self . __db_architecture = architecture <EOL> def db_change_architecture ( self , architecture ) : <EOL> self . __db_architecture = architecture <EOL> def db_delete_architecture ( self , architecture ) : <EOL> self . __db_architecture = None <EOL> def __get_db_processor ( self ) : <EOL> return self . __db_processor <EOL> def __set_db_processor ( self , processor ) : <EOL> self . __db_processor = processor <EOL> self . is_dirty = True <EOL> db_processor = property ( __get_db_processor , __set_db_processor ) <EOL> def db_add_processor ( self , processor ) : <EOL> self . __db_processor = processor <EOL> def db_change_processor ( self , processor ) : <EOL> self . __db_processor = processor <EOL> def db_delete_processor ( self , processor ) : <EOL> self . __db_processor = None <EOL> def __get_db_ram ( self ) : <EOL> return self . __db_ram <EOL> def __set_db_ram ( self , ram ) : <EOL> self . __db_ram = ram <EOL> self . is_dirty = True <EOL> db_ram = property ( __get_db_ram , __set_db_ram ) <EOL> def db_add_ram ( self , ram ) : <EOL> self . __db_ram = ram <EOL> def db_change_ram ( self , ram ) : <EOL> self . __db_ram = ram <EOL> def db_delete_ram ( self , ram ) : <EOL> self . __db_ram = None <EOL> def __get_db_module_execs ( self ) : <EOL> return self . __db_module_execs <EOL> def __set_db_module_execs ( self , module_execs ) : <EOL> self . __db_module_execs = module_execs <EOL> self . is_dirty = True <EOL> db_module_execs = property ( __get_db_module_execs , __set_db_module_execs ) <EOL> def db_get_module_execs ( self ) : <EOL> return self . __db_module_execs <EOL> def db_add_module_exec ( self , module_exec ) : <EOL> self . is_dirty = True <EOL> self . __db_module_execs . append ( module_exec ) <EOL> self . db_module_execs_id_index [ module_exec . db_id ] = module_exec <EOL> def db_change_module_exec ( self , module_exec ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_module_execs ) ) : <EOL> if self . __db_module_execs [ i ] . db_id == module_exec . db_id : <EOL> self . __db_module_execs [ i ] = module_exec <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_module_execs . append ( module_exec ) <EOL> self . db_module_execs_id_index [ module_exec . db_id ] = module_exec <EOL> def db_delete_module_exec ( self , module_exec ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_module_execs ) ) : <EOL> if self . __db_module_execs [ i ] . db_id == module_exec . db_id : <EOL> del self . __db_module_execs [ i ] <EOL> break <EOL> del self . db_module_execs_id_index [ module_exec . db_id ] <EOL> def db_get_module_exec ( self , key ) : <EOL> for i in xrange ( len ( self . __db_module_execs ) ) : <EOL> if self . __db_module_execs [ i ] . db_id == key : <EOL> return self . __db_module_execs [ i ] <EOL> return None <EOL> def db_get_module_exec_by_id ( self , key ) : <EOL> return self . db_module_execs_id_index [ key ] <EOL> def db_has_module_exec_with_id ( self , key ) : <EOL> return self . db_module_execs_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBAdd ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , what = None , objectId = None , parentObjId = None , parentObjType = None , data = None ) : <EOL> self . __db_id = id <EOL> self . __db_what = what <EOL> self . __db_objectId = objectId <EOL> self . __db_parentObjId = parentObjId <EOL> self . __db_parentObjType = parentObjType <EOL> self . __db_data = data <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBAdd ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_what = self . db_what <EOL> cp . db_objectId = self . db_objectId <EOL> cp . db_parentObjId = self . db_parentObjId <EOL> cp . db_parentObjType = self . db_parentObjType <EOL> cp . db_data = self . db_data <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAdd ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_what = self . db_what <EOL> cp . db_objectId = self . db_objectId <EOL> cp . db_parentObjId = self . db_parentObjId <EOL> cp . db_parentObjType = self . db_parentObjType <EOL> if self . db_data is not None : <EOL> cp . db_data = self . db_data . do_copy ( new_ids , id_scope , id_remap ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_what , self . db_objectId ) ) : <EOL> cp . db_objectId = id_remap [ ( self . db_what , self . db_objectId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_parentObjType , self . db_parentObjId ) ) : <EOL> cp . db_parentObjId = id_remap [ ( self . db_parentObjType , self . db_parentObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> if self . db_data is not None : <EOL> children . extend ( self . db_data . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> self . db_data = None <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> if self . db_data is not None and self . db_data . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_what ( self ) : <EOL> return self . __db_what <EOL> def __set_db_what ( self , what ) : <EOL> self . __db_what = what <EOL> self . is_dirty = True <EOL> db_what = property ( __get_db_what , __set_db_what ) <EOL> def db_add_what ( self , what ) : <EOL> self . __db_what = what <EOL> def db_change_what ( self , what ) : <EOL> self . __db_what = what <EOL> def db_delete_what ( self , what ) : <EOL> self . __db_what = None <EOL> def __get_db_objectId ( self ) : <EOL> return self . __db_objectId <EOL> def __set_db_objectId ( self , objectId ) : <EOL> self . __db_objectId = objectId <EOL> self . is_dirty = True <EOL> db_objectId = property ( __get_db_objectId , __set_db_objectId ) <EOL> def db_add_objectId ( self , objectId ) : <EOL> self . __db_objectId = objectId <EOL> def db_change_objectId ( self , objectId ) : <EOL> self . __db_objectId = objectId <EOL> def db_delete_objectId ( self , objectId ) : <EOL> self . __db_objectId = None <EOL> def __get_db_parentObjId ( self ) : <EOL> return self . __db_parentObjId <EOL> def __set_db_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> self . is_dirty = True <EOL> db_parentObjId = property ( __get_db_parentObjId , __set_db_parentObjId ) <EOL> def db_add_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> def db_change_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> def db_delete_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = None <EOL> def __get_db_parentObjType ( self ) : <EOL> return self . __db_parentObjType <EOL> def __set_db_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> self . is_dirty = True <EOL> db_parentObjType = property ( __get_db_parentObjType , __set_db_parentObjType ) <EOL> def db_add_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> def db_change_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> def db_delete_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = None <EOL> def __get_db_data ( self ) : <EOL> return self . __db_data <EOL> def __set_db_data ( self , data ) : <EOL> self . __db_data = data <EOL> self . is_dirty = True <EOL> db_data = property ( __get_db_data , __set_db_data ) <EOL> def db_add_data ( self , data ) : <EOL> self . __db_data = data <EOL> def db_change_data ( self , data ) : <EOL> self . __db_data = data <EOL> def db_delete_data ( self , data ) : <EOL> self . __db_data = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBOther ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , key = None , value = None ) : <EOL> self . __db_id = id <EOL> self . __db_key = key <EOL> self . __db_value = value <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBOther ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_key = self . db_key <EOL> cp . db_value = self . db_value <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBOther ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_key = self . db_key <EOL> cp . db_value = self . db_value <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_key ( self ) : <EOL> return self . __db_key <EOL> def __set_db_key ( self , key ) : <EOL> self . __db_key = key <EOL> self . is_dirty = True <EOL> db_key = property ( __get_db_key , __set_db_key ) <EOL> def db_add_key ( self , key ) : <EOL> self . __db_key = key <EOL> def db_change_key ( self , key ) : <EOL> self . __db_key = key <EOL> def db_delete_key ( self , key ) : <EOL> self . __db_key = None <EOL> def __get_db_value ( self ) : <EOL> return self . __db_value <EOL> def __set_db_value ( self , value ) : <EOL> self . __db_value = value <EOL> self . is_dirty = True <EOL> db_value = property ( __get_db_value , __set_db_value ) <EOL> def db_add_value ( self , value ) : <EOL> self . __db_value = value <EOL> def db_change_value ( self , value ) : <EOL> self . __db_value = value <EOL> def db_delete_value ( self , value ) : <EOL> self . __db_value = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBLocation ( object ) : <EOL> vtType = '<STR_LIT:location>' <EOL> def __init__ ( self , id = None , x = None , y = None ) : <EOL> self . __db_id = id <EOL> self . __db_x = x <EOL> self . __db_y = y <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBLocation ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_x = self . db_x <EOL> cp . db_y = self . db_y <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBLocation ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_x = self . db_x <EOL> cp . db_y = self . db_y <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_x ( self ) : <EOL> return self . __db_x <EOL> def __set_db_x ( self , x ) : <EOL> self . __db_x = x <EOL> self . is_dirty = True <EOL> db_x = property ( __get_db_x , __set_db_x ) <EOL> def db_add_x ( self , x ) : <EOL> self . __db_x = x <EOL> def db_change_x ( self , x ) : <EOL> self . __db_x = x <EOL> def db_delete_x ( self , x ) : <EOL> self . __db_x = None <EOL> def __get_db_y ( self ) : <EOL> return self . __db_y <EOL> def __set_db_y ( self , y ) : <EOL> self . __db_y = y <EOL> self . is_dirty = True <EOL> db_y = property ( __get_db_y , __set_db_y ) <EOL> def db_add_y ( self , y ) : <EOL> self . __db_y = y <EOL> def db_change_y ( self , y ) : <EOL> self . __db_y = y <EOL> def db_delete_y ( self , y ) : <EOL> self . __db_y = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBWorkflowExec ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , user = None , ip = None , vt_version = None , ts_start = None , ts_end = None , parent_id = None , parent_type = None , parent_version = None , name = None , module_execs = None ) : <EOL> self . __db_id = id <EOL> self . __db_user = user <EOL> self . __db_ip = ip <EOL> self . __db_vt_version = vt_version <EOL> self . __db_ts_start = ts_start <EOL> self . __db_ts_end = ts_end <EOL> self . __db_parent_id = parent_id <EOL> self . __db_parent_type = parent_type <EOL> self . __db_parent_version = parent_version <EOL> self . __db_name = name <EOL> self . db_module_execs_id_index = { } <EOL> if module_execs is None : <EOL> self . __db_module_execs = [ ] <EOL> else : <EOL> self . __db_module_execs = module_execs <EOL> for v in self . __db_module_execs : <EOL> self . db_module_execs_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBWorkflowExec ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_user = self . db_user <EOL> cp . db_ip = self . db_ip <EOL> cp . db_vt_version = self . db_vt_version <EOL> cp . db_ts_start = self . db_ts_start <EOL> cp . db_ts_end = self . db_ts_end <EOL> cp . db_parent_id = self . db_parent_id <EOL> cp . db_parent_type = self . db_parent_type <EOL> cp . db_parent_version = self . db_parent_version <EOL> cp . db_name = self . db_name <EOL> if self . db_module_execs is None : <EOL> cp . db_module_execs = None <EOL> else : <EOL> cp . db_module_execs = [ copy . copy ( v ) for v in self . db_module_execs ] <EOL> for v in cp . __db_module_execs : <EOL> cp . db_module_execs_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBWorkflowExec ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_user = self . db_user <EOL> cp . db_ip = self . db_ip <EOL> cp . db_vt_version = self . db_vt_version <EOL> cp . db_ts_start = self . db_ts_start <EOL> cp . db_ts_end = self . db_ts_end <EOL> cp . db_parent_id = self . db_parent_id <EOL> cp . db_parent_type = self . db_parent_type <EOL> cp . db_parent_version = self . db_parent_version <EOL> cp . db_name = self . db_name <EOL> if self . db_module_execs is None : <EOL> cp . db_module_execs = [ ] <EOL> else : <EOL> cp . db_module_execs = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_module_execs ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_module_execs : <EOL> cp . db_module_execs_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_module_execs : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_module_exec ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_module_execs : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_user ( self ) : <EOL> return self . __db_user <EOL> def __set_db_user ( self , user ) : <EOL> self . __db_user = user <EOL> self . is_dirty = True <EOL> db_user = property ( __get_db_user , __set_db_user ) <EOL> def db_add_user ( self , user ) : <EOL> self . __db_user = user <EOL> def db_change_user ( self , user ) : <EOL> self . __db_user = user <EOL> def db_delete_user ( self , user ) : <EOL> self . __db_user = None <EOL> def __get_db_ip ( self ) : <EOL> return self . __db_ip <EOL> def __set_db_ip ( self , ip ) : <EOL> self . __db_ip = ip <EOL> self . is_dirty = True <EOL> db_ip = property ( __get_db_ip , __set_db_ip ) <EOL> def db_add_ip ( self , ip ) : <EOL> self . __db_ip = ip <EOL> def db_change_ip ( self , ip ) : <EOL> self . __db_ip = ip <EOL> def db_delete_ip ( self , ip ) : <EOL> self . __db_ip = None <EOL> def __get_db_vt_version ( self ) : <EOL> return self . __db_vt_version <EOL> def __set_db_vt_version ( self , vt_version ) : <EOL> self . __db_vt_version = vt_version <EOL> self . is_dirty = True <EOL> db_vt_version = property ( __get_db_vt_version , __set_db_vt_version ) <EOL> def db_add_vt_version ( self , vt_version ) : <EOL> self . __db_vt_version = vt_version <EOL> def db_change_vt_version ( self , vt_version ) : <EOL> self . __db_vt_version = vt_version <EOL> def db_delete_vt_version ( self , vt_version ) : <EOL> self . __db_vt_version = None <EOL> def __get_db_ts_start ( self ) : <EOL> return self . __db_ts_start <EOL> def __set_db_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = ts_start <EOL> self . is_dirty = True <EOL> db_ts_start = property ( __get_db_ts_start , __set_db_ts_start ) <EOL> def db_add_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = ts_start <EOL> def db_change_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = ts_start <EOL> def db_delete_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = None <EOL> def __get_db_ts_end ( self ) : <EOL> return self . __db_ts_end <EOL> def __set_db_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = ts_end <EOL> self . is_dirty = True <EOL> db_ts_end = property ( __get_db_ts_end , __set_db_ts_end ) <EOL> def db_add_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = ts_end <EOL> def db_change_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = ts_end <EOL> def db_delete_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = None <EOL> def __get_db_parent_id ( self ) : <EOL> return self . __db_parent_id <EOL> def __set_db_parent_id ( self , parent_id ) : <EOL> self . __db_parent_id = parent_id <EOL> self . is_dirty = True <EOL> db_parent_id = property ( __get_db_parent_id , __set_db_parent_id ) <EOL> def db_add_parent_id ( self , parent_id ) : <EOL> self . __db_parent_id = parent_id <EOL> def db_change_parent_id ( self , parent_id ) : <EOL> self . __db_parent_id = parent_id <EOL> def db_delete_parent_id ( self , parent_id ) : <EOL> self . __db_parent_id = None <EOL> def __get_db_parent_type ( self ) : <EOL> return self . __db_parent_type <EOL> def __set_db_parent_type ( self , parent_type ) : <EOL> self . __db_parent_type = parent_type <EOL> self . is_dirty = True <EOL> db_parent_type = property ( __get_db_parent_type , __set_db_parent_type ) <EOL> def db_add_parent_type ( self , parent_type ) : <EOL> self . __db_parent_type = parent_type <EOL> def db_change_parent_type ( self , parent_type ) : <EOL> self . __db_parent_type = parent_type <EOL> def db_delete_parent_type ( self , parent_type ) : <EOL> self . __db_parent_type = None <EOL> def __get_db_parent_version ( self ) : <EOL> return self . __db_parent_version <EOL> def __set_db_parent_version ( self , parent_version ) : <EOL> self . __db_parent_version = parent_version <EOL> self . is_dirty = True <EOL> db_parent_version = property ( __get_db_parent_version , __set_db_parent_version ) <EOL> def db_add_parent_version ( self , parent_version ) : <EOL> self . __db_parent_version = parent_version <EOL> def db_change_parent_version ( self , parent_version ) : <EOL> self . __db_parent_version = parent_version <EOL> def db_delete_parent_version ( self , parent_version ) : <EOL> self . __db_parent_version = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_module_execs ( self ) : <EOL> return self . __db_module_execs <EOL> def __set_db_module_execs ( self , module_execs ) : <EOL> self . __db_module_execs = module_execs <EOL> self . is_dirty = True <EOL> db_module_execs = property ( __get_db_module_execs , __set_db_module_execs ) <EOL> def db_get_module_execs ( self ) : <EOL> return self . __db_module_execs <EOL> def db_add_module_exec ( self , module_exec ) : <EOL> self . is_dirty = True <EOL> self . __db_module_execs . append ( module_exec ) <EOL> self . db_module_execs_id_index [ module_exec . db_id ] = module_exec <EOL> def db_change_module_exec ( self , module_exec ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_module_execs ) ) : <EOL> if self . __db_module_execs [ i ] . db_id == module_exec . db_id : <EOL> self . __db_module_execs [ i ] = module_exec <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_module_execs . append ( module_exec ) <EOL> self . db_module_execs_id_index [ module_exec . db_id ] = module_exec <EOL> def db_delete_module_exec ( self , module_exec ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_module_execs ) ) : <EOL> if self . __db_module_execs [ i ] . db_id == module_exec . db_id : <EOL> del self . __db_module_execs [ i ] <EOL> break <EOL> del self . db_module_execs_id_index [ module_exec . db_id ] <EOL> def db_get_module_exec ( self , key ) : <EOL> for i in xrange ( len ( self . __db_module_execs ) ) : <EOL> if self . __db_module_execs [ i ] . db_id == key : <EOL> return self . __db_module_execs [ i ] <EOL> return None <EOL> def db_get_module_exec_by_id ( self , key ) : <EOL> return self . db_module_execs_id_index [ key ] <EOL> def db_has_module_exec_with_id ( self , key ) : <EOL> return self . db_module_execs_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBFunction ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , pos = None , name = None , parameters = None ) : <EOL> self . __db_id = id <EOL> self . __db_pos = pos <EOL> self . __db_name = name <EOL> self . db_parameters_id_index = { } <EOL> if parameters is None : <EOL> self . __db_parameters = [ ] <EOL> else : <EOL> self . __db_parameters = parameters <EOL> for v in self . __db_parameters : <EOL> self . db_parameters_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBFunction ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_pos = self . db_pos <EOL> cp . db_name = self . db_name <EOL> if self . db_parameters is None : <EOL> cp . db_parameters = None <EOL> else : <EOL> cp . db_parameters = [ copy . copy ( v ) for v in self . db_parameters ] <EOL> for v in cp . __db_parameters : <EOL> cp . db_parameters_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBFunction ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_pos = self . db_pos <EOL> cp . db_name = self . db_name <EOL> if self . db_parameters is None : <EOL> cp . db_parameters = [ ] <EOL> else : <EOL> cp . db_parameters = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_parameters ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_parameters : <EOL> cp . db_parameters_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_parameters : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_parameter ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_parameters : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_pos ( self ) : <EOL> return self . __db_pos <EOL> def __set_db_pos ( self , pos ) : <EOL> self . __db_pos = pos <EOL> self . is_dirty = True <EOL> db_pos = property ( __get_db_pos , __set_db_pos ) <EOL> def db_add_pos ( self , pos ) : <EOL> self . __db_pos = pos <EOL> def db_change_pos ( self , pos ) : <EOL> self . __db_pos = pos <EOL> def db_delete_pos ( self , pos ) : <EOL> self . __db_pos = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_parameters ( self ) : <EOL> return self . __db_parameters <EOL> def __set_db_parameters ( self , parameters ) : <EOL> self . __db_parameters = parameters <EOL> self . is_dirty = True <EOL> db_parameters = property ( __get_db_parameters , __set_db_parameters ) <EOL> def db_get_parameters ( self ) : <EOL> return self . __db_parameters <EOL> def db_add_parameter ( self , parameter ) : <EOL> self . is_dirty = True <EOL> self . __db_parameters . append ( parameter ) <EOL> self . db_parameters_id_index [ parameter . db_id ] = parameter <EOL> def db_change_parameter ( self , parameter ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_parameters ) ) : <EOL> if self . __db_parameters [ i ] . db_id == parameter . db_id : <EOL> self . __db_parameters [ i ] = parameter <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_parameters . append ( parameter ) <EOL> self . db_parameters_id_index [ parameter . db_id ] = parameter <EOL> def db_delete_parameter ( self , parameter ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_parameters ) ) : <EOL> if self . __db_parameters [ i ] . db_id == parameter . db_id : <EOL> del self . __db_parameters [ i ] <EOL> break <EOL> del self . db_parameters_id_index [ parameter . db_id ] <EOL> def db_get_parameter ( self , key ) : <EOL> for i in xrange ( len ( self . __db_parameters ) ) : <EOL> if self . __db_parameters [ i ] . db_id == key : <EOL> return self . __db_parameters [ i ] <EOL> return None <EOL> def db_get_parameter_by_id ( self , key ) : <EOL> return self . db_parameters_id_index [ key ] <EOL> def db_has_parameter_with_id ( self , key ) : <EOL> return self . db_parameters_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBAbstraction ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , name = None , actions = None , tags = None ) : <EOL> self . __db_id = id <EOL> self . __db_name = name <EOL> self . db_actions_id_index = { } <EOL> if actions is None : <EOL> self . __db_actions = [ ] <EOL> else : <EOL> self . __db_actions = actions <EOL> for v in self . __db_actions : <EOL> self . db_actions_id_index [ v . db_id ] = v <EOL> self . db_tags_id_index = { } <EOL> self . db_tags_name_index = { } <EOL> if tags is None : <EOL> self . __db_tags = [ ] <EOL> else : <EOL> self . __db_tags = tags <EOL> for v in self . __db_tags : <EOL> self . db_tags_id_index [ v . db_id ] = v <EOL> self . db_tags_name_index [ v . db_name ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBAbstraction ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> if self . db_actions is None : <EOL> cp . db_actions = None <EOL> else : <EOL> cp . db_actions = [ copy . copy ( v ) for v in self . db_actions ] <EOL> for v in cp . __db_actions : <EOL> cp . db_actions_id_index [ v . db_id ] = v <EOL> if self . db_tags is None : <EOL> cp . db_tags = None <EOL> else : <EOL> cp . db_tags = [ copy . copy ( v ) for v in self . db_tags ] <EOL> for v in cp . __db_tags : <EOL> cp . db_tags_id_index [ v . db_id ] = v <EOL> cp . db_tags_name_index [ v . db_name ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAbstraction ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> if self . db_actions is None : <EOL> cp . db_actions = [ ] <EOL> else : <EOL> cp . db_actions = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_actions ] <EOL> if self . db_tags is None : <EOL> cp . db_tags = [ ] <EOL> else : <EOL> cp . db_tags = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_tags ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> for v in cp . __db_actions : <EOL> cp . db_actions_id_index [ v . db_id ] = v <EOL> for v in cp . __db_tags : <EOL> cp . db_tags_id_index [ v . db_id ] = v <EOL> cp . db_tags_name_index [ v . db_name ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_actions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_action ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_tags : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_tag ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_actions : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_tags : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_actions ( self ) : <EOL> return self . __db_actions <EOL> def __set_db_actions ( self , actions ) : <EOL> self . __db_actions = actions <EOL> self . is_dirty = True <EOL> db_actions = property ( __get_db_actions , __set_db_actions ) <EOL> def db_get_actions ( self ) : <EOL> return self . __db_actions <EOL> def db_add_action ( self , action ) : <EOL> self . is_dirty = True <EOL> self . __db_actions . append ( action ) <EOL> self . db_actions_id_index [ action . db_id ] = action <EOL> def db_change_action ( self , action ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_actions ) ) : <EOL> if self . __db_actions [ i ] . db_id == action . db_id : <EOL> self . __db_actions [ i ] = action <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_actions . append ( action ) <EOL> self . db_actions_id_index [ action . db_id ] = action <EOL> def db_delete_action ( self , action ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_actions ) ) : <EOL> if self . __db_actions [ i ] . db_id == action . db_id : <EOL> del self . __db_actions [ i ] <EOL> break <EOL> del self . db_actions_id_index [ action . db_id ] <EOL> def db_get_action ( self , key ) : <EOL> for i in xrange ( len ( self . __db_actions ) ) : <EOL> if self . __db_actions [ i ] . db_id == key : <EOL> return self . __db_actions [ i ] <EOL> return None <EOL> def db_get_action_by_id ( self , key ) : <EOL> return self . db_actions_id_index [ key ] <EOL> def db_has_action_with_id ( self , key ) : <EOL> return self . db_actions_id_index . has_key ( key ) <EOL> def __get_db_tags ( self ) : <EOL> return self . __db_tags <EOL> def __set_db_tags ( self , tags ) : <EOL> self . __db_tags = tags <EOL> self . is_dirty = True <EOL> db_tags = property ( __get_db_tags , __set_db_tags ) <EOL> def db_get_tags ( self ) : <EOL> return self . __db_tags <EOL> def db_add_tag ( self , tag ) : <EOL> self . is_dirty = True <EOL> self . __db_tags . append ( tag ) <EOL> self . db_tags_id_index [ tag . db_id ] = tag <EOL> self . db_tags_name_index [ tag . db_name ] = tag <EOL> def db_change_tag ( self , tag ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_tags ) ) : <EOL> if self . __db_tags [ i ] . db_id == tag . db_id : <EOL> self . __db_tags [ i ] = tag <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_tags . append ( tag ) <EOL> self . db_tags_id_index [ tag . db_id ] = tag <EOL> self . db_tags_name_index [ tag . db_name ] = tag <EOL> def db_delete_tag ( self , tag ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_tags ) ) : <EOL> if self . __db_tags [ i ] . db_id == tag . db_id : <EOL> del self . __db_tags [ i ] <EOL> break <EOL> del self . db_tags_id_index [ tag . db_id ] <EOL> del self . db_tags_name_index [ tag . db_name ] <EOL> def db_get_tag ( self , key ) : <EOL> for i in xrange ( len ( self . __db_tags ) ) : <EOL> if self . __db_tags [ i ] . db_id == key : <EOL> return self . __db_tags [ i ] <EOL> return None <EOL> def db_get_tag_by_id ( self , key ) : <EOL> return self . db_tags_id_index [ key ] <EOL> def db_has_tag_with_id ( self , key ) : <EOL> return self . db_tags_id_index . has_key ( key ) <EOL> def db_get_tag_by_name ( self , key ) : <EOL> return self . db_tags_name_index [ key ] <EOL> def db_has_tag_with_name ( self , key ) : <EOL> return self . db_tags_name_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBWorkflow ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , name = None , modules = None , connections = None , annotations = None , others = None , abstractionRefs = None ) : <EOL> self . __db_id = id <EOL> self . __db_name = name <EOL> self . db_modules_id_index = { } <EOL> if modules is None : <EOL> self . __db_modules = [ ] <EOL> else : <EOL> self . __db_modules = modules <EOL> for v in self . __db_modules : <EOL> self . db_modules_id_index [ v . db_id ] = v <EOL> self . db_connections_id_index = { } <EOL> if connections is None : <EOL> self . __db_connections = [ ] <EOL> else : <EOL> self . __db_connections = connections <EOL> for v in self . __db_connections : <EOL> self . db_connections_id_index [ v . db_id ] = v <EOL> self . db_annotations_id_index = { } <EOL> if annotations is None : <EOL> self . __db_annotations = [ ] <EOL> else : <EOL> self . __db_annotations = annotations <EOL> for v in self . __db_annotations : <EOL> self . db_annotations_id_index [ v . db_id ] = v <EOL> self . db_others_id_index = { } <EOL> if others is None : <EOL> self . __db_others = [ ] <EOL> else : <EOL> self . __db_others = others <EOL> for v in self . __db_others : <EOL> self . db_others_id_index [ v . db_id ] = v <EOL> self . db_abstractionRefs_id_index = { } <EOL> if abstractionRefs is None : <EOL> self . __db_abstractionRefs = [ ] <EOL> else : <EOL> self . __db_abstractionRefs = abstractionRefs <EOL> for v in self . __db_abstractionRefs : <EOL> self . db_abstractionRefs_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBWorkflow ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> if self . db_modules is None : <EOL> cp . db_modules = None <EOL> else : <EOL> cp . db_modules = [ copy . copy ( v ) for v in self . db_modules ] <EOL> for v in cp . __db_modules : <EOL> cp . db_modules_id_index [ v . db_id ] = v <EOL> if self . db_connections is None : <EOL> cp . db_connections = None <EOL> else : <EOL> cp . db_connections = [ copy . copy ( v ) for v in self . db_connections ] <EOL> for v in cp . __db_connections : <EOL> cp . db_connections_id_index [ v . db_id ] = v <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = None <EOL> else : <EOL> cp . db_annotations = [ copy . copy ( v ) for v in self . db_annotations ] <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> if self . db_others is None : <EOL> cp . db_others = None <EOL> else : <EOL> cp . db_others = [ copy . copy ( v ) for v in self . db_others ] <EOL> for v in cp . __db_others : <EOL> cp . db_others_id_index [ v . db_id ] = v <EOL> if self . db_abstractionRefs is None : <EOL> cp . db_abstractionRefs = None <EOL> else : <EOL> cp . db_abstractionRefs = [ copy . copy ( v ) for v in self . db_abstractionRefs ] <EOL> for v in cp . __db_abstractionRefs : <EOL> cp . db_abstractionRefs_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBWorkflow ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_name = self . db_name <EOL> if self . db_modules is None : <EOL> cp . db_modules = [ ] <EOL> else : <EOL> cp . db_modules = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_modules ] <EOL> if self . db_connections is None : <EOL> cp . db_connections = [ ] <EOL> else : <EOL> cp . db_connections = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_connections ] <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = [ ] <EOL> else : <EOL> cp . db_annotations = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_annotations ] <EOL> if self . db_others is None : <EOL> cp . db_others = [ ] <EOL> else : <EOL> cp . db_others = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_others ] <EOL> if self . db_abstractionRefs is None : <EOL> cp . db_abstractionRefs = [ ] <EOL> else : <EOL> cp . db_abstractionRefs = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_abstractionRefs ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_modules : <EOL> cp . db_modules_id_index [ v . db_id ] = v <EOL> for v in cp . __db_connections : <EOL> cp . db_connections_id_index [ v . db_id ] = v <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> for v in cp . __db_others : <EOL> cp . db_others_id_index [ v . db_id ] = v <EOL> for v in cp . __db_abstractionRefs : <EOL> cp . db_abstractionRefs_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_modules : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_module ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_connections : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_connection ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_annotation ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_others : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_other ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_abstractionRefs : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_abstractionRef ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_modules : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_connections : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_annotations : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_others : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_abstractionRefs : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_modules ( self ) : <EOL> return self . __db_modules <EOL> def __set_db_modules ( self , modules ) : <EOL> self . __db_modules = modules <EOL> self . is_dirty = True <EOL> db_modules = property ( __get_db_modules , __set_db_modules ) <EOL> def db_get_modules ( self ) : <EOL> return self . __db_modules <EOL> def db_add_module ( self , module ) : <EOL> self . is_dirty = True <EOL> self . __db_modules . append ( module ) <EOL> self . db_modules_id_index [ module . db_id ] = module <EOL> def db_change_module ( self , module ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_modules ) ) : <EOL> if self . __db_modules [ i ] . db_id == module . db_id : <EOL> self . __db_modules [ i ] = module <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_modules . append ( module ) <EOL> self . db_modules_id_index [ module . db_id ] = module <EOL> def db_delete_module ( self , module ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_modules ) ) : <EOL> if self . __db_modules [ i ] . db_id == module . db_id : <EOL> del self . __db_modules [ i ] <EOL> break <EOL> del self . db_modules_id_index [ module . db_id ] <EOL> def db_get_module ( self , key ) : <EOL> for i in xrange ( len ( self . __db_modules ) ) : <EOL> if self . __db_modules [ i ] . db_id == key : <EOL> return self . __db_modules [ i ] <EOL> return None <EOL> def db_get_module_by_id ( self , key ) : <EOL> return self . db_modules_id_index [ key ] <EOL> def db_has_module_with_id ( self , key ) : <EOL> return self . db_modules_id_index . has_key ( key ) <EOL> def __get_db_connections ( self ) : <EOL> return self . __db_connections <EOL> def __set_db_connections ( self , connections ) : <EOL> self . __db_connections = connections <EOL> self . is_dirty = True <EOL> db_connections = property ( __get_db_connections , __set_db_connections ) <EOL> def db_get_connections ( self ) : <EOL> return self . __db_connections <EOL> def db_add_connection ( self , connection ) : <EOL> self . is_dirty = True <EOL> self . __db_connections . append ( connection ) <EOL> self . db_connections_id_index [ connection . db_id ] = connection <EOL> def db_change_connection ( self , connection ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_connections ) ) : <EOL> if self . __db_connections [ i ] . db_id == connection . db_id : <EOL> self . __db_connections [ i ] = connection <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_connections . append ( connection ) <EOL> self . db_connections_id_index [ connection . db_id ] = connection <EOL> def db_delete_connection ( self , connection ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_connections ) ) : <EOL> if self . __db_connections [ i ] . db_id == connection . db_id : <EOL> del self . __db_connections [ i ] <EOL> break <EOL> del self . db_connections_id_index [ connection . db_id ] <EOL> def db_get_connection ( self , key ) : <EOL> for i in xrange ( len ( self . __db_connections ) ) : <EOL> if self . __db_connections [ i ] . db_id == key : <EOL> return self . __db_connections [ i ] <EOL> return None <EOL> def db_get_connection_by_id ( self , key ) : <EOL> return self . db_connections_id_index [ key ] <EOL> def db_has_connection_with_id ( self , key ) : <EOL> return self . db_connections_id_index . has_key ( key ) <EOL> def __get_db_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def __set_db_annotations ( self , annotations ) : <EOL> self . __db_annotations = annotations <EOL> self . is_dirty = True <EOL> db_annotations = property ( __get_db_annotations , __set_db_annotations ) <EOL> def db_get_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def db_add_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> def db_change_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> self . __db_annotations [ i ] = annotation <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> def db_delete_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> del self . __db_annotations [ i ] <EOL> break <EOL> del self . db_annotations_id_index [ annotation . db_id ] <EOL> def db_get_annotation ( self , key ) : <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == key : <EOL> return self . __db_annotations [ i ] <EOL> return None <EOL> def db_get_annotation_by_id ( self , key ) : <EOL> return self . db_annotations_id_index [ key ] <EOL> def db_has_annotation_with_id ( self , key ) : <EOL> return self . db_annotations_id_index . has_key ( key ) <EOL> def __get_db_others ( self ) : <EOL> return self . __db_others <EOL> def __set_db_others ( self , others ) : <EOL> self . __db_others = others <EOL> self . is_dirty = True <EOL> db_others = property ( __get_db_others , __set_db_others ) <EOL> def db_get_others ( self ) : <EOL> return self . __db_others <EOL> def db_add_other ( self , other ) : <EOL> self . is_dirty = True <EOL> self . __db_others . append ( other ) <EOL> self . db_others_id_index [ other . db_id ] = other <EOL> def db_change_other ( self , other ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_others ) ) : <EOL> if self . __db_others [ i ] . db_id == other . db_id : <EOL> self . __db_others [ i ] = other <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_others . append ( other ) <EOL> self . db_others_id_index [ other . db_id ] = other <EOL> def db_delete_other ( self , other ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_others ) ) : <EOL> if self . __db_others [ i ] . db_id == other . db_id : <EOL> del self . __db_others [ i ] <EOL> break <EOL> del self . db_others_id_index [ other . db_id ] <EOL> def db_get_other ( self , key ) : <EOL> for i in xrange ( len ( self . __db_others ) ) : <EOL> if self . __db_others [ i ] . db_id == key : <EOL> return self . __db_others [ i ] <EOL> return None <EOL> def db_get_other_by_id ( self , key ) : <EOL> return self . db_others_id_index [ key ] <EOL> def db_has_other_with_id ( self , key ) : <EOL> return self . db_others_id_index . has_key ( key ) <EOL> def __get_db_abstractionRefs ( self ) : <EOL> return self . __db_abstractionRefs <EOL> def __set_db_abstractionRefs ( self , abstractionRefs ) : <EOL> self . __db_abstractionRefs = abstractionRefs <EOL> self . is_dirty = True <EOL> db_abstractionRefs = property ( __get_db_abstractionRefs , __set_db_abstractionRefs ) <EOL> def db_get_abstractionRefs ( self ) : <EOL> return self . __db_abstractionRefs <EOL> def db_add_abstractionRef ( self , abstractionRef ) : <EOL> self . is_dirty = True <EOL> self . __db_abstractionRefs . append ( abstractionRef ) <EOL> self . db_abstractionRefs_id_index [ abstractionRef . db_id ] = abstractionRef <EOL> def db_change_abstractionRef ( self , abstractionRef ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_abstractionRefs ) ) : <EOL> if self . __db_abstractionRefs [ i ] . db_id == abstractionRef . db_id : <EOL> self . __db_abstractionRefs [ i ] = abstractionRef <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_abstractionRefs . append ( abstractionRef ) <EOL> self . db_abstractionRefs_id_index [ abstractionRef . db_id ] = abstractionRef <EOL> def db_delete_abstractionRef ( self , abstractionRef ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_abstractionRefs ) ) : <EOL> if self . __db_abstractionRefs [ i ] . db_id == abstractionRef . db_id : <EOL> del self . __db_abstractionRefs [ i ] <EOL> break <EOL> del self . db_abstractionRefs_id_index [ abstractionRef . db_id ] <EOL> def db_get_abstractionRef ( self , key ) : <EOL> for i in xrange ( len ( self . __db_abstractionRefs ) ) : <EOL> if self . __db_abstractionRefs [ i ] . db_id == key : <EOL> return self . __db_abstractionRefs [ i ] <EOL> return None <EOL> def db_get_abstractionRef_by_id ( self , key ) : <EOL> return self . db_abstractionRefs_id_index [ key ] <EOL> def db_has_abstractionRef_with_id ( self , key ) : <EOL> return self . db_abstractionRefs_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBAbstractionRef ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , abstraction_id = None , version = None , location = None ) : <EOL> self . __db_id = id <EOL> self . __db_abstraction_id = abstraction_id <EOL> self . __db_version = version <EOL> self . __db_location = location <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBAbstractionRef ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_abstraction_id = self . db_abstraction_id <EOL> cp . db_version = self . db_version <EOL> cp . db_location = self . db_location <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAbstractionRef ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_abstraction_id = self . db_abstraction_id <EOL> cp . db_version = self . db_version <EOL> if self . db_location is not None : <EOL> cp . db_location = self . db_location . do_copy ( new_ids , id_scope , id_remap ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> if self . db_location is not None : <EOL> children . extend ( self . db_location . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> self . db_location = None <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> if self . db_location is not None and self . db_location . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_abstraction_id ( self ) : <EOL> return self . __db_abstraction_id <EOL> def __set_db_abstraction_id ( self , abstraction_id ) : <EOL> self . __db_abstraction_id = abstraction_id <EOL> self . is_dirty = True <EOL> db_abstraction_id = property ( __get_db_abstraction_id , __set_db_abstraction_id ) <EOL> def db_add_abstraction_id ( self , abstraction_id ) : <EOL> self . __db_abstraction_id = abstraction_id <EOL> def db_change_abstraction_id ( self , abstraction_id ) : <EOL> self . __db_abstraction_id = abstraction_id <EOL> def db_delete_abstraction_id ( self , abstraction_id ) : <EOL> self . __db_abstraction_id = None <EOL> def __get_db_version ( self ) : <EOL> return self . __db_version <EOL> def __set_db_version ( self , version ) : <EOL> self . __db_version = version <EOL> self . is_dirty = True <EOL> db_version = property ( __get_db_version , __set_db_version ) <EOL> def db_add_version ( self , version ) : <EOL> self . __db_version = version <EOL> def db_change_version ( self , version ) : <EOL> self . __db_version = version <EOL> def db_delete_version ( self , version ) : <EOL> self . __db_version = None <EOL> def __get_db_location ( self ) : <EOL> return self . __db_location <EOL> def __set_db_location ( self , location ) : <EOL> self . __db_location = location <EOL> self . is_dirty = True <EOL> db_location = property ( __get_db_location , __set_db_location ) <EOL> def db_add_location ( self , location ) : <EOL> self . __db_location = location <EOL> def db_change_location ( self , location ) : <EOL> self . __db_location = location <EOL> def db_delete_location ( self , location ) : <EOL> self . __db_location = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBAnnotation ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , key = None , value = None ) : <EOL> self . __db_id = id <EOL> self . __db_key = key <EOL> self . __db_value = value <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBAnnotation ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_key = self . db_key <EOL> cp . db_value = self . db_value <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAnnotation ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_key = self . db_key <EOL> cp . db_value = self . db_value <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_key ( self ) : <EOL> return self . __db_key <EOL> def __set_db_key ( self , key ) : <EOL> self . __db_key = key <EOL> self . is_dirty = True <EOL> db_key = property ( __get_db_key , __set_db_key ) <EOL> def db_add_key ( self , key ) : <EOL> self . __db_key = key <EOL> def db_change_key ( self , key ) : <EOL> self . __db_key = key <EOL> def db_delete_key ( self , key ) : <EOL> self . __db_key = None <EOL> def __get_db_value ( self ) : <EOL> return self . __db_value <EOL> def __set_db_value ( self , value ) : <EOL> self . __db_value = value <EOL> self . is_dirty = True <EOL> db_value = property ( __get_db_value , __set_db_value ) <EOL> def db_add_value ( self , value ) : <EOL> self . __db_value = value <EOL> def db_change_value ( self , value ) : <EOL> self . __db_value = value <EOL> def db_delete_value ( self , value ) : <EOL> self . __db_value = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBChange ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , what = None , oldObjId = None , newObjId = None , parentObjId = None , parentObjType = None , data = None ) : <EOL> self . __db_id = id <EOL> self . __db_what = what <EOL> self . __db_oldObjId = oldObjId <EOL> self . __db_newObjId = newObjId <EOL> self . __db_parentObjId = parentObjId <EOL> self . __db_parentObjType = parentObjType <EOL> self . __db_data = data <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBChange ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_what = self . db_what <EOL> cp . db_oldObjId = self . db_oldObjId <EOL> cp . db_newObjId = self . db_newObjId <EOL> cp . db_parentObjId = self . db_parentObjId <EOL> cp . db_parentObjType = self . db_parentObjType <EOL> cp . db_data = self . db_data <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBChange ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_what = self . db_what <EOL> cp . db_oldObjId = self . db_oldObjId <EOL> cp . db_newObjId = self . db_newObjId <EOL> cp . db_parentObjId = self . db_parentObjId <EOL> cp . db_parentObjType = self . db_parentObjType <EOL> if self . db_data is not None : <EOL> cp . db_data = self . db_data . do_copy ( new_ids , id_scope , id_remap ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_what , self . db_oldObjId ) ) : <EOL> cp . db_oldObjId = id_remap [ ( self . db_what , self . db_oldObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_what , self . db_newObjId ) ) : <EOL> cp . db_newObjId = id_remap [ ( self . db_what , self . db_newObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_parentObjType , self . db_parentObjId ) ) : <EOL> cp . db_parentObjId = id_remap [ ( self . db_parentObjType , self . db_parentObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> if self . db_data is not None : <EOL> children . extend ( self . db_data . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> self . db_data = None <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> if self . db_data is not None and self . db_data . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_what ( self ) : <EOL> return self . __db_what <EOL> def __set_db_what ( self , what ) : <EOL> self . __db_what = what <EOL> self . is_dirty = True <EOL> db_what = property ( __get_db_what , __set_db_what ) <EOL> def db_add_what ( self , what ) : <EOL> self . __db_what = what <EOL> def db_change_what ( self , what ) : <EOL> self . __db_what = what <EOL> def db_delete_what ( self , what ) : <EOL> self . __db_what = None <EOL> def __get_db_oldObjId ( self ) : <EOL> return self . __db_oldObjId <EOL> def __set_db_oldObjId ( self , oldObjId ) : <EOL> self . __db_oldObjId = oldObjId <EOL> self . is_dirty = True <EOL> db_oldObjId = property ( __get_db_oldObjId , __set_db_oldObjId ) <EOL> def db_add_oldObjId ( self , oldObjId ) : <EOL> self . __db_oldObjId = oldObjId <EOL> def db_change_oldObjId ( self , oldObjId ) : <EOL> self . __db_oldObjId = oldObjId <EOL> def db_delete_oldObjId ( self , oldObjId ) : <EOL> self . __db_oldObjId = None <EOL> def __get_db_newObjId ( self ) : <EOL> return self . __db_newObjId <EOL> def __set_db_newObjId ( self , newObjId ) : <EOL> self . __db_newObjId = newObjId <EOL> self . is_dirty = True <EOL> db_newObjId = property ( __get_db_newObjId , __set_db_newObjId ) <EOL> def db_add_newObjId ( self , newObjId ) : <EOL> self . __db_newObjId = newObjId <EOL> def db_change_newObjId ( self , newObjId ) : <EOL> self . __db_newObjId = newObjId <EOL> def db_delete_newObjId ( self , newObjId ) : <EOL> self . __db_newObjId = None <EOL> def __get_db_parentObjId ( self ) : <EOL> return self . __db_parentObjId <EOL> def __set_db_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> self . is_dirty = True <EOL> db_parentObjId = property ( __get_db_parentObjId , __set_db_parentObjId ) <EOL> def db_add_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> def db_change_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> def db_delete_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = None <EOL> def __get_db_parentObjType ( self ) : <EOL> return self . __db_parentObjType <EOL> def __set_db_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> self . is_dirty = True <EOL> db_parentObjType = property ( __get_db_parentObjType , __set_db_parentObjType ) <EOL> def db_add_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> def db_change_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> def db_delete_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = None <EOL> def __get_db_data ( self ) : <EOL> return self . __db_data <EOL> def __set_db_data ( self , data ) : <EOL> self . __db_data = data <EOL> self . is_dirty = True <EOL> db_data = property ( __get_db_data , __set_db_data ) <EOL> def db_add_data ( self , data ) : <EOL> self . __db_data = data <EOL> def db_change_data ( self , data ) : <EOL> self . __db_data = data <EOL> def db_delete_data ( self , data ) : <EOL> self . __db_data = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBParameter ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , pos = None , name = None , type = None , val = None , alias = None ) : <EOL> self . __db_id = id <EOL> self . __db_pos = pos <EOL> self . __db_name = name <EOL> self . __db_type = type <EOL> self . __db_val = val <EOL> self . __db_alias = alias <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBParameter ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_pos = self . db_pos <EOL> cp . db_name = self . db_name <EOL> cp . db_type = self . db_type <EOL> cp . db_val = self . db_val <EOL> cp . db_alias = self . db_alias <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBParameter ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_pos = self . db_pos <EOL> cp . db_name = self . db_name <EOL> cp . db_type = self . db_type <EOL> cp . db_val = self . db_val <EOL> cp . db_alias = self . db_alias <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_pos ( self ) : <EOL> return self . __db_pos <EOL> def __set_db_pos ( self , pos ) : <EOL> self . __db_pos = pos <EOL> self . is_dirty = True <EOL> db_pos = property ( __get_db_pos , __set_db_pos ) <EOL> def db_add_pos ( self , pos ) : <EOL> self . __db_pos = pos <EOL> def db_change_pos ( self , pos ) : <EOL> self . __db_pos = pos <EOL> def db_delete_pos ( self , pos ) : <EOL> self . __db_pos = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_type ( self ) : <EOL> return self . __db_type <EOL> def __set_db_type ( self , type ) : <EOL> self . __db_type = type <EOL> self . is_dirty = True <EOL> db_type = property ( __get_db_type , __set_db_type ) <EOL> def db_add_type ( self , type ) : <EOL> self . __db_type = type <EOL> def db_change_type ( self , type ) : <EOL> self . __db_type = type <EOL> def db_delete_type ( self , type ) : <EOL> self . __db_type = None <EOL> def __get_db_val ( self ) : <EOL> return self . __db_val <EOL> def __set_db_val ( self , val ) : <EOL> self . __db_val = val <EOL> self . is_dirty = True <EOL> db_val = property ( __get_db_val , __set_db_val ) <EOL> def db_add_val ( self , val ) : <EOL> self . __db_val = val <EOL> def db_change_val ( self , val ) : <EOL> self . __db_val = val <EOL> def db_delete_val ( self , val ) : <EOL> self . __db_val = None <EOL> def __get_db_alias ( self ) : <EOL> return self . __db_alias <EOL> def __set_db_alias ( self , alias ) : <EOL> self . __db_alias = alias <EOL> self . is_dirty = True <EOL> db_alias = property ( __get_db_alias , __set_db_alias ) <EOL> def db_add_alias ( self , alias ) : <EOL> self . __db_alias = alias <EOL> def db_change_alias ( self , alias ) : <EOL> self . __db_alias = alias <EOL> def db_delete_alias ( self , alias ) : <EOL> self . __db_alias = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBConnection ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , ports = None ) : <EOL> self . __db_id = id <EOL> self . db_ports_id_index = { } <EOL> self . db_ports_type_index = { } <EOL> if ports is None : <EOL> self . __db_ports = [ ] <EOL> else : <EOL> self . __db_ports = ports <EOL> for v in self . __db_ports : <EOL> self . db_ports_id_index [ v . db_id ] = v <EOL> self . db_ports_type_index [ v . db_type ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBConnection ( ) <EOL> cp . db_id = self . db_id <EOL> if self . db_ports is None : <EOL> cp . db_ports = None <EOL> else : <EOL> cp . db_ports = [ copy . copy ( v ) for v in self . db_ports ] <EOL> for v in cp . __db_ports : <EOL> cp . db_ports_id_index [ v . db_id ] = v <EOL> cp . db_ports_type_index [ v . db_type ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBConnection ( ) <EOL> cp . db_id = self . db_id <EOL> if self . db_ports is None : <EOL> cp . db_ports = [ ] <EOL> else : <EOL> cp . db_ports = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_ports ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_ports : <EOL> cp . db_ports_id_index [ v . db_id ] = v <EOL> cp . db_ports_type_index [ v . db_type ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_ports : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_port ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_ports : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_ports ( self ) : <EOL> return self . __db_ports <EOL> def __set_db_ports ( self , ports ) : <EOL> self . __db_ports = ports <EOL> self . is_dirty = True <EOL> db_ports = property ( __get_db_ports , __set_db_ports ) <EOL> def db_get_ports ( self ) : <EOL> return self . __db_ports <EOL> def db_add_port ( self , port ) : <EOL> self . is_dirty = True <EOL> self . __db_ports . append ( port ) <EOL> self . db_ports_id_index [ port . db_id ] = port <EOL> self . db_ports_type_index [ port . db_type ] = port <EOL> def db_change_port ( self , port ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_ports ) ) : <EOL> if self . __db_ports [ i ] . db_id == port . db_id : <EOL> self . __db_ports [ i ] = port <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_ports . append ( port ) <EOL> self . db_ports_id_index [ port . db_id ] = port <EOL> self . db_ports_type_index [ port . db_type ] = port <EOL> def db_delete_port ( self , port ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_ports ) ) : <EOL> if self . __db_ports [ i ] . db_id == port . db_id : <EOL> del self . __db_ports [ i ] <EOL> break <EOL> del self . db_ports_id_index [ port . db_id ] <EOL> del self . db_ports_type_index [ port . db_type ] <EOL> def db_get_port ( self , key ) : <EOL> for i in xrange ( len ( self . __db_ports ) ) : <EOL> if self . __db_ports [ i ] . db_id == key : <EOL> return self . __db_ports [ i ] <EOL> return None <EOL> def db_get_port_by_id ( self , key ) : <EOL> return self . db_ports_id_index [ key ] <EOL> def db_has_port_with_id ( self , key ) : <EOL> return self . db_ports_id_index . has_key ( key ) <EOL> def db_get_port_by_type ( self , key ) : <EOL> return self . db_ports_type_index [ key ] <EOL> def db_has_port_with_type ( self , key ) : <EOL> return self . db_ports_type_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBAction ( object ) : <EOL> vtType = '<STR_LIT:action>' <EOL> def __init__ ( self , id = None , prevId = None , date = None , session = None , user = None , prune = None , annotations = None , operations = None ) : <EOL> self . __db_id = id <EOL> self . __db_prevId = prevId <EOL> self . __db_date = date <EOL> self . __db_session = session <EOL> self . __db_user = user <EOL> self . __db_prune = prune <EOL> self . db_annotations_id_index = { } <EOL> self . db_annotations_key_index = { } <EOL> if annotations is None : <EOL> self . __db_annotations = [ ] <EOL> else : <EOL> self . __db_annotations = annotations <EOL> for v in self . __db_annotations : <EOL> self . db_annotations_id_index [ v . db_id ] = v <EOL> self . db_annotations_key_index [ v . db_key ] = v <EOL> self . db_operations_id_index = { } <EOL> if operations is None : <EOL> self . __db_operations = [ ] <EOL> else : <EOL> self . __db_operations = operations <EOL> for v in self . __db_operations : <EOL> self . db_operations_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBAction ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_prevId = self . db_prevId <EOL> cp . db_date = self . db_date <EOL> cp . db_session = self . db_session <EOL> cp . db_user = self . db_user <EOL> cp . db_prune = self . db_prune <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = None <EOL> else : <EOL> cp . db_annotations = [ copy . copy ( v ) for v in self . db_annotations ] <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> cp . db_annotations_key_index [ v . db_key ] = v <EOL> if self . db_operations is None : <EOL> cp . db_operations = None <EOL> else : <EOL> cp . db_operations = [ copy . copy ( v ) for v in self . db_operations ] <EOL> for v in cp . __db_operations : <EOL> cp . db_operations_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAction ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_prevId = self . db_prevId <EOL> cp . db_date = self . db_date <EOL> cp . db_session = self . db_session <EOL> cp . db_user = self . db_user <EOL> cp . db_prune = self . db_prune <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = [ ] <EOL> else : <EOL> cp . db_annotations = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_annotations ] <EOL> if self . db_operations is None : <EOL> cp . db_operations = [ ] <EOL> else : <EOL> cp . db_operations = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_operations ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> cp . db_annotations_key_index [ v . db_key ] = v <EOL> for v in cp . __db_operations : <EOL> cp . db_operations_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_annotation ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_operations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_operation ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_annotations : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_operations : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_prevId ( self ) : <EOL> return self . __db_prevId <EOL> def __set_db_prevId ( self , prevId ) : <EOL> self . __db_prevId = prevId <EOL> self . is_dirty = True <EOL> db_prevId = property ( __get_db_prevId , __set_db_prevId ) <EOL> def db_add_prevId ( self , prevId ) : <EOL> self . __db_prevId = prevId <EOL> def db_change_prevId ( self , prevId ) : <EOL> self . __db_prevId = prevId <EOL> def db_delete_prevId ( self , prevId ) : <EOL> self . __db_prevId = None <EOL> def __get_db_date ( self ) : <EOL> return self . __db_date <EOL> def __set_db_date ( self , date ) : <EOL> self . __db_date = date <EOL> self . is_dirty = True <EOL> db_date = property ( __get_db_date , __set_db_date ) <EOL> def db_add_date ( self , date ) : <EOL> self . __db_date = date <EOL> def db_change_date ( self , date ) : <EOL> self . __db_date = date <EOL> def db_delete_date ( self , date ) : <EOL> self . __db_date = None <EOL> def __get_db_session ( self ) : <EOL> return self . __db_session <EOL> def __set_db_session ( self , session ) : <EOL> self . __db_session = session <EOL> self . is_dirty = True <EOL> db_session = property ( __get_db_session , __set_db_session ) <EOL> def db_add_session ( self , session ) : <EOL> self . __db_session = session <EOL> def db_change_session ( self , session ) : <EOL> self . __db_session = session <EOL> def db_delete_session ( self , session ) : <EOL> self . __db_session = None <EOL> def __get_db_user ( self ) : <EOL> return self . __db_user <EOL> def __set_db_user ( self , user ) : <EOL> self . __db_user = user <EOL> self . is_dirty = True <EOL> db_user = property ( __get_db_user , __set_db_user ) <EOL> def db_add_user ( self , user ) : <EOL> self . __db_user = user <EOL> def db_change_user ( self , user ) : <EOL> self . __db_user = user <EOL> def db_delete_user ( self , user ) : <EOL> self . __db_user = None <EOL> def __get_db_prune ( self ) : <EOL> return self . __db_prune <EOL> def __set_db_prune ( self , prune ) : <EOL> self . __db_prune = prune <EOL> self . is_dirty = True <EOL> db_prune = property ( __get_db_prune , __set_db_prune ) <EOL> def db_add_prune ( self , prune ) : <EOL> self . __db_prune = prune <EOL> def db_change_prune ( self , prune ) : <EOL> self . __db_prune = prune <EOL> def db_delete_prune ( self , prune ) : <EOL> self . __db_prune = None <EOL> def __get_db_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def __set_db_annotations ( self , annotations ) : <EOL> self . __db_annotations = annotations <EOL> self . is_dirty = True <EOL> db_annotations = property ( __get_db_annotations , __set_db_annotations ) <EOL> def db_get_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def db_add_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> self . db_annotations_key_index [ annotation . db_key ] = annotation <EOL> def db_change_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> self . __db_annotations [ i ] = annotation <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> self . db_annotations_key_index [ annotation . db_key ] = annotation <EOL> def db_delete_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> del self . __db_annotations [ i ] <EOL> break <EOL> del self . db_annotations_id_index [ annotation . db_id ] <EOL> del self . db_annotations_key_index [ annotation . db_key ] <EOL> def db_get_annotation ( self , key ) : <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == key : <EOL> return self . __db_annotations [ i ] <EOL> return None <EOL> def db_get_annotation_by_id ( self , key ) : <EOL> return self . db_annotations_id_index [ key ] <EOL> def db_has_annotation_with_id ( self , key ) : <EOL> return self . db_annotations_id_index . has_key ( key ) <EOL> def db_get_annotation_by_key ( self , key ) : <EOL> return self . db_annotations_key_index [ key ] <EOL> def db_has_annotation_with_key ( self , key ) : <EOL> return self . db_annotations_key_index . has_key ( key ) <EOL> def __get_db_operations ( self ) : <EOL> return self . __db_operations <EOL> def __set_db_operations ( self , operations ) : <EOL> self . __db_operations = operations <EOL> self . is_dirty = True <EOL> db_operations = property ( __get_db_operations , __set_db_operations ) <EOL> def db_get_operations ( self ) : <EOL> return self . __db_operations <EOL> def db_add_operation ( self , operation ) : <EOL> self . is_dirty = True <EOL> self . __db_operations . append ( operation ) <EOL> self . db_operations_id_index [ operation . db_id ] = operation <EOL> def db_change_operation ( self , operation ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_operations ) ) : <EOL> if self . __db_operations [ i ] . db_id == operation . db_id : <EOL> self . __db_operations [ i ] = operation <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_operations . append ( operation ) <EOL> self . db_operations_id_index [ operation . db_id ] = operation <EOL> def db_delete_operation ( self , operation ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_operations ) ) : <EOL> if self . __db_operations [ i ] . db_id == operation . db_id : <EOL> del self . __db_operations [ i ] <EOL> break <EOL> del self . db_operations_id_index [ operation . db_id ] <EOL> def db_get_operation ( self , key ) : <EOL> for i in xrange ( len ( self . __db_operations ) ) : <EOL> if self . __db_operations [ i ] . db_id == key : <EOL> return self . __db_operations [ i ] <EOL> return None <EOL> def db_get_operation_by_id ( self , key ) : <EOL> return self . db_operations_id_index [ key ] <EOL> def db_has_operation_with_id ( self , key ) : <EOL> return self . db_operations_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBDelete ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , what = None , objectId = None , parentObjId = None , parentObjType = None ) : <EOL> self . __db_id = id <EOL> self . __db_what = what <EOL> self . __db_objectId = objectId <EOL> self . __db_parentObjId = parentObjId <EOL> self . __db_parentObjType = parentObjType <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBDelete ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_what = self . db_what <EOL> cp . db_objectId = self . db_objectId <EOL> cp . db_parentObjId = self . db_parentObjId <EOL> cp . db_parentObjType = self . db_parentObjType <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBDelete ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_what = self . db_what <EOL> cp . db_objectId = self . db_objectId <EOL> cp . db_parentObjId = self . db_parentObjId <EOL> cp . db_parentObjType = self . db_parentObjType <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_what , self . db_objectId ) ) : <EOL> cp . db_objectId = id_remap [ ( self . db_what , self . db_objectId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( self . db_parentObjType , self . db_parentObjId ) ) : <EOL> cp . db_parentObjId = id_remap [ ( self . db_parentObjType , self . db_parentObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_what ( self ) : <EOL> return self . __db_what <EOL> def __set_db_what ( self , what ) : <EOL> self . __db_what = what <EOL> self . is_dirty = True <EOL> db_what = property ( __get_db_what , __set_db_what ) <EOL> def db_add_what ( self , what ) : <EOL> self . __db_what = what <EOL> def db_change_what ( self , what ) : <EOL> self . __db_what = what <EOL> def db_delete_what ( self , what ) : <EOL> self . __db_what = None <EOL> def __get_db_objectId ( self ) : <EOL> return self . __db_objectId <EOL> def __set_db_objectId ( self , objectId ) : <EOL> self . __db_objectId = objectId <EOL> self . is_dirty = True <EOL> db_objectId = property ( __get_db_objectId , __set_db_objectId ) <EOL> def db_add_objectId ( self , objectId ) : <EOL> self . __db_objectId = objectId <EOL> def db_change_objectId ( self , objectId ) : <EOL> self . __db_objectId = objectId <EOL> def db_delete_objectId ( self , objectId ) : <EOL> self . __db_objectId = None <EOL> def __get_db_parentObjId ( self ) : <EOL> return self . __db_parentObjId <EOL> def __set_db_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> self . is_dirty = True <EOL> db_parentObjId = property ( __get_db_parentObjId , __set_db_parentObjId ) <EOL> def db_add_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> def db_change_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = parentObjId <EOL> def db_delete_parentObjId ( self , parentObjId ) : <EOL> self . __db_parentObjId = None <EOL> def __get_db_parentObjType ( self ) : <EOL> return self . __db_parentObjType <EOL> def __set_db_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> self . is_dirty = True <EOL> db_parentObjType = property ( __get_db_parentObjType , __set_db_parentObjType ) <EOL> def db_add_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> def db_change_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = parentObjType <EOL> def db_delete_parentObjType ( self , parentObjType ) : <EOL> self . __db_parentObjType = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBVistrail ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , version = None , name = None , dbHost = None , dbPort = None , dbName = None , actions = None , tags = None , abstractions = None ) : <EOL> self . __db_id = id <EOL> self . __db_version = version <EOL> self . __db_name = name <EOL> self . __db_dbHost = dbHost <EOL> self . __db_dbPort = dbPort <EOL> self . __db_dbName = dbName <EOL> self . db_actions_id_index = { } <EOL> if actions is None : <EOL> self . __db_actions = [ ] <EOL> else : <EOL> self . __db_actions = actions <EOL> for v in self . __db_actions : <EOL> self . db_actions_id_index [ v . db_id ] = v <EOL> self . db_tags_id_index = { } <EOL> self . db_tags_name_index = { } <EOL> if tags is None : <EOL> self . __db_tags = [ ] <EOL> else : <EOL> self . __db_tags = tags <EOL> for v in self . __db_tags : <EOL> self . db_tags_id_index [ v . db_id ] = v <EOL> self . db_tags_name_index [ v . db_name ] = v <EOL> self . db_abstractions_id_index = { } <EOL> if abstractions is None : <EOL> self . __db_abstractions = [ ] <EOL> else : <EOL> self . __db_abstractions = abstractions <EOL> for v in self . __db_abstractions : <EOL> self . db_abstractions_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBVistrail ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_version = self . db_version <EOL> cp . db_name = self . db_name <EOL> cp . db_dbHost = self . db_dbHost <EOL> cp . db_dbPort = self . db_dbPort <EOL> cp . db_dbName = self . db_dbName <EOL> if self . db_actions is None : <EOL> cp . db_actions = None <EOL> else : <EOL> cp . db_actions = [ copy . copy ( v ) for v in self . db_actions ] <EOL> for v in cp . __db_actions : <EOL> cp . db_actions_id_index [ v . db_id ] = v <EOL> if self . db_tags is None : <EOL> cp . db_tags = None <EOL> else : <EOL> cp . db_tags = [ copy . copy ( v ) for v in self . db_tags ] <EOL> for v in cp . __db_tags : <EOL> cp . db_tags_id_index [ v . db_id ] = v <EOL> cp . db_tags_name_index [ v . db_name ] = v <EOL> if self . db_abstractions is None : <EOL> cp . db_abstractions = None <EOL> else : <EOL> cp . db_abstractions = [ copy . copy ( v ) for v in self . db_abstractions ] <EOL> for v in cp . __db_abstractions : <EOL> cp . db_abstractions_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBVistrail ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_version = self . db_version <EOL> cp . db_name = self . db_name <EOL> cp . db_dbHost = self . db_dbHost <EOL> cp . db_dbPort = self . db_dbPort <EOL> cp . db_dbName = self . db_dbName <EOL> if self . db_actions is None : <EOL> cp . db_actions = [ ] <EOL> else : <EOL> cp . db_actions = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_actions ] <EOL> if self . db_tags is None : <EOL> cp . db_tags = [ ] <EOL> else : <EOL> cp . db_tags = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_tags ] <EOL> if self . db_abstractions is None : <EOL> cp . db_abstractions = [ ] <EOL> else : <EOL> cp . db_abstractions = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_abstractions ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> for v in cp . __db_actions : <EOL> cp . db_actions_id_index [ v . db_id ] = v <EOL> for v in cp . __db_tags : <EOL> cp . db_tags_id_index [ v . db_id ] = v <EOL> cp . db_tags_name_index [ v . db_name ] = v <EOL> for v in cp . __db_abstractions : <EOL> cp . db_abstractions_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_actions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_action ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_tags : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_tag ( child ) <EOL> to_del = [ ] <EOL> for child in self . db_abstractions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_abstraction ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_actions : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_tags : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> for child in self . db_abstractions : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_version ( self ) : <EOL> return self . __db_version <EOL> def __set_db_version ( self , version ) : <EOL> self . __db_version = version <EOL> self . is_dirty = True <EOL> db_version = property ( __get_db_version , __set_db_version ) <EOL> def db_add_version ( self , version ) : <EOL> self . __db_version = version <EOL> def db_change_version ( self , version ) : <EOL> self . __db_version = version <EOL> def db_delete_version ( self , version ) : <EOL> self . __db_version = None <EOL> def __get_db_name ( self ) : <EOL> return self . __db_name <EOL> def __set_db_name ( self , name ) : <EOL> self . __db_name = name <EOL> self . is_dirty = True <EOL> db_name = property ( __get_db_name , __set_db_name ) <EOL> def db_add_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_change_name ( self , name ) : <EOL> self . __db_name = name <EOL> def db_delete_name ( self , name ) : <EOL> self . __db_name = None <EOL> def __get_db_dbHost ( self ) : <EOL> return self . __db_dbHost <EOL> def __set_db_dbHost ( self , dbHost ) : <EOL> self . __db_dbHost = dbHost <EOL> self . is_dirty = True <EOL> db_dbHost = property ( __get_db_dbHost , __set_db_dbHost ) <EOL> def db_add_dbHost ( self , dbHost ) : <EOL> self . __db_dbHost = dbHost <EOL> def db_change_dbHost ( self , dbHost ) : <EOL> self . __db_dbHost = dbHost <EOL> def db_delete_dbHost ( self , dbHost ) : <EOL> self . __db_dbHost = None <EOL> def __get_db_dbPort ( self ) : <EOL> return self . __db_dbPort <EOL> def __set_db_dbPort ( self , dbPort ) : <EOL> self . __db_dbPort = dbPort <EOL> self . is_dirty = True <EOL> db_dbPort = property ( __get_db_dbPort , __set_db_dbPort ) <EOL> def db_add_dbPort ( self , dbPort ) : <EOL> self . __db_dbPort = dbPort <EOL> def db_change_dbPort ( self , dbPort ) : <EOL> self . __db_dbPort = dbPort <EOL> def db_delete_dbPort ( self , dbPort ) : <EOL> self . __db_dbPort = None <EOL> def __get_db_dbName ( self ) : <EOL> return self . __db_dbName <EOL> def __set_db_dbName ( self , dbName ) : <EOL> self . __db_dbName = dbName <EOL> self . is_dirty = True <EOL> db_dbName = property ( __get_db_dbName , __set_db_dbName ) <EOL> def db_add_dbName ( self , dbName ) : <EOL> self . __db_dbName = dbName <EOL> def db_change_dbName ( self , dbName ) : <EOL> self . __db_dbName = dbName <EOL> def db_delete_dbName ( self , dbName ) : <EOL> self . __db_dbName = None <EOL> def __get_db_actions ( self ) : <EOL> return self . __db_actions <EOL> def __set_db_actions ( self , actions ) : <EOL> self . __db_actions = actions <EOL> self . is_dirty = True <EOL> db_actions = property ( __get_db_actions , __set_db_actions ) <EOL> def db_get_actions ( self ) : <EOL> return self . __db_actions <EOL> def db_add_action ( self , action ) : <EOL> self . is_dirty = True <EOL> self . __db_actions . append ( action ) <EOL> self . db_actions_id_index [ action . db_id ] = action <EOL> def db_change_action ( self , action ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_actions ) ) : <EOL> if self . __db_actions [ i ] . db_id == action . db_id : <EOL> self . __db_actions [ i ] = action <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_actions . append ( action ) <EOL> self . db_actions_id_index [ action . db_id ] = action <EOL> def db_delete_action ( self , action ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_actions ) ) : <EOL> if self . __db_actions [ i ] . db_id == action . db_id : <EOL> del self . __db_actions [ i ] <EOL> break <EOL> del self . db_actions_id_index [ action . db_id ] <EOL> def db_get_action ( self , key ) : <EOL> for i in xrange ( len ( self . __db_actions ) ) : <EOL> if self . __db_actions [ i ] . db_id == key : <EOL> return self . __db_actions [ i ] <EOL> return None <EOL> def db_get_action_by_id ( self , key ) : <EOL> return self . db_actions_id_index [ key ] <EOL> def db_has_action_with_id ( self , key ) : <EOL> return self . db_actions_id_index . has_key ( key ) <EOL> def __get_db_tags ( self ) : <EOL> return self . __db_tags <EOL> def __set_db_tags ( self , tags ) : <EOL> self . __db_tags = tags <EOL> self . is_dirty = True <EOL> db_tags = property ( __get_db_tags , __set_db_tags ) <EOL> def db_get_tags ( self ) : <EOL> return self . __db_tags <EOL> def db_add_tag ( self , tag ) : <EOL> self . is_dirty = True <EOL> self . __db_tags . append ( tag ) <EOL> self . db_tags_id_index [ tag . db_id ] = tag <EOL> self . db_tags_name_index [ tag . db_name ] = tag <EOL> def db_change_tag ( self , tag ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_tags ) ) : <EOL> if self . __db_tags [ i ] . db_id == tag . db_id : <EOL> self . __db_tags [ i ] = tag <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_tags . append ( tag ) <EOL> self . db_tags_id_index [ tag . db_id ] = tag <EOL> self . db_tags_name_index [ tag . db_name ] = tag <EOL> def db_delete_tag ( self , tag ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_tags ) ) : <EOL> if self . __db_tags [ i ] . db_id == tag . db_id : <EOL> del self . __db_tags [ i ] <EOL> break <EOL> del self . db_tags_id_index [ tag . db_id ] <EOL> del self . db_tags_name_index [ tag . db_name ] <EOL> def db_get_tag ( self , key ) : <EOL> for i in xrange ( len ( self . __db_tags ) ) : <EOL> if self . __db_tags [ i ] . db_id == key : <EOL> return self . __db_tags [ i ] <EOL> return None <EOL> def db_get_tag_by_id ( self , key ) : <EOL> return self . db_tags_id_index [ key ] <EOL> def db_has_tag_with_id ( self , key ) : <EOL> return self . db_tags_id_index . has_key ( key ) <EOL> def db_get_tag_by_name ( self , key ) : <EOL> return self . db_tags_name_index [ key ] <EOL> def db_has_tag_with_name ( self , key ) : <EOL> return self . db_tags_name_index . has_key ( key ) <EOL> def __get_db_abstractions ( self ) : <EOL> return self . __db_abstractions <EOL> def __set_db_abstractions ( self , abstractions ) : <EOL> self . __db_abstractions = abstractions <EOL> self . is_dirty = True <EOL> db_abstractions = property ( __get_db_abstractions , __set_db_abstractions ) <EOL> def db_get_abstractions ( self ) : <EOL> return self . __db_abstractions <EOL> def db_add_abstraction ( self , abstraction ) : <EOL> self . is_dirty = True <EOL> self . __db_abstractions . append ( abstraction ) <EOL> self . db_abstractions_id_index [ abstraction . db_id ] = abstraction <EOL> def db_change_abstraction ( self , abstraction ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_abstractions ) ) : <EOL> if self . __db_abstractions [ i ] . db_id == abstraction . db_id : <EOL> self . __db_abstractions [ i ] = abstraction <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_abstractions . append ( abstraction ) <EOL> self . db_abstractions_id_index [ abstraction . db_id ] = abstraction <EOL> def db_delete_abstraction ( self , abstraction ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_abstractions ) ) : <EOL> if self . __db_abstractions [ i ] . db_id == abstraction . db_id : <EOL> del self . __db_abstractions [ i ] <EOL> break <EOL> del self . db_abstractions_id_index [ abstraction . db_id ] <EOL> def db_get_abstraction ( self , key ) : <EOL> for i in xrange ( len ( self . __db_abstractions ) ) : <EOL> if self . __db_abstractions [ i ] . db_id == key : <EOL> return self . __db_abstractions [ i ] <EOL> return None <EOL> def db_get_abstraction_by_id ( self , key ) : <EOL> return self . db_abstractions_id_index [ key ] <EOL> def db_has_abstraction_with_id ( self , key ) : <EOL> return self . db_abstractions_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id <EOL> class DBModuleExec ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , ts_start = None , ts_end = None , module_id = None , module_name = None , annotations = None ) : <EOL> self . __db_id = id <EOL> self . __db_ts_start = ts_start <EOL> self . __db_ts_end = ts_end <EOL> self . __db_module_id = module_id <EOL> self . __db_module_name = module_name <EOL> self . db_annotations_id_index = { } <EOL> if annotations is None : <EOL> self . __db_annotations = [ ] <EOL> else : <EOL> self . __db_annotations = annotations <EOL> for v in self . __db_annotations : <EOL> self . db_annotations_id_index [ v . db_id ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> cp = DBModuleExec ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_ts_start = self . db_ts_start <EOL> cp . db_ts_end = self . db_ts_end <EOL> cp . db_module_id = self . db_module_id <EOL> cp . db_module_name = self . db_module_name <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = None <EOL> else : <EOL> cp . db_annotations = [ copy . copy ( v ) for v in self . db_annotations ] <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBModuleExec ( ) <EOL> cp . db_id = self . db_id <EOL> cp . db_ts_start = self . db_ts_start <EOL> cp . db_ts_end = self . db_ts_end <EOL> cp . db_module_id = self . db_module_id <EOL> cp . db_module_name = self . db_module_name <EOL> if self . db_annotations is None : <EOL> cp . db_annotations = [ ] <EOL> else : <EOL> cp . db_annotations = [ v . do_copy ( new_ids , id_scope , id_remap ) for v in self . db_annotations ] <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> id_remap [ ( self . vtType , self . db_id ) ] = new_id <EOL> cp . db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_module_id ) ) : <EOL> cp . db_module_id = id_remap [ ( '<STR_LIT>' , self . db_module_id ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and id_remap . has_key ( ( '<STR_LIT>' , self . db_vistrailId ) ) : <EOL> cp . db_vistrailId = id_remap [ ( '<STR_LIT>' , self . db_vistrailId ) ] <EOL> for v in cp . __db_annotations : <EOL> cp . db_annotations_id_index [ v . db_id ] = v <EOL> cp . is_dirty = self . is_dirty <EOL> cp . is_new = self . is_new <EOL> return cp <EOL> def db_children ( self , parent = ( None , None ) , orphan = False ) : <EOL> children = [ ] <EOL> to_del = [ ] <EOL> for child in self . db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . db_id ) , orphan ) ) <EOL> if orphan : <EOL> to_del . append ( child ) <EOL> for child in to_del : <EOL> self . db_delete_annotation ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> for child in self . db_annotations : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <EOL> def __get_db_id ( self ) : <EOL> return self . __db_id <EOL> def __set_db_id ( self , id ) : <EOL> self . __db_id = id <EOL> self . is_dirty = True <EOL> db_id = property ( __get_db_id , __set_db_id ) <EOL> def db_add_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_change_id ( self , id ) : <EOL> self . __db_id = id <EOL> def db_delete_id ( self , id ) : <EOL> self . __db_id = None <EOL> def __get_db_ts_start ( self ) : <EOL> return self . __db_ts_start <EOL> def __set_db_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = ts_start <EOL> self . is_dirty = True <EOL> db_ts_start = property ( __get_db_ts_start , __set_db_ts_start ) <EOL> def db_add_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = ts_start <EOL> def db_change_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = ts_start <EOL> def db_delete_ts_start ( self , ts_start ) : <EOL> self . __db_ts_start = None <EOL> def __get_db_ts_end ( self ) : <EOL> return self . __db_ts_end <EOL> def __set_db_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = ts_end <EOL> self . is_dirty = True <EOL> db_ts_end = property ( __get_db_ts_end , __set_db_ts_end ) <EOL> def db_add_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = ts_end <EOL> def db_change_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = ts_end <EOL> def db_delete_ts_end ( self , ts_end ) : <EOL> self . __db_ts_end = None <EOL> def __get_db_module_id ( self ) : <EOL> return self . __db_module_id <EOL> def __set_db_module_id ( self , module_id ) : <EOL> self . __db_module_id = module_id <EOL> self . is_dirty = True <EOL> db_module_id = property ( __get_db_module_id , __set_db_module_id ) <EOL> def db_add_module_id ( self , module_id ) : <EOL> self . __db_module_id = module_id <EOL> def db_change_module_id ( self , module_id ) : <EOL> self . __db_module_id = module_id <EOL> def db_delete_module_id ( self , module_id ) : <EOL> self . __db_module_id = None <EOL> def __get_db_module_name ( self ) : <EOL> return self . __db_module_name <EOL> def __set_db_module_name ( self , module_name ) : <EOL> self . __db_module_name = module_name <EOL> self . is_dirty = True <EOL> db_module_name = property ( __get_db_module_name , __set_db_module_name ) <EOL> def db_add_module_name ( self , module_name ) : <EOL> self . __db_module_name = module_name <EOL> def db_change_module_name ( self , module_name ) : <EOL> self . __db_module_name = module_name <EOL> def db_delete_module_name ( self , module_name ) : <EOL> self . __db_module_name = None <EOL> def __get_db_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def __set_db_annotations ( self , annotations ) : <EOL> self . __db_annotations = annotations <EOL> self . is_dirty = True <EOL> db_annotations = property ( __get_db_annotations , __set_db_annotations ) <EOL> def db_get_annotations ( self ) : <EOL> return self . __db_annotations <EOL> def db_add_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> def db_change_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> found = False <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> self . __db_annotations [ i ] = annotation <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . __db_annotations . append ( annotation ) <EOL> self . db_annotations_id_index [ annotation . db_id ] = annotation <EOL> def db_delete_annotation ( self , annotation ) : <EOL> self . is_dirty = True <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == annotation . db_id : <EOL> del self . __db_annotations [ i ] <EOL> break <EOL> del self . db_annotations_id_index [ annotation . db_id ] <EOL> def db_get_annotation ( self , key ) : <EOL> for i in xrange ( len ( self . __db_annotations ) ) : <EOL> if self . __db_annotations [ i ] . db_id == key : <EOL> return self . __db_annotations [ i ] <EOL> return None <EOL> def db_get_annotation_by_id ( self , key ) : <EOL> return self . db_annotations_id_index [ key ] <EOL> def db_has_annotation_with_id ( self , key ) : <EOL> return self . db_annotations_id_index . has_key ( key ) <EOL> def getPrimaryKey ( self ) : <EOL> return self . __db_id </s>
