Changeset 8391 for mauRepo


Ignore:
Timestamp:
25/06/12 08:53:15 (7 years ago)
Author:
mnagni
Message:

Complete - # 22486: CEDA Observation Collection - Title
 http://team.ceda.ac.uk/trac/ceda/ticket/22486

Location:
mauRepo/MolesManager/trunk/src/libs/migration
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/dataEntity.py

    r8363 r8391  
    4040    isoDateTimeStringToTimeDate, findUpdatedDate, createDate,\ 
    4141    calculateHash, findDOIInMigrationDocument,\ 
    42     hasMOBeenProcessed, getAtomDocumentHashByMO 
     42    hasMOBeenProcessed, getAtomDocumentHashByMO, extractTitle 
    4343from libs.migration.processor.deployment import DeploymentProcessor 
    4444from ea_model.moles3_4.utilities.mo_publicationstatevalue import MO_PublicationStateValue 
     
    4747from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_datetypecode import CI_DateTypeCode 
    4848from MolesManager.ceda_guid import CedaGUID 
     49 
     50CEDA_TITLE = 'ceda_title' 
    4951 
    5052class DataEntityProcessor(object): 
     
    6769        self.epbRepo = epbRepo 
    6870     
     71    def _processTitle(self, ceda_observationCollection): 
     72        ititle = extractTitle(self._dataEntityMigration) 
     73        if ceda_observationCollection.identifier: 
     74            for ident in ceda_observationCollection.identifier: 
     75                if ident.authority.title == CEDA_TITLE: 
     76                    if ident.code != ititle: 
     77                        ident.code = ititle 
     78                    else: 
     79                        return             
     80  
     81        #Else create new 
     82        i_citation = createCI_Citation(title = CEDA_TITLE) 
     83        newIdentifier = createMD_Identifier(code = ititle, authority=i_citation) 
     84        ceda_observationCollection.identifier.append(newIdentifier)      
     85     
    6986    def _processCitation(self, ceda_observationCollection): 
    7087        contentDict = extractContent(self._dataEntityMigration) 
     
    94111            @return: the persisted CEDA_ObservationCollection element  
    95112        """ 
     113         
     114        self._processTitle(ceda_observationCollection) 
     115         
    96116        if not self._dataEntityHasSameHash: 
    97             self._processCitation(ceda_observationCollection) 
     117            self._processCitation(ceda_observationCollection)             
    98118            #self._processResult(ceda_observationCollection) 
    99119         
  • mauRepo/MolesManager/trunk/src/libs/migration/tests/migrationprocess.py

    r8387 r8391  
    5252     
    5353    def setUp(self): 
    54         #migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, sql_echo=True) 
    55         migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT)       
     54        migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, sql_echo=True) 
     55        #migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT)       
    5656 
    57         #molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, sql_echo=True, session_event_manager=EVENTS_DB) 
    58         molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, session_event_manager=EVENTS_DB)          
     57        molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, sql_echo=True, session_event_manager=EVENTS_DB) 
     58        #molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, session_event_manager=EVENTS_DB)          
    5959         
    6060         
     
    9090         
    9191        #IASI 
    92         self.processDataEntity(DO_NEODC, DS_pUBLISHED, 'dataent_12417810458627666.atom') 
    93         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_VIRTEM.atom') 
    94         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_12162569915925921.atom') 
     92        #self.processDataEntity(DO_NEODC, DS_pUBLISHED, 'dataent_12417810458627666.atom') 
     93        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_VIRTEM.atom') 
     94        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_12162569915925921.atom') 
    9595               
    9696        #ECMWF 
    97         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-ERA.atom') 
    98         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-OP.atom') 
    99         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_12458543158227759.atom')                 
    100         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-E40.atom') 
    101         self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-TRJ.atom')                 
     97        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-ERA.atom') 
     98        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-OP.atom') 
     99        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_12458543158227759.atom')                 
     100        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-E40.atom') 
     101        #self.processDataEntity(DO_BADC, DS_pUBLISHED, 'dataent_ECMWF-TRJ.atom')                 
    102102 
    103103         
Note: See TracChangeset for help on using the changeset viewer.