<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> return DBPortSpec . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBPortSpec ( self . _db_id , <EOL> self . _db_name , <EOL> self . _db_type , <EOL> self . _db_spec ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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> return [ ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ] <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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 , name = None , namespace = None , package = None , version = None , tag = None , location = None , functions = None , annotations = None , portSpecs = None ) : <EOL> self . _db_id = id <EOL> self . _db_cache = cache <EOL> self . _db_name = name <EOL> self . _db_namespace = namespace <EOL> self . _db_package = package <EOL> self . _db_version = version <EOL> self . _db_tag = tag <EOL> self . db_deleted_location = [ ] <EOL> self . _db_location = location <EOL> self . db_deleted_functions = [ ] <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_deleted_annotations = [ ] <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_deleted_portSpecs = [ ] <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 . _db_type ) ] = v <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBModule . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBModule ( self . _db_id , <EOL> self . _db_cache , <EOL> self . _db_name , <EOL> self . _db_namespace , <EOL> self . _db_package , <EOL> self . _db_version , <EOL> self . _db_tag ) <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> cp . db_functions_id_index = dict ( ( v . _db_id , v ) for v in cp . _db_functions ) <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 . _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> if self . _db_location is not None : <EOL> children . extend ( self . _db_location . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_functions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_portSpecs : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> if orphan : <EOL> for child in self . _db_functions [ : ] : <EOL> self . db_delete_function ( child ) <EOL> for child in self . _db_annotations [ : ] : <EOL> self . db_delete_annotation ( child ) <EOL> for child in self . _db_portSpecs [ : ] : <EOL> self . db_delete_portSpec ( child ) <EOL> self . _db_location = None <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_location ) <EOL> children . extend ( self . db_deleted_functions ) <EOL> children . extend ( self . db_deleted_annotations ) <EOL> children . extend ( self . db_deleted_portSpecs ) <EOL> if remove : <EOL> self . db_deleted_location = [ ] <EOL> self . db_deleted_functions = [ ] <EOL> self . db_deleted_annotations = [ ] <EOL> self . db_deleted_portSpecs = [ ] <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_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_namespace ( self ) : <EOL> return self . _db_namespace <EOL> def __set_db_namespace ( self , namespace ) : <EOL> self . _db_namespace = namespace <EOL> self . is_dirty = True <EOL> db_namespace = property ( __get_db_namespace , __set_db_namespace ) <EOL> def db_add_namespace ( self , namespace ) : <EOL> self . _db_namespace = namespace <EOL> def db_change_namespace ( self , namespace ) : <EOL> self . _db_namespace = namespace <EOL> def db_delete_namespace ( self , namespace ) : <EOL> self . _db_namespace = 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_tag ( self ) : <EOL> return self . _db_tag <EOL> def __set_db_tag ( self , tag ) : <EOL> self . _db_tag = tag <EOL> self . is_dirty = True <EOL> db_tag = property ( __get_db_tag , __set_db_tag ) <EOL> def db_add_tag ( self , tag ) : <EOL> self . _db_tag = tag <EOL> def db_change_tag ( self , tag ) : <EOL> self . _db_tag = tag <EOL> def db_delete_tag ( self , tag ) : <EOL> self . _db_tag = 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> if not self . is_new : <EOL> self . db_deleted_location . append ( self . _db_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> if not self . _db_functions [ i ] . is_new : <EOL> self . db_deleted_functions . append ( self . _db_functions [ i ] ) <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 key in self . db_functions_id_index <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> if not self . _db_annotations [ i ] . is_new : <EOL> self . db_deleted_annotations . append ( self . _db_annotations [ i ] ) <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 key in self . db_annotations_id_index <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 key in self . db_annotations_key_index <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 . _db_type ) ] = 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 . _db_type ) ] = 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> if not self . _db_portSpecs [ i ] . is_new : <EOL> self . db_deleted_portSpecs . append ( self . _db_portSpecs [ i ] ) <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 , portSpec . _db_type ) ] <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 key in self . db_portSpecs_id_index <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 key in self . db_portSpecs_name_index <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> return DBTag . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBTag ( self . _db_id , <EOL> self . _db_name ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT:action>' , self . _db_id ) in id_remap : <EOL> cp . _db_id = id_remap [ ( '<STR_LIT:action>' , self . _db_id ) ] <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 = [ ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ] <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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> return DBPort . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBPort ( self . _db_id , <EOL> self . _db_type , <EOL> self . _db_moduleId , <EOL> self . _db_moduleName , <EOL> self . _db_name , <EOL> self . _db_spec ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_moduleId ) in id_remap : <EOL> cp . _db_moduleId = id_remap [ ( '<STR_LIT>' , self . _db_moduleId ) ] <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 = [ ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ] <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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 DBGroup ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , workflow = None , cache = None , name = None , namespace = None , package = None , version = None , tag = None , location = None , functions = None , annotations = None ) : <EOL> self . _db_id = id <EOL> self . db_deleted_workflow = [ ] <EOL> self . _db_workflow = workflow <EOL> self . _db_cache = cache <EOL> self . _db_name = name <EOL> self . _db_namespace = namespace <EOL> self . _db_package = package <EOL> self . _db_version = version <EOL> self . _db_tag = tag <EOL> self . db_deleted_location = [ ] <EOL> self . _db_location = location <EOL> self . db_deleted_functions = [ ] <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_deleted_annotations = [ ] <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 . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBGroup . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBGroup ( self . _db_id , <EOL> self . _db_workflow and self . _db_workflow . do_copy ( new_ids , id_scope , id_remap ) , <EOL> self . _db_cache , <EOL> self . _db_name , <EOL> self . _db_namespace , <EOL> self . _db_package , <EOL> self . _db_version , <EOL> self . _db_tag ) <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 new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> cp . db_functions_id_index = dict ( ( v . _db_id , v ) for v in cp . _db_functions ) <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> 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> for child in self . _db_functions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> if orphan : <EOL> self . _db_location = None <EOL> for child in self . _db_functions [ : ] : <EOL> self . db_delete_function ( child ) <EOL> for child in self . _db_annotations [ : ] : <EOL> self . db_delete_annotation ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_workflow ) <EOL> children . extend ( self . db_deleted_location ) <EOL> children . extend ( self . db_deleted_functions ) <EOL> children . extend ( self . db_deleted_annotations ) <EOL> if remove : <EOL> self . db_deleted_workflow = [ ] <EOL> self . db_deleted_location = [ ] <EOL> self . db_deleted_functions = [ ] <EOL> self . db_deleted_annotations = [ ] <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <EOL> return True <EOL> if self . _db_workflow is not None and self . _db_workflow . has_changes ( ) : <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> 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 ( self ) : <EOL> return self . _db_workflow <EOL> def __set_db_workflow ( self , workflow ) : <EOL> self . _db_workflow = workflow <EOL> self . is_dirty = True <EOL> db_workflow = property ( __get_db_workflow , __set_db_workflow ) <EOL> def db_add_workflow ( self , workflow ) : <EOL> self . _db_workflow = workflow <EOL> def db_change_workflow ( self , workflow ) : <EOL> self . _db_workflow = workflow <EOL> def db_delete_workflow ( self , workflow ) : <EOL> if not self . is_new : <EOL> self . db_deleted_workflow . append ( self . _db_workflow ) <EOL> self . _db_workflow = 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_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_namespace ( self ) : <EOL> return self . _db_namespace <EOL> def __set_db_namespace ( self , namespace ) : <EOL> self . _db_namespace = namespace <EOL> self . is_dirty = True <EOL> db_namespace = property ( __get_db_namespace , __set_db_namespace ) <EOL> def db_add_namespace ( self , namespace ) : <EOL> self . _db_namespace = namespace <EOL> def db_change_namespace ( self , namespace ) : <EOL> self . _db_namespace = namespace <EOL> def db_delete_namespace ( self , namespace ) : <EOL> self . _db_namespace = 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_tag ( self ) : <EOL> return self . _db_tag <EOL> def __set_db_tag ( self , tag ) : <EOL> self . _db_tag = tag <EOL> self . is_dirty = True <EOL> db_tag = property ( __get_db_tag , __set_db_tag ) <EOL> def db_add_tag ( self , tag ) : <EOL> self . _db_tag = tag <EOL> def db_change_tag ( self , tag ) : <EOL> self . _db_tag = tag <EOL> def db_delete_tag ( self , tag ) : <EOL> self . _db_tag = 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> if not self . is_new : <EOL> self . db_deleted_location . append ( self . _db_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> if not self . _db_functions [ i ] . is_new : <EOL> self . db_deleted_functions . append ( self . _db_functions [ i ] ) <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 key in self . db_functions_id_index <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> if not self . _db_annotations [ i ] . is_new : <EOL> self . db_deleted_annotations . append ( self . _db_annotations [ i ] ) <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 key in self . db_annotations_id_index <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 key in self . db_annotations_key_index <EOL> def getPrimaryKey ( self ) : <EOL> return self . _db_id <EOL> class DBLog ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , entity_type = None , version = None , name = None , last_modified = None , workflow_execs = None , machines = None , vistrail_id = None ) : <EOL> self . _db_id = id <EOL> self . _db_entity_type = entity_type <EOL> self . _db_version = version <EOL> self . _db_name = name <EOL> self . _db_last_modified = last_modified <EOL> self . db_deleted_workflow_execs = [ ] <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_deleted_machines = [ ] <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 . _db_vistrail_id = vistrail_id <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBLog . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBLog ( self . _db_id , <EOL> self . _db_entity_type , <EOL> self . _db_version , <EOL> self . _db_name , <EOL> self . _db_last_modified ) <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> cp . _db_vistrail_id = self . _db_vistrail_id <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_vistrail_id ) in id_remap : <EOL> cp . _db_vistrail_id = id_remap [ ( '<STR_LIT>' , self . _db_vistrail_id ) ] <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . _db_deleted_workflow_execs ) <EOL> children . extend ( self . _db_deleted_machines ) <EOL> if remove : <EOL> self . db_deleted_workflow_execs = [ ] <EOL> self . db_deleted_machines = [ ] <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_entity_type ( self ) : <EOL> return self . _db_entity_type <EOL> def __set_db_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> self . is_dirty = True <EOL> db_entity_type = property ( __get_db_entity_type , __set_db_entity_type ) <EOL> def db_add_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_change_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_delete_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = 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_last_modified ( self ) : <EOL> return self . _db_last_modified <EOL> def __set_db_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> self . is_dirty = True <EOL> db_last_modified = property ( __get_db_last_modified , __set_db_last_modified ) <EOL> def db_add_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_change_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_delete_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = 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> if not self . _db_workflow_execs [ i ] . is_new : <EOL> self . db_deleted_workflow_execs . append ( self . _db_workflow_execs [ i ] ) <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 key in self . db_workflow_execs_id_index <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> if not self . _db_machines [ i ] . is_new : <EOL> self . db_deleted_machines . append ( self . _db_machines [ i ] ) <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 key in self . db_machines_id_index <EOL> def __get_db_vistrail_id ( self ) : <EOL> return self . _db_vistrail_id <EOL> def __set_db_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = vistrail_id <EOL> self . is_dirty = True <EOL> db_vistrail_id = property ( __get_db_vistrail_id , __set_db_vistrail_id ) <EOL> def db_add_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = vistrail_id <EOL> def db_change_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = vistrail_id <EOL> def db_delete_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = None <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 ) : <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 . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBMachine . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBMachine ( self . _db_id , <EOL> self . _db_name , <EOL> self . _db_os , <EOL> self . _db_architecture , <EOL> self . _db_processor , <EOL> self . _db_ram ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_vistrailId ) in id_remap : <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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_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 getPrimaryKey ( self ) : <EOL> return self . _db_id <EOL> class DBAdd ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , data = None , id = None , what = None , objectId = None , parentObjId = None , parentObjType = None ) : <EOL> self . db_deleted_data = [ ] <EOL> self . _db_data = data <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> return DBAdd . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAdd ( self . _db_data and self . _db_data . do_copy ( new_ids , id_scope , id_remap ) , <EOL> self . _db_id , <EOL> self . _db_what , <EOL> self . _db_objectId , <EOL> self . _db_parentObjId , <EOL> self . _db_parentObjType ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_what , self . _db_objectId ) in id_remap : <EOL> cp . _db_objectId = id_remap [ ( self . _db_what , self . _db_objectId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_parentObjType , self . _db_parentObjId ) in id_remap : <EOL> cp . _db_parentObjId = id_remap [ ( self . _db_parentObjType , self . _db_parentObjId ) ] <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_data ) <EOL> if remove : <EOL> self . db_deleted_data = [ ] <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_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> if not self . is_new : <EOL> self . db_deleted_data . append ( self . _db_data ) <EOL> self . _db_data = None <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 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> return DBOther . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBOther ( self . _db_id , <EOL> self . _db_key , <EOL> self . _db_value ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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> return DBLocation . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBLocation ( self . _db_id , <EOL> self . _db_x , <EOL> self . _db_y ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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 = [ ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ] <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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 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> return DBParameter . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBParameter ( self . _db_id , <EOL> self . _db_pos , <EOL> self . _db_name , <EOL> self . _db_type , <EOL> self . _db_val , <EOL> self . _db_alias ) <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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 = [ ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ] <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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 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_deleted_parameters = [ ] <EOL> if parameters is None : <EOL> self . _db_parameters = [ ] <EOL> self . db_parameters_id_index = { } <EOL> else : <EOL> self . _db_parameters = parameters <EOL> self . db_parameters_id_index = dict ( ( v . _db_id , v ) <EOL> for v in <EOL> self . _db_parameters ) <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBFunction . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBFunction ( self . _db_id , <EOL> self . _db_pos , <EOL> 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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> cp . db_parameters_id_index = dict ( ( v . _db_id , v ) <EOL> for v in <EOL> cp . _db_parameters ) <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> for child in self . _db_parameters : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> if orphan : <EOL> for child in self . _db_parameters [ : ] : <EOL> self . db_delete_parameter ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_parameters ) <EOL> if remove : <EOL> self . db_deleted_parameters = [ ] <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> if not self . _db_parameters [ i ] . is_new : <EOL> self . db_deleted_parameters . append ( self . _db_parameters [ i ] ) <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> try : <EOL> return self . db_parameters_id_index [ key ] <EOL> except KeyError : <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 key in self . db_parameters_id_index <EOL> def getPrimaryKey ( self ) : <EOL> return self . _db_id <EOL> class DBAbstraction ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , entity_type = None , name = None , last_modified = None , actions = None , tags = None ) : <EOL> self . _db_id = id <EOL> self . _db_entity_type = entity_type <EOL> self . _db_name = name <EOL> self . _db_last_modified = last_modified <EOL> self . db_deleted_actions = [ ] <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_deleted_tags = [ ] <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> return DBAbstraction . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAbstraction ( self . _db_id , <EOL> self . _db_entity_type , <EOL> self . _db_name , <EOL> self . _db_last_modified ) <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_actions ) <EOL> children . extend ( self . db_deleted_tags ) <EOL> if remove : <EOL> self . db_deleted_actions = [ ] <EOL> self . db_deleted_tags = [ ] <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_entity_type ( self ) : <EOL> return self . _db_entity_type <EOL> def __set_db_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> self . is_dirty = True <EOL> db_entity_type = property ( __get_db_entity_type , __set_db_entity_type ) <EOL> def db_add_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_change_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_delete_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = 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_last_modified ( self ) : <EOL> return self . _db_last_modified <EOL> def __set_db_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> self . is_dirty = True <EOL> db_last_modified = property ( __get_db_last_modified , __set_db_last_modified ) <EOL> def db_add_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_change_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_delete_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = 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> if not self . _db_actions [ i ] . is_new : <EOL> self . db_deleted_actions . append ( self . _db_actions [ i ] ) <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 key in self . db_actions_id_index <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> if not self . _db_tags [ i ] . is_new : <EOL> self . db_deleted_tags . append ( self . _db_tags [ i ] ) <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 key in self . db_tags_id_index <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 key in self . db_tags_name_index <EOL> def getPrimaryKey ( self ) : <EOL> return self . _db_id <EOL> class DBWorkflow ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , modules = None , id = None , entity_type = None , name = None , version = None , last_modified = None , connections = None , annotations = None , abstractions = None , others = None , vistrail_id = None ) : <EOL> self . db_deleted_modules = [ ] <EOL> self . db_modules_id_index = { } <EOL> self . db_modules_inverted_id_index = { } <EOL> if modules is None : <EOL> self . _db_modules = [ ] <EOL> else : <EOL> self . _db_modules = modules <EOL> for i , v in enumerate ( self . _db_modules ) : <EOL> self . db_modules_id_index [ v . _db_id ] = v <EOL> self . db_modules_inverted_id_index [ v . _db_id ] = i <EOL> self . _db_id = id <EOL> self . _db_entity_type = entity_type <EOL> self . _db_name = name <EOL> self . _db_version = version <EOL> self . _db_last_modified = last_modified <EOL> self . db_deleted_connections = [ ] <EOL> self . db_connections_id_index = { } <EOL> self . db_connections_inverted_id_index = { } <EOL> if connections is None : <EOL> self . _db_connections = [ ] <EOL> else : <EOL> self . _db_connections = connections <EOL> for i , v in enumerate ( self . _db_connections ) : <EOL> self . db_connections_id_index [ v . _db_id ] = v <EOL> self . db_connections_inverted_id_index [ v . _db_id ] = i <EOL> self . db_deleted_annotations = [ ] <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_deleted_abstractions = [ ] <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 . db_deleted_others = [ ] <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_vistrail_id = vistrail_id <EOL> self . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBWorkflow . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBWorkflow ( ) <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> cp . _db_id = self . _db_id <EOL> cp . _db_entity_type = self . _db_entity_type <EOL> cp . _db_name = self . _db_name <EOL> cp . _db_version = self . _db_version <EOL> cp . _db_last_modified = self . _db_last_modified <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_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 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> cp . _db_vistrail_id = self . _db_vistrail_id <EOL> if new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_vistrail_id ) in id_remap : <EOL> cp . _db_vistrail_id = id_remap [ ( '<STR_LIT>' , self . _db_vistrail_id ) ] <EOL> for i , v in enumerate ( cp . _db_modules ) : <EOL> cp . db_modules_id_index [ v . _db_id ] = v <EOL> cp . db_modules_inverted_id_index [ v . _db_id ] = i <EOL> for i , v in enumerate ( cp . _db_connections ) : <EOL> cp . db_connections_id_index [ v . _db_id ] = v <EOL> cp . db_connections_inverted_id_index [ v . _db_id ] = i <EOL> for v in cp . _db_annotations : <EOL> cp . db_annotations_id_index [ v . _db_id ] = v <EOL> for v in cp . _db_abstractions : <EOL> cp . db_abstractions_id_index [ v . _db_id ] = v <EOL> for v in cp . _db_others : <EOL> cp . db_others_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> for child in self . _db_connections : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_annotations : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_abstractions : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_others : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> for child in self . _db_modules : <EOL> children . extend ( child . db_children ( ( self . vtType , self . _db_id ) , orphan ) ) <EOL> if orphan : <EOL> for child in self . _db_connections [ : ] : <EOL> self . db_delete_connection ( child ) <EOL> for child in self . _db_annotations [ : ] : <EOL> self . db_delete_annotation ( child ) <EOL> for child in self . _db_abstractions [ : ] : <EOL> self . db_delete_abstraction ( child ) <EOL> for child in self . _db_others [ : ] : <EOL> self . db_delete_other ( child ) <EOL> for child in self . _db_modules [ : ] : <EOL> self . db_delete_module ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_connections ) <EOL> children . extend ( self . db_deleted_annotations ) <EOL> children . extend ( self . db_deleted_abstractions ) <EOL> children . extend ( self . db_deleted_others ) <EOL> children . extend ( self . db_deleted_modules ) <EOL> if remove : <EOL> self . db_deleted_connections = [ ] <EOL> self . db_deleted_annotations = [ ] <EOL> self . db_deleted_abstractions = [ ] <EOL> self . db_deleted_others = [ ] <EOL> self . db_deleted_modules = [ ] <EOL> return children <EOL> def has_changes ( self ) : <EOL> if self . is_dirty : <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_abstractions : <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_modules : <EOL> if child . has_changes ( ) : <EOL> return True <EOL> return False <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_inverted_id_index [ module . _db_id ] = len ( self . _db_modules ) <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> try : <EOL> i = self . db_modules_inverted_id_index [ module . _db_id ] <EOL> except KeyError : <EOL> found = False <EOL> for i in xrange ( len ( self . _db_modules ) ) : <EOL> if self . _db_modules [ i ] . _db_id == module . _db_id : <EOL> found = True <EOL> break <EOL> if not found : <EOL> self . db_add_module ( module ) <EOL> return <EOL> self . _db_modules [ i ] = module <EOL> self . db_modules_id_index [ module . _db_id ] = module <EOL> def db_delete_module ( self , module ) : <EOL> self . is_dirty = True <EOL> try : <EOL> i = self . db_modules_inverted_id_index [ module . _db_id ] <EOL> except KeyError : <EOL> for i in xrange ( len ( self . _db_modules ) ) : <EOL> if self . _db_modules [ i ] . _db_id == module . _db_id : <EOL> break <EOL> if not self . _db_modules [ i ] . is_new : <EOL> self . db_deleted_modules . append ( self . _db_modules [ i ] ) <EOL> for m in self . _db_modules [ i + <NUM_LIT:1> : ] : <EOL> self . db_modules_inverted_id_index [ m . _db_id ] -= <NUM_LIT:1> <EOL> del self . _db_modules [ i ] <EOL> del self . db_modules_id_index [ module . _db_id ] <EOL> del self . db_modules_inverted_id_index [ module . _db_id ] <EOL> def db_get_module ( self , key ) : <EOL> try : <EOL> return self . db_modules_id_index [ key ] <EOL> except KeyError : <EOL> for module in self . _db_modules : <EOL> if module . _db_id == key : <EOL> return module <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 key in self . db_modules_id_index <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_entity_type ( self ) : <EOL> return self . _db_entity_type <EOL> def __set_db_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> self . is_dirty = True <EOL> db_entity_type = property ( __get_db_entity_type , __set_db_entity_type ) <EOL> def db_add_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_change_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_delete_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = 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_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_last_modified ( self ) : <EOL> return self . _db_last_modified <EOL> def __set_db_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> self . is_dirty = True <EOL> db_last_modified = property ( __get_db_last_modified , __set_db_last_modified ) <EOL> def db_add_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_change_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_delete_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = None <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_inverted_id_index [ connection . _db_id ] = len ( self . _db_connections ) <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> try : <EOL> i = self . db_connections_inverted_id_index [ connection . _db_id ] <EOL> except KeyError : <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_add_connection ( connection ) <EOL> return <EOL> self . _db_connections [ i ] = connection <EOL> self . db_connections_id_index [ connection . _db_id ] = connection <EOL> def db_delete_connection ( self , connection ) : <EOL> self . is_dirty = True <EOL> try : <EOL> i = self . db_connections_inverted_id_index [ connection . _db_id ] <EOL> except KeyError : <EOL> for i in xrange ( len ( self . _db_connections ) ) : <EOL> if self . _db_connections [ i ] . _db_id == connection . _db_id : <EOL> break <EOL> if not self . _db_connections [ i ] . is_new : <EOL> self . db_deleted_connections . append ( self . _db_connections [ i ] ) <EOL> for conn in self . _db_connections [ i + <NUM_LIT:1> : ] : <EOL> self . db_connections_inverted_id_index [ conn . _db_id ] -= <NUM_LIT:1> <EOL> del self . _db_connections [ i ] <EOL> del self . db_connections_id_index [ connection . _db_id ] <EOL> del self . db_connections_inverted_id_index [ connection . _db_id ] <EOL> def db_get_connection ( self , key ) : <EOL> try : <EOL> return self . db_connections_id_index [ key ] <EOL> except KeyError : <EOL> for connection in self . _db_connections : <EOL> if connection . _db_id == key : <EOL> return connection <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 key in self . db_connections_id_index <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> if not self . _db_annotations [ i ] . is_new : <EOL> self . db_deleted_annotations . append ( self . _db_annotations [ i ] ) <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 key in self . db_annotations_id_index <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> if not self . _db_abstractions [ i ] . is_new : <EOL> self . db_deleted_abstractions . append ( self . _db_abstractions [ i ] ) <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 key in self . db_abstractions_id_index <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> if not self . _db_others [ i ] . is_new : <EOL> self . db_deleted_others . append ( self . _db_others [ i ] ) <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 key in self . db_others_id_index <EOL> def __get_db_vistrail_id ( self ) : <EOL> return self . _db_vistrail_id <EOL> def __set_db_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = vistrail_id <EOL> self . is_dirty = True <EOL> db_vistrail_id = property ( __get_db_vistrail_id , __set_db_vistrail_id ) <EOL> def db_add_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = vistrail_id <EOL> def db_change_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = vistrail_id <EOL> def db_delete_vistrail_id ( self , vistrail_id ) : <EOL> self . _db_vistrail_id = None <EOL> def getPrimaryKey ( self ) : <EOL> return self . _db_id <EOL> class DBAbstractionRef ( object ) : <EOL> vtType = '<STR_LIT>' <EOL> def __init__ ( self , id = None , name = None , cache = None , abstraction_id = None , version = None , location = None , functions = None , annotations = None ) : <EOL> self . _db_id = id <EOL> self . _db_name = name <EOL> self . _db_cache = cache <EOL> self . _db_abstraction_id = abstraction_id <EOL> self . _db_version = version <EOL> self . db_deleted_location = [ ] <EOL> self . _db_location = location <EOL> self . db_deleted_functions = [ ] <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_deleted_annotations = [ ] <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 . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBAbstractionRef . do_copy ( self ) <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_name = self . _db_name <EOL> cp . _db_cache = self . _db_cache <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 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 new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_abstraction_id ) in id_remap : <EOL> cp . _db_abstraction_id = id_remap [ ( '<STR_LIT>' , self . _db_abstraction_id ) ] <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> 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> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_location ) <EOL> children . extend ( self . db_deleted_functions ) <EOL> children . extend ( self . db_deleted_annotations ) <EOL> if remove : <EOL> self . db_deleted_location = [ ] <EOL> self . db_deleted_functions = [ ] <EOL> self . db_deleted_annotations = [ ] <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> 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_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_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> if not self . is_new : <EOL> self . db_deleted_location . append ( self . _db_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> if not self . _db_functions [ i ] . is_new : <EOL> self . db_deleted_functions . append ( self . _db_functions [ i ] ) <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 key in self . db_functions_id_index <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> if not self . _db_annotations [ i ] . is_new : <EOL> self . db_deleted_annotations . append ( self . _db_annotations [ i ] ) <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 key in self . db_annotations_id_index <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 key in self . db_annotations_key_index <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> return DBAnnotation . do_copy ( self ) <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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 , data = None , id = None , what = None , oldObjId = None , newObjId = None , parentObjId = None , parentObjType = None ) : <EOL> self . db_deleted_data = [ ] <EOL> self . _db_data = data <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 . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBChange . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBChange ( ) <EOL> if self . _db_data is not None : <EOL> cp . _db_data = self . _db_data . do_copy ( new_ids , id_scope , id_remap ) <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 new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_what , self . _db_oldObjId ) in id_remap : <EOL> cp . _db_oldObjId = id_remap [ ( self . _db_what , self . _db_oldObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_what , self . _db_newObjId ) in id_remap : <EOL> cp . _db_newObjId = id_remap [ ( self . _db_what , self . _db_newObjId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_parentObjType , self . _db_parentObjId ) in id_remap : <EOL> cp . _db_parentObjId = id_remap [ ( self . _db_parentObjType , self . _db_parentObjId ) ] <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_data ) <EOL> if remove : <EOL> self . db_deleted_data = [ ] <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_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> if not self . is_new : <EOL> self . db_deleted_data . append ( self . _db_data ) <EOL> self . _db_data = None <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 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_deleted_module_execs = [ ] <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> return DBWorkflowExec . do_copy ( self ) <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_module_execs ) <EOL> if remove : <EOL> self . db_deleted_module_execs = [ ] <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> if not self . _db_module_execs [ i ] . is_new : <EOL> self . db_deleted_module_execs . append ( self . _db_module_execs [ i ] ) <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 key in self . db_module_execs_id_index <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_deleted_ports = [ ] <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> return DBConnection . do_copy ( self ) <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <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> for child in self . _db_ports [ : ] : <EOL> self . db_delete_port ( child ) <EOL> children . append ( ( self , parent [ <NUM_LIT:0> ] , parent [ <NUM_LIT:1> ] ) ) <EOL> return children <EOL> def db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_ports ) <EOL> if remove : <EOL> self . db_deleted_ports = [ ] <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> if not self . _db_ports [ i ] . is_new : <EOL> self . db_deleted_ports . append ( self . _db_ports [ i ] ) <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> try : <EOL> return self . db_ports_id_index [ key ] <EOL> except KeyError : <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 key in self . db_ports_id_index <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 key in self . db_ports_type_index <EOL> def getPrimaryKey ( self ) : <EOL> return self . _db_id <EOL> class DBAction ( object ) : <EOL> vtType = '<STR_LIT:action>' <EOL> def __init__ ( self , operations = None , id = None , prevId = None , date = None , session = None , user = None , prune = None , annotations = None ) : <EOL> self . db_deleted_operations = [ ] <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 . _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_deleted_annotations = [ ] <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 . is_dirty = True <EOL> self . is_new = True <EOL> def __copy__ ( self ) : <EOL> return DBAction . do_copy ( self ) <EOL> def do_copy ( self , new_ids = False , id_scope = None , id_remap = None ) : <EOL> cp = DBAction ( ) <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> 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 new_ids : <EOL> new_id = id_scope . getNewId ( self . vtType ) <EOL> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> for v in cp . _db_operations : <EOL> cp . db_operations_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> 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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_annotations ) <EOL> children . extend ( self . db_deleted_operations ) <EOL> if remove : <EOL> self . db_deleted_annotations = [ ] <EOL> self . db_deleted_operations = [ ] <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_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> if not self . _db_operations [ i ] . is_new : <EOL> self . db_deleted_operations . append ( self . _db_operations [ i ] ) <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 key in self . db_operations_id_index <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> if not self . _db_annotations [ i ] . is_new : <EOL> self . db_deleted_annotations . append ( self . _db_annotations [ i ] ) <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 key in self . db_annotations_id_index <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 key in self . db_annotations_key_index <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> return DBDelete . do_copy ( self ) <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_what , self . _db_objectId ) in id_remap : <EOL> cp . _db_objectId = id_remap [ ( self . _db_what , self . _db_objectId ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and ( self . _db_parentObjType , self . _db_parentObjId ) in id_remap : <EOL> cp . _db_parentObjId = id_remap [ ( self . _db_parentObjType , self . _db_parentObjId ) ] <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <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 , entity_type = None , version = None , name = None , last_modified = None , dbHost = None , dbPort = None , dbName = None , actions = None , tags = None , abstractions = None ) : <EOL> self . _db_id = id <EOL> self . _db_entity_type = entity_type <EOL> self . _db_version = version <EOL> self . _db_name = name <EOL> self . _db_last_modified = last_modified <EOL> self . _db_dbHost = dbHost <EOL> self . _db_dbPort = dbPort <EOL> self . _db_dbName = dbName <EOL> self . db_deleted_actions = [ ] <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_deleted_tags = [ ] <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_deleted_abstractions = [ ] <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> return DBVistrail . do_copy ( self ) <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_entity_type = self . _db_entity_type <EOL> cp . _db_version = self . _db_version <EOL> cp . _db_name = self . _db_name <EOL> cp . _db_last_modified = self . _db_last_modified <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_actions ) <EOL> children . extend ( self . db_deleted_tags ) <EOL> children . extend ( self . db_deleted_abstractions ) <EOL> if remove : <EOL> self . db_deleted_actions = [ ] <EOL> self . db_deleted_tags = [ ] <EOL> self . db_deleted_abstractions = [ ] <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_entity_type ( self ) : <EOL> return self . _db_entity_type <EOL> def __set_db_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> self . is_dirty = True <EOL> db_entity_type = property ( __get_db_entity_type , __set_db_entity_type ) <EOL> def db_add_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_change_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = entity_type <EOL> def db_delete_entity_type ( self , entity_type ) : <EOL> self . _db_entity_type = 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_last_modified ( self ) : <EOL> return self . _db_last_modified <EOL> def __set_db_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> self . is_dirty = True <EOL> db_last_modified = property ( __get_db_last_modified , __set_db_last_modified ) <EOL> def db_add_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_change_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = last_modified <EOL> def db_delete_last_modified ( self , last_modified ) : <EOL> self . _db_last_modified = 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> if not self . _db_actions [ i ] . is_new : <EOL> self . db_deleted_actions . append ( self . _db_actions [ i ] ) <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 key in self . db_actions_id_index <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> if not self . _db_tags [ i ] . is_new : <EOL> self . db_deleted_tags . append ( self . _db_tags [ i ] ) <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 key in self . db_tags_id_index <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 key in self . db_tags_name_index <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> if not self . _db_abstractions [ i ] . is_new : <EOL> self . db_deleted_abstractions . append ( self . _db_abstractions [ i ] ) <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 key in self . db_abstractions_id_index <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 , cached = None , module_id = None , module_name = None , completed = None , abstraction_id = None , abstraction_version = None , machine_id = 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_cached = cached <EOL> self . _db_module_id = module_id <EOL> self . _db_module_name = module_name <EOL> self . _db_completed = completed <EOL> self . _db_abstraction_id = abstraction_id <EOL> self . _db_abstraction_version = abstraction_version <EOL> self . _db_machine_id = machine_id <EOL> self . db_deleted_annotations = [ ] <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> return DBModuleExec . do_copy ( self ) <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_cached = self . _db_cached <EOL> cp . _db_module_id = self . _db_module_id <EOL> cp . _db_module_name = self . _db_module_name <EOL> cp . _db_completed = self . _db_completed <EOL> cp . _db_abstraction_id = self . _db_abstraction_id <EOL> cp . _db_abstraction_version = self . _db_abstraction_version <EOL> cp . _db_machine_id = self . _db_machine_id <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> if self . vtType in id_scope . remap : <EOL> id_remap [ ( id_scope . remap [ self . vtType ] , self . _db_id ) ] = new_id <EOL> else : <EOL> id_remap [ ( self . vtType , self . _db_id ) ] = new_id <EOL> cp . _db_id = new_id <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_module_id ) in id_remap : <EOL> cp . _db_module_id = id_remap [ ( '<STR_LIT>' , self . _db_module_id ) ] <EOL> if hasattr ( self , '<STR_LIT>' ) and ( '<STR_LIT>' , self . _db_machine_id ) in id_remap : <EOL> cp . _db_machine_id = id_remap [ ( '<STR_LIT>' , self . _db_machine_id ) ] <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 db_deleted_children ( self , remove = False ) : <EOL> children = [ ] <EOL> children . extend ( self . db_deleted_annotations ) <EOL> if remove : <EOL> self . db_deleted_annotations = [ ] <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_cached ( self ) : <EOL> return self . _db_cached <EOL> def __set_db_cached ( self , cached ) : <EOL> self . _db_cached = cached <EOL> self . is_dirty = True <EOL> db_cached = property ( __get_db_cached , __set_db_cached ) <EOL> def db_add_cached ( self , cached ) : <EOL> self . _db_cached = cached <EOL> def db_change_cached ( self , cached ) : <EOL> self . _db_cached = cached <EOL> def db_delete_cached ( self , cached ) : <EOL> self . _db_cached = 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_completed ( self ) : <EOL> return self . _db_completed <EOL> def __set_db_completed ( self , completed ) : <EOL> self . _db_completed = completed <EOL> self . is_dirty = True <EOL> db_completed = property ( __get_db_completed , __set_db_completed ) <EOL> def db_add_completed ( self , completed ) : <EOL> self . _db_completed = completed <EOL> def db_change_completed ( self , completed ) : <EOL> self . _db_completed = completed <EOL> def db_delete_completed ( self , completed ) : <EOL> self . _db_completed = 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_abstraction_version ( self ) : <EOL> return self . _db_abstraction_version <EOL> def __set_db_abstraction_version ( self , abstraction_version ) : <EOL> self . _db_abstraction_version = abstraction_version <EOL> self . is_dirty = True <EOL> db_abstraction_version = property ( __get_db_abstraction_version , __set_db_abstraction_version ) <EOL> def db_add_abstraction_version ( self , abstraction_version ) : <EOL> self . _db_abstraction_version = abstraction_version <EOL> def db_change_abstraction_version ( self , abstraction_version ) : <EOL> self . _db_abstraction_version = abstraction_version <EOL> def db_delete_abstraction_version ( self , abstraction_version ) : <EOL> self . _db_abstraction_version = None <EOL> def __get_db_machine_id ( self ) : <EOL> return self . _db_machine_id <EOL> def __set_db_machine_id ( self , machine_id ) : <EOL> self . _db_machine_id = machine_id <EOL> self . is_dirty = True <EOL> db_machine_id = property ( __get_db_machine_id , __set_db_machine_id ) <EOL> def db_add_machine_id ( self , machine_id ) : <EOL> self . _db_machine_id = machine_id <EOL> def db_change_machine_id ( self , machine_id ) : <EOL> self . _db_machine_id = machine_id <EOL> def db_delete_machine_id ( self , machine_id ) : <EOL> self . _db_machine_id = 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> if not self . _db_annotations [ i ] . is_new : <EOL> self . db_deleted_annotations . append ( self . _db_annotations [ i ] ) <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 key in self . db_annotations_id_index <EOL> def getPrimaryKey ( self ) : <EOL> return self . _db_id </s>
