Ignore:
Timestamp:
07/10/08 17:38:34 (11 years ago)
Author:
cbyrom
Message:

Add convenience methods to determine whether a data item is a granule +
selected atom related links according to their type - to allow granules + deployments
to be associated with data entities.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/vocabtermdata.py

    r4295 r4301  
    185185 
    186186    ATOM_TYPES = [ACTIVITY_TERM, DE_TERM, DPT_TERM, GRANULE_TERM, OBS_TERM] 
     187     
     188    DEPLOYABLE_ATOM_TYPES = [ACTIVITY_TERM, DPT_TERM, OBS_TERM] 
    187189 
    188190    PROVIDER_TYPES = [BADC_TERM, NEODC_TERM] 
     
    196198 
    197199    ATOM_CATEGORY = "atom" 
     200    DEPLOYABLE_ATOM_CATEGORY = "deployableatom" 
    198201    ONLINE_REF_CATEGORY = "onlineref" 
    199202    PROVIDER_CATEGORY = "provider" 
     
    283286        if category == self.ATOM_CATEGORY: 
    284287            catList = self.ATOM_TYPES 
     288        elif category == self.DEPLOYABLE_ATOM_CATEGORY: 
     289            catList = self.DEPLOYABLE_ATOM_TYPES 
    285290        elif category == self.PROVIDER_CATEGORY: 
    286291            catList = self.PROVIDER_TYPES 
     
    547552        logging.debug("- item is not a deployment") 
    548553        return False 
     554     
     555     
     556    def isGranule(self, vti): 
     557        ''' 
     558        Determines whether a vocab term item is a granule item 
     559        @param vti: vocab term item to check 
     560        @return True if a granule, false otherwise 
     561        ''' 
     562        logging.debug("Checking if item is a granule") 
     563        if vti: 
     564            if vti.termID == self.GRANULE_TERM: 
     565                logging.debug("- item is a granule") 
     566                return True 
     567         
     568        logging.debug("- item is not a granule") 
     569        return False 
    549570                 
Note: See TracChangeset for help on using the changeset viewer.