Source

dataliberation / issues / tigris / data / TigrisActivity.py

'''
Created on 08.04.2010

@author: dirk
'''

import io.xml

class TigrisActivity:
    '''
    A single activity in a Tigris issue.
    '''


    def __init__(self, who='', when='', field='', old='', new=''):
        '''
        Constructor
        '''
        self.who = who
        self.when = when
        self.field = field
        self.old = old
        self.new = new
        
    def appendNode(self, doc, root):
        e = doc.createElement("activity")
        io.xml.addChildText(doc, e, "user", self.who)
        io.xml.addChildText(doc, e, "when", self.when)
        io.xml.addChildText(doc, e, "field_name", self.field)
        io.xml.addChildText(doc, e, "oldvalue", self.old)
        io.xml.addChildText(doc, e, "newvalue", self.new)
        root.appendChild(e)
    
    def parseNode(self, node):
        self.who = io.xml.getChildText(node, "user")
        self.when = io.xml.getChildText(node, "when")
        self.field = io.xml.getChildText(node, "field_name")
        self.old = io.xml.getChildText(node, "oldvalue")
        self.new = io.xml.getChildText(node, "newvalue")