Changeset 8181 for mauRepo


Ignore:
Timestamp:
22/03/12 13:32:38 (8 years ago)
Author:
mnagni
Message:

Incomplete - # 22407: DeploymentDataMigration? bug
 http://team.ceda.ac.uk/trac/ceda/ticket/22407

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

Legend:

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

    r8180 r8181  
    77from ea_model.iso_19115_2006_metadata_corrigendum.reference_system_information.md_identifier import MD_Identifier 
    88from httplib import HTTPConnection 
    9 from xml.etree.ElementTree import XML, ElementTree, fromstring, dump, tostring 
     9from xml.etree.ElementTree import XML, tostring 
    1010import time, datetime 
    1111from ea_model.upcomingiso.ci_organisation import CI_Organisation 
    1212from ea_model.upcomingiso.ci_party import CI_Party 
    1313from ea_model.upcomingiso.ci_individual import CI_Individual 
    14 from libs.migration.exception.exceptions import NoDataLineage,\ 
    15     NoAssociatedAuthor 
     14from libs.migration.exception.exceptions import NoDataLineage 
    1615from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_citation import CI_Citation 
    1716from ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_element import DQ_Element 
     
    2019from xml.sax.saxutils import unescape, escape 
    2120import html5lib 
    22 from html5lib import sanitizer, treebuilders 
    23 from libs.migration.authors import authors 
     21from html5lib import treebuilders 
    2422from ea_model.ceda_metadatamodel.ceda_result.ceda_result import CEDA_Result 
    2523from ea_model.moles3_4.result.mo_onlineresource import MO_OnlineResource 
    2624from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.url import URL 
    27 from ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicextent import EX_GeographicExtent 
    2825from ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicboundingbox import EX_GeographicBoundingBox 
    29 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_onlinefunctioncode import CI_OnLineFunctionCode 
     26from ea_model.ceda_metadatamodel.ceda_computation.ceda_processing import CEDA_Processing 
     27from ea_model.ceda_metadatamodel.ceda_acquisition.ceda_instrument import CEDA_Instrument 
     28from ea_model.ceda_metadatamodel.ceda_observationprocess.ceda_compositeprocess import CEDA_CompositeProcess 
     29from ea_model.ceda_metadatamodel.ceda_acquisition.ceda_acquisition import CEDA_Acquisition 
    3030 
    3131base = '/exist/rest/atoms' 
     
    496496    return ex_geographic_bb 
    497497     
    498  
    499  
    500  
    501  
     498def createCEDA_Processing(): 
     499    ceda_processing = CEDA_Processing() 
     500    return ceda_processing 
     501 
     502 
     503def createCEDA_Instrument(): 
     504    ceda_instrument = CEDA_Instrument() 
     505    return ceda_instrument 
     506 
     507def createCEDA_CompositeProcess(): 
     508    ceda_cp = CEDA_CompositeProcess() 
     509    return ceda_cp 
     510 
     511def createCEDA_Acquisition(): 
     512    ceda_acquisition = CEDA_Acquisition() 
     513    return ceda_acquisition 
     514     
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/deployment_data.py

    r8091 r8181  
    55''' 
    66from libs.migration.processor.commons import findLinksInDeployment,\ 
    7     findSubTypeInDPT, hasAtomDocumentSameHash, getAtomDocumentHashByMO 
     7    findSubTypeInDPT, hasAtomDocumentSameHash, getAtomDocumentHashByMO,\ 
     8    createCEDA_Processing, createCEDA_Instrument 
    89from libs.migration.MigrationEPB import MigrationEPB 
    9 from ea_model.ceda_metadatamodel.ceda_computation.ceda_processing import CEDA_Processing 
    10 from ea_model.ceda_metadatamodel.ceda_acquisition.ceda_instrument import CEDA_Instrument 
    11 from ea_model.ceda_metadatamodel.ceda_observationprocess.ceda_compositeprocess import CEDA_CompositeProcess 
    12 from ea_model.ceda_metadatamodel.ceda_acquisition.ceda_acquisition import CEDA_Acquisition 
    13 from libs.epb import EPB 
    1410from MolesManager.moles3epb import Moles3EPB 
    1511 
     
    2016        self._deploymentMigration = deploymentMigration 
    2117         
    22     def _processCEDA_Processing(self, dataProductionTool): 
    23         if dataProductionTool and hasattr(dataProductionTool, 'ceda_processing_id'): 
    24             return EPB.searchOrCreate(CEDA_Processing, self._migrationSessions.molesSession, dataProductionTool.ceda_processing_id) 
    25  
    26     def _processCEDA_Instrument(self, dataProductionTool): 
    27         if dataProductionTool and hasattr(dataProductionTool, 'ceda_instrument_id'):         
    28             return EPB.searchOrCreate(CEDA_Instrument, self._migrationSessions.molesSession, dataProductionTool.ceda_instrument_id) 
    29      
    30     def _processCEDA_CompositeProcess(self, observationStation): 
    31         if observationStation and hasattr(observationStation, 'ceda_compositeprocess_id'):         
    32             return EPB.searchOrCreate(CEDA_CompositeProcess, self._migrationSessions.molesSession, observationStation.ceda_compositeprocess_id)         
    33  
    34     def _processCEDA_Acquisition(self, observationStation): 
    35         if observationStation and hasattr(observationStation, 'ceda_acquisition_id'):         
    36             return EPB.searchOrCreate(CEDA_Acquisition, self._migrationSessions.molesSession, observationStation.ceda_acquisition_id)         
     18    def _commitDeploymentMigration(self, associateWithCedaObservation, dataProductionTool, dataProductionToolField): 
     19        Moles3EPB.addCedaObject(associateWithCedaObservation, self._migrationSessions.molesSession, True) 
     20        setattr(dataProductionTool, dataProductionToolField, associateWithCedaObservation.id)                                   
     21        self._migrationSessions.migrationSession.commit()  
    3722         
    3823    def _assignProcess(self): 
     
    5338            subType = findSubTypeInDPT(dataProductionTool) 
    5439            if subType == 'model': 
    55                 ret = self._processCEDA_Processing(dataProductionTool) 
    56                 Moles3EPB.addCedaObject(ret, self._migrationSessions.molesSession, True) 
    57                 dataProductionTool.ceda_processing_id = ret.id 
    58                 self._migrationSessions.migrationSession.commit()                
     40                associateWithCedaObservation = createCEDA_Processing() 
     41                self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_processing_id') 
    5942                if not (hasCedaComposite or hasCedaProcessing): 
    60                     associateWithCedaObservation = ret 
    6143                    hasCedaProcessing = True 
    6244                    hasCedaComposite = False 
    6345                    hasCedaAcquisition = False  
    6446            else: 
    65                 ret = self._processCEDA_Instrument(dataProductionTool) 
    66                 Moles3EPB.addCedaObject(ret, self._migrationSessions.molesSession, True) 
    67                 dataProductionTool.ceda_instrument_id = ret.id  
    68                 self._migrationSessions.migrationSession.commit()   
     47                associateWithCedaObservation = createCEDA_Instrument() 
     48                self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_instrument_id') 
    6949                 
    7050                 
     
    8161            subType = findSubTypeInDPT(observationStation) 
    8262            if subType == 'satellite': 
    83                 ret = self._processCEDA_CompositeProcess(observationStation) 
    84                 Moles3EPB.addCedaObject(ret, self._migrationSessions.molesSession, True)                 
    85                 observationStation.ceda_compositeprocess_id = ret.id  
    86                 self._migrationSessions.migrationSession.commit()                                 
    87                 if not hasCedaComposite: 
    88                     associateWithCedaObservation = ret 
    89                     hasCedaProcessing = True 
    90                     hasCedaComposite = False 
    91                     hasCedaAcquisition = False                     
     63                    associateWithCedaObservation = createCEDA_Processing() 
     64                    self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_compositeprocess_id')    
     65                    if not hasCedaComposite: 
     66                        hasCedaProcessing = True 
     67                        hasCedaComposite = False 
     68                        hasCedaAcquisition = False                
    9269            else: 
    93                 ret = self._processCEDA_Acquisition(observationStation) 
    94                 Moles3EPB.addCedaObject(ret, self._migrationSessions.molesSession, True) 
    95                 observationStation.ceda_acquisition_id = ret.id  
    96                 self._migrationSessions.migrationSession.commit()                 
     70                pass 
     71                ''' 
     72                associateWithCedaObservation = createCEDA_Acquisition() 
     73                self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_acquisition_id') 
     74                '''                 
    9775                if not (hasCedaComposite or hasCedaProcessing or hasCedaAcquisition): 
    98                     associateWithCedaObservation = ret 
    9976                    hasCedaProcessing = True 
    10077                    hasCedaComposite = False 
    10178                    hasCedaAcquisition = True 
     79                     
    10280         
    10381        return associateWithCedaObservation                    
Note: See TracChangeset for help on using the changeset viewer.