<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from xml_dao import XMLDAO <EOL> from vistrails . db . versions . v0_6_0 . domain import * <EOL> class DBPortSpecXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> type = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:type>' ) , '<STR_LIT:str>' ) <EOL> spec = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> obj = DBPortSpec ( id = id , <EOL> name = name , <EOL> type = type , <EOL> spec = spec ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , portSpec , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( portSpec . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( portSpec . db_name , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT:type>' , self . convertToStr ( portSpec . db_type , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( portSpec . db_spec , '<STR_LIT:str>' ) ) <EOL> return node <EOL> class DBModuleXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> functions = [ ] <EOL> annotations = { } <EOL> portSpecs = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> cache = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:int>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> package = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> version = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:version>' ) , '<STR_LIT:str>' ) <EOL> location = None <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT:location>' : <EOL> location = self . getDao ( '<STR_LIT:location>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> function = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> functions . append ( function ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> annotation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> annotations [ annotation . db_id ] = annotation <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> portSpec = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> portSpecs [ portSpec . db_id ] = portSpec <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBModule ( id = id , <EOL> cache = cache , <EOL> name = name , <EOL> package = package , <EOL> version = version , <EOL> location = location , <EOL> functions = functions , <EOL> annotations = annotations , <EOL> portSpecs = portSpecs ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , module , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( module . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( module . db_cache , '<STR_LIT:int>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( module . db_name , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( module . db_package , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT:version>' , self . convertToStr ( module . db_version , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> location = module . db_location <EOL> if location is not None : <EOL> if nodeMap . has_key ( ( '<STR_LIT:location>' , location . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:location>' , location . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:location>' , location . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:location>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:location>' ) . toXML ( location , doc , childNode ) <EOL> functions = module . db_functions <EOL> for function in functions : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , function . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , function . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , function . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( function , doc , childNode ) <EOL> annotations = module . db_annotations <EOL> for annotation in annotations . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , annotation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( annotation , doc , childNode ) <EOL> portSpecs = module . db_portSpecs <EOL> for portSpec in portSpecs . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , portSpec . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , portSpec . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , portSpec . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( portSpec , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBTagXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> obj = DBTag ( id = id , <EOL> name = name ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , tag , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( tag . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( tag . db_name , '<STR_LIT:str>' ) ) <EOL> return node <EOL> class DBPortXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT:port>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> type = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:type>' ) , '<STR_LIT:str>' ) <EOL> moduleId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> moduleName = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> sig = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> obj = DBPort ( id = id , <EOL> type = type , <EOL> moduleId = moduleId , <EOL> moduleName = moduleName , <EOL> sig = sig ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , port , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT:port>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( port . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:type>' , self . convertToStr ( port . db_type , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( port . db_moduleId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( port . db_moduleName , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( port . db_sig , '<STR_LIT:str>' ) ) <EOL> return node <EOL> class DBLogXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> workflow_execs = { } <EOL> machines = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> workflow_exec = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> workflow_execs [ workflow_exec . db_id ] = workflow_exec <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> machine = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> machines [ machine . db_id ] = machine <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBLog ( id = id , <EOL> workflow_execs = workflow_execs , <EOL> machines = machines ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , log , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( log . db_id , '<STR_LIT>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> workflow_execs = log . db_workflow_execs <EOL> for workflow_exec in workflow_execs . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , workflow_exec . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , workflow_exec . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , workflow_exec . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( workflow_exec , doc , childNode ) <EOL> machines = log . db_machines <EOL> for machine in machines . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , machine . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , machine . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , machine . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( machine , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBMachineXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> module_execs = [ ] <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> os = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> architecture = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> processor = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> ram = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:int>' ) <EOL> obj = DBMachine ( id = id , <EOL> name = name , <EOL> os = os , <EOL> architecture = architecture , <EOL> processor = processor , <EOL> ram = ram , <EOL> module_execs = module_execs ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , machine , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( machine . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( machine . db_name , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( machine . db_os , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( machine . db_architecture , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( machine . db_processor , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( machine . db_ram , '<STR_LIT:int>' ) ) <EOL> return node <EOL> class DBAddXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> what = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> objectId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parentObjId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parentObjType = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> data = None <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT:location>' : <EOL> data = self . getDao ( '<STR_LIT:location>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT:port>' : <EOL> data = self . getDao ( '<STR_LIT:port>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBAdd ( id = id , <EOL> what = what , <EOL> objectId = objectId , <EOL> parentObjId = parentObjId , <EOL> parentObjType = parentObjType , <EOL> data = data ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , add , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( add . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( add . db_what , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( add . db_objectId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( add . db_parentObjId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( add . db_parentObjType , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> data = add . db_data <EOL> if data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT:location>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT:location>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:location>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:location>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:location>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:location>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT:port>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT:port>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:port>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:port>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:port>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:port>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBOtherXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> key = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:key>' ) , '<STR_LIT:str>' ) <EOL> value = None <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT:value>' : <EOL> value = self . convertFromStr ( child . firstChild . nodeValue , '<STR_LIT:str>' ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBOther ( id = id , <EOL> key = key , <EOL> value = value ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , other , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( other . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:key>' , self . convertToStr ( other . db_key , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> if other . db_value is not None : <EOL> child = other . db_value <EOL> if nodeMap . has_key ( ( '<STR_LIT:value>' , child . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:value>' , child . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:value>' , child . db_id ) ] <EOL> textNode = childNode . firstChild <EOL> textNode . replaceWholeText ( self . convertToStr ( child , '<STR_LIT:str>' ) ) <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:value>' ) <EOL> node . appendChild ( childNode ) <EOL> textNode = doc . createTextNode ( self . convertToStr ( child , '<STR_LIT:str>' ) ) <EOL> childNode . appendChild ( textNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBLocationXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT:location>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> x = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:x>' ) , '<STR_LIT:float>' ) <EOL> y = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:y>' ) , '<STR_LIT:float>' ) <EOL> obj = DBLocation ( id = id , <EOL> x = x , <EOL> y = y ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , location , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT:location>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( location . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:x>' , self . convertToStr ( location . db_x , '<STR_LIT:float>' ) ) <EOL> node . setAttribute ( '<STR_LIT:y>' , self . convertToStr ( location . db_y , '<STR_LIT:float>' ) ) <EOL> return node <EOL> class DBWorkflowExecXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> module_execs = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> user = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:user>' ) , '<STR_LIT:str>' ) <EOL> ip = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> vt_version = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> ts_start = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> ts_end = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parent_id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parent_type = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> parent_version = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> module_exec = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> module_execs [ module_exec . db_id ] = module_exec <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBWorkflowExec ( id = id , <EOL> user = user , <EOL> ip = ip , <EOL> vt_version = vt_version , <EOL> ts_start = ts_start , <EOL> ts_end = ts_end , <EOL> parent_id = parent_id , <EOL> parent_type = parent_type , <EOL> parent_version = parent_version , <EOL> name = name , <EOL> module_execs = module_execs ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , workflow_exec , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( workflow_exec . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:user>' , self . convertToStr ( workflow_exec . db_user , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_ip , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_vt_version , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_ts_start , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_ts_end , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_parent_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_parent_type , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( workflow_exec . db_parent_version , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( workflow_exec . db_name , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> module_execs = workflow_exec . db_module_execs <EOL> for module_exec in module_execs . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , module_exec . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , module_exec . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , module_exec . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( module_exec , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBFunctionXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> parameters = [ ] <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> pos = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> parameter = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> parameters . append ( parameter ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBFunction ( id = id , <EOL> pos = pos , <EOL> name = name , <EOL> parameters = parameters ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , function , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( function . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( function . db_pos , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( function . db_name , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> parameters = function . db_parameters <EOL> for parameter in parameters : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , parameter . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , parameter . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , parameter . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( parameter , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBAbstractionXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> actions = { } <EOL> tags = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT:action>' : <EOL> action = self . getDao ( '<STR_LIT:action>' ) . fromXML ( child ) <EOL> actions [ action . db_id ] = action <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> tag = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> tags [ tag . db_id ] = tag <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBAbstraction ( id = id , <EOL> name = name , <EOL> actions = actions , <EOL> tags = tags ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , abstraction , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( abstraction . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( abstraction . db_name , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> actions = abstraction . db_actions <EOL> for action in actions . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT:action>' , action . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:action>' , action . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:action>' , action . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:action>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:action>' ) . toXML ( action , doc , childNode ) <EOL> tags = abstraction . db_tags <EOL> for tag in tags . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , tag . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , tag . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , tag . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( tag , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBWorkflowXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> annotations = [ ] <EOL> others = [ ] <EOL> modules = { } <EOL> connections = { } <EOL> abstractionRefs = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> module = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> modules [ module . db_id ] = module <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> connection = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> connections [ connection . db_id ] = connection <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> annotation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> annotations . append ( annotation ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> other = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> others . append ( other ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> abstractionRef = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> abstractionRefs [ abstractionRef . db_id ] = abstractionRef <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBWorkflow ( id = id , <EOL> name = name , <EOL> modules = modules , <EOL> connections = connections , <EOL> annotations = annotations , <EOL> others = others , <EOL> abstractionRefs = abstractionRefs ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , workflow , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( workflow . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( workflow . db_name , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> modules = workflow . db_modules <EOL> for module in modules . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , module . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , module . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , module . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( module , doc , childNode ) <EOL> connections = workflow . db_connections <EOL> for connection in connections . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , connection . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , connection . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , connection . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( connection , doc , childNode ) <EOL> annotations = workflow . db_annotations <EOL> for annotation in annotations : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , annotation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( annotation , doc , childNode ) <EOL> others = workflow . db_others <EOL> for other in others : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , other . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , other . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , other . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( other , doc , childNode ) <EOL> abstractionRefs = workflow . db_abstractionRefs <EOL> for abstractionRef in abstractionRefs . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , abstractionRef . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , abstractionRef . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , abstractionRef . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( abstractionRef , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBAbstractionRefXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> abstraction_id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> version = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:version>' ) , '<STR_LIT>' ) <EOL> obj = DBAbstractionRef ( id = id , <EOL> abstraction_id = abstraction_id , <EOL> version = version ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , abstractionRef , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( abstractionRef . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( abstractionRef . db_abstraction_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:version>' , self . convertToStr ( abstractionRef . db_version , '<STR_LIT>' ) ) <EOL> return node <EOL> class DBAnnotationXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> key = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:key>' ) , '<STR_LIT:str>' ) <EOL> value = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:value>' ) , '<STR_LIT:str>' ) <EOL> obj = DBAnnotation ( id = id , <EOL> key = key , <EOL> value = value ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , annotation , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( annotation . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:key>' , self . convertToStr ( annotation . db_key , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT:value>' , self . convertToStr ( annotation . db_value , '<STR_LIT:str>' ) ) <EOL> return node <EOL> class DBChangeXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> what = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> oldObjId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> newObjId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parentObjId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parentObjType = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> data = None <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT:location>' : <EOL> data = self . getDao ( '<STR_LIT:location>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT:port>' : <EOL> data = self . getDao ( '<STR_LIT:port>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> data = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBChange ( id = id , <EOL> what = what , <EOL> oldObjId = oldObjId , <EOL> newObjId = newObjId , <EOL> parentObjId = parentObjId , <EOL> parentObjType = parentObjType , <EOL> data = data ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , change , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( change . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( change . db_what , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( change . db_oldObjId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( change . db_newObjId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( change . db_parentObjId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( change . db_parentObjType , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> data = change . db_data <EOL> if data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT:location>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT:location>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:location>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:location>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:location>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:location>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT:port>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT:port>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:port>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:port>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:port>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:port>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> elif data . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , data . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , data . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( data , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBParameterXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> pos = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> type = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:type>' ) , '<STR_LIT:str>' ) <EOL> val = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> alias = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> obj = DBParameter ( id = id , <EOL> pos = pos , <EOL> name = name , <EOL> type = type , <EOL> val = val , <EOL> alias = alias ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , parameter , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( parameter . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( parameter . db_pos , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( parameter . db_name , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT:type>' , self . convertToStr ( parameter . db_type , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( parameter . db_val , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( parameter . db_alias , '<STR_LIT:str>' ) ) <EOL> return node <EOL> class DBConnectionXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> ports = [ ] <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT:port>' : <EOL> port = self . getDao ( '<STR_LIT:port>' ) . fromXML ( child ) <EOL> ports . append ( port ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBConnection ( id = id , <EOL> ports = ports ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , connection , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( connection . db_id , '<STR_LIT>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> ports = connection . db_ports <EOL> for port in ports : <EOL> if nodeMap . has_key ( ( '<STR_LIT:port>' , port . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:port>' , port . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:port>' , port . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:port>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:port>' ) . toXML ( port , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBActionXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT:action>' : <EOL> return None <EOL> operations = [ ] <EOL> annotations = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> prevId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> date = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:date>' ) , '<STR_LIT>' ) <EOL> user = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:user>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> annotation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> annotations [ annotation . db_id ] = annotation <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> operation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> operations . append ( operation ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> operation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> operations . append ( operation ) <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> operation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> operations . append ( operation ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBAction ( id = id , <EOL> prevId = prevId , <EOL> date = date , <EOL> user = user , <EOL> annotations = annotations , <EOL> operations = operations ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , action , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT:action>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( action . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( action . db_prevId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:date>' , self . convertToStr ( action . db_date , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:user>' , self . convertToStr ( action . db_user , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> annotations = action . db_annotations <EOL> for annotation in annotations . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , annotation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( annotation , doc , childNode ) <EOL> operations = action . db_operations <EOL> for operation in operations : <EOL> if operation . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , operation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , operation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , operation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( operation , doc , childNode ) <EOL> elif operation . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , operation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , operation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , operation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( operation , doc , childNode ) <EOL> elif operation . vtType == '<STR_LIT>' : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , operation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , operation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , operation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( operation , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBDeleteXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> what = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> objectId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parentObjId = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> parentObjType = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> obj = DBDelete ( id = id , <EOL> what = what , <EOL> objectId = objectId , <EOL> parentObjId = parentObjId , <EOL> parentObjType = parentObjType ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , delete , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( delete . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( delete . db_what , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( delete . db_objectId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( delete . db_parentObjId , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( delete . db_parentObjType , '<STR_LIT:str>' ) ) <EOL> return node <EOL> class DBVistrailXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> actions = { } <EOL> tags = { } <EOL> abstractions = { } <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> version = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:version>' ) , '<STR_LIT:str>' ) <EOL> name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:name>' ) , '<STR_LIT:str>' ) <EOL> dbHost = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> dbPort = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:int>' ) <EOL> dbName = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT:action>' : <EOL> action = self . getDao ( '<STR_LIT:action>' ) . fromXML ( child ) <EOL> actions [ action . db_id ] = action <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> tag = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> tags [ tag . db_id ] = tag <EOL> elif child . nodeName == '<STR_LIT>' : <EOL> abstraction = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> abstractions [ abstraction . db_id ] = abstraction <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBVistrail ( id = id , <EOL> version = version , <EOL> name = name , <EOL> dbHost = dbHost , <EOL> dbPort = dbPort , <EOL> dbName = dbName , <EOL> actions = actions , <EOL> tags = tags , <EOL> abstractions = abstractions ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , vistrail , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( vistrail . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT:version>' , self . convertToStr ( vistrail . db_version , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT:name>' , self . convertToStr ( vistrail . db_name , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( vistrail . db_dbHost , '<STR_LIT:str>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( vistrail . db_dbPort , '<STR_LIT:int>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( vistrail . db_dbName , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> actions = vistrail . db_actions <EOL> for action in actions . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT:action>' , action . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT:action>' , action . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT:action>' , action . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT:action>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT:action>' ) . toXML ( action , doc , childNode ) <EOL> tags = vistrail . db_tags <EOL> for tag in tags . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , tag . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , tag . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , tag . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( tag , doc , childNode ) <EOL> abstractions = vistrail . db_abstractions <EOL> for abstraction in abstractions . itervalues ( ) : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , abstraction . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , abstraction . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , abstraction . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( abstraction , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> class DBModuleExecXMLDAOBase ( XMLDAO ) : <EOL> def __init__ ( self , daoList ) : <EOL> self . daoList = daoList <EOL> def getDao ( self , dao ) : <EOL> return self . daoList [ dao ] <EOL> def fromXML ( self , node ) : <EOL> if node . nodeName != '<STR_LIT>' : <EOL> return None <EOL> annotations = [ ] <EOL> id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> ts_start = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> ts_end = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> module_id = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> module_name = self . convertFromStr ( self . getAttribute ( node , '<STR_LIT>' ) , '<STR_LIT:str>' ) <EOL> for child in list ( node . childNodes ) : <EOL> if child . nodeName == '<STR_LIT>' : <EOL> annotation = self . getDao ( '<STR_LIT>' ) . fromXML ( child ) <EOL> annotations . append ( annotation ) <EOL> elif child . nodeType == child . TEXT_NODE and child . nodeValue . strip ( ) == '<STR_LIT>' : <EOL> pass <EOL> elif child . nodeType != child . TEXT_NODE : <EOL> print '<STR_LIT>' % child . nodeName <EOL> obj = DBModuleExec ( id = id , <EOL> ts_start = ts_start , <EOL> ts_end = ts_end , <EOL> module_id = module_id , <EOL> module_name = module_name , <EOL> annotations = annotations ) <EOL> obj . is_dirty = False <EOL> return obj <EOL> def toXML ( self , module_exec , doc , node ) : <EOL> if node is None : <EOL> node = doc . createElement ( '<STR_LIT>' ) <EOL> node . setAttribute ( '<STR_LIT:id>' , self . convertToStr ( module_exec . db_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( module_exec . db_ts_start , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( module_exec . db_ts_end , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( module_exec . db_module_id , '<STR_LIT>' ) ) <EOL> node . setAttribute ( '<STR_LIT>' , self . convertToStr ( module_exec . db_module_name , '<STR_LIT:str>' ) ) <EOL> nodeMap = { } <EOL> for childNode in node . childNodes : <EOL> if childNode . nodeType == childNode . ELEMENT_NODE and self . hasAttribute ( childNode , '<STR_LIT:id>' ) : <EOL> nodeId = self . convertFromStr ( self . getAttribute ( childNode , '<STR_LIT:id>' ) , '<STR_LIT>' ) <EOL> nodeMap [ ( childNode . nodeName , nodeId ) ] = childNode <EOL> annotations = module_exec . db_annotations <EOL> for annotation in annotations : <EOL> if nodeMap . has_key ( ( '<STR_LIT>' , annotation . db_id ) ) : <EOL> childNode = nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> del nodeMap [ ( '<STR_LIT>' , annotation . db_id ) ] <EOL> else : <EOL> childNode = doc . createElement ( '<STR_LIT>' ) <EOL> node . appendChild ( childNode ) <EOL> self . getDao ( '<STR_LIT>' ) . toXML ( annotation , doc , childNode ) <EOL> for childNode in nodeMap . itervalues ( ) : <EOL> childNode . parentNode . removeChild ( childNode ) <EOL> return node <EOL> """<STR_LIT>""" <EOL> class XMLDAOListBase ( dict ) : <EOL> def __init__ ( self , daos = None ) : <EOL> if daos is not None : <EOL> dict . update ( self , daos ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBPortSpecXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBModuleXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBTagXMLDAOBase ( self ) <EOL> if '<STR_LIT:port>' not in self : <EOL> self [ '<STR_LIT:port>' ] = DBPortXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBLogXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBMachineXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBAddXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBOtherXMLDAOBase ( self ) <EOL> if '<STR_LIT:location>' not in self : <EOL> self [ '<STR_LIT:location>' ] = DBLocationXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBWorkflowExecXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBFunctionXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBAbstractionXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBWorkflowXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBAbstractionRefXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBAnnotationXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBChangeXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBParameterXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBConnectionXMLDAOBase ( self ) <EOL> if '<STR_LIT:action>' not in self : <EOL> self [ '<STR_LIT:action>' ] = DBActionXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBDeleteXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBVistrailXMLDAOBase ( self ) <EOL> if '<STR_LIT>' not in self : <EOL> self [ '<STR_LIT>' ] = DBModuleExecXMLDAOBase ( self ) </s>
