Changeset 5144 for ndgCommon


Ignore:
Timestamp:
26/03/09 17:13:12 (10 years ago)
Author:
cbyrom
Message:

Move abstract and interface record to ndgcommon to allow reuse + change
logging level to debug + add a few helper methods.

Location:
ndgCommon/trunk/ndg/common/src/models
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/models/codetablerecord.py

    r5083 r5144  
    88import logging 
    99from ndg.common.src.models.ndgObject import ndgObject 
     10from ndg.common.src.models.abstractrecord import AbstractRecord 
    1011 
    11 class CodeTableRecord(object): 
     12class CodeTableRecord(AbstractRecord): 
    1213     
    1314    __slots__ = ['listKey', 'entryKey', 'entryTerm', 'entryTermAbbr', 
     
    1718        Constructor - initialise the code table record variables 
    1819        ''' 
    19         logging.info("Initialising CodeTableRecord") 
     20        logging.debug("Initialising CodeTableRecord") 
    2021        for att in self.__slots__: 
    2122            setattr(self, att, '') 
     
    2324        if et: 
    2425            self.fromET(et) 
    25         logging.info("CodeTableRecord initialised")       
     26        logging.debug("CodeTableRecord initialised")       
    2627 
    2728 
     
    3132        @param tree: ElementTree with vocab list data 
    3233        ''' 
    33         logging.info("Ingesting data from ElementTree object") 
     34        logging.debug("Ingesting data from ElementTree object") 
    3435         
    3536        for att in self.__slots__: 
    3637            setattr(self, att, tree.findtext('{%s}%s' %(ndgObject.VOCAB_NS, att))) 
    37         logging.info("Data ingested from tree") 
     38        logging.debug("Data ingested from tree") 
    3839         
    3940         
     41    def setData(self, listKey, entryKey, entryTerm, entryTermAbbr, 
     42                entryTermDef, entryTermLastMod): 
     43        ''' 
     44        Simple method to set data on object 
     45        @param listKey: ID of the record vocab list 
     46        @param entryKey: a unique ID of the term (specified by the vocab server??) 
     47        @param entryTerm: preferred label for the term 
     48        @param entryTermAbbr: alternative label for the term 
     49        @param entryTermDef: definition of the term 
     50        @keyword entryTermLastMod: modification date of the vocab term info.   
     51        ''' 
     52        logging.debug("Setting data on CodeTableRecord object") 
     53 
     54        self.listKey = listKey 
     55        self.entryKey = entryKey 
     56        self.entryTerm = entryTerm 
     57        self.entryTermAbbr = entryTermAbbr 
     58        self.entryTermDef = entryTermDef 
     59        self.entryTermLastMod = entryTermLastMod 
     60         
     61        logging.debug("CodeTableRecord data set") 
  • ndgCommon/trunk/ndg/common/src/models/codetabletype.py

    r5083 r5144  
    88import logging 
    99from ndg.common.src.models.ndgObject import ndgObject 
     10from ndg.common.src.models.abstractrecord import AbstractRecord 
    1011 
    11 class CodeTableType(object): 
     12class CodeTableType(AbstractRecord): 
    1213  
    1314    __slots__ = ['listKey', 'listLongName', 'listShortName', 'listDefinition', 
     
    1718        Constructor - initialise the code table type variables 
    1819        ''' 
    19         logging.info("Initialising CodeTableType") 
     20        logging.debug("Initialising CodeTableType") 
    2021        for att in self.__slots__: 
    2122            setattr(self, att, '') 
     
    2324        if et: 
    2425            self.fromET(et) 
    25         logging.info("CodeTableType initialised")       
     26        logging.debug("CodeTableType initialised")       
    2627 
    2728 
     
    3132        @param tree: ElementTree with vocab list data 
    3233        ''' 
    33         logging.info("Ingesting data from ElementTree object") 
     34        logging.debug("Ingesting data from ElementTree object") 
    3435         
    3536        for att in self.__slots__: 
    3637            setattr(self, att, tree.findtext('{%s}%s' %(ndgObject.VOCAB_NS, att))) 
    37         logging.info("Data ingested from tree") 
     38        logging.debug("Data ingested from tree") 
    3839         
    3940         
Note: See TracChangeset for help on using the changeset viewer.