Ignore:
Timestamp:
10/07/12 15:15:27 (8 years ago)
Author:
mnagni
Message:

Complete - # 22489: CEDA Observation Collection - phenomenonTime
 http://team.ceda.ac.uk/trac/ceda/ticket/22489
Complete - # 22518: The description is broken
 http://team.ceda.ac.uk/trac/ceda/ticket/22518
Complete - # 22488: CEDA Observation Collection - Geographical Extent
 http://team.ceda.ac.uk/trac/ceda/ticket/22488

Now the Moles3EPB explicitly call the "synchronise" method in the SQLAlchemy mapped classes to assure the persistence of the data
Uses the CedaMolesModel? v 0.1.5 which correct a major problem in synchronise the instances with database

File:
1 edited

Legend:

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

    r8445 r8460  
    5252    createMD_Keywords, hasMOBeenProcessed, createMO_Individual,\ 
    5353    fromDateStringToPhenomenonTime, fromPhenomenonTimeToString,\ 
    54     comparePhenomenonTimes 
     54    comparePhenomenonTimes, compareGeographicBoundingBoxes 
    5555from libs.epb import EPB 
    5656from libs.migration.processor.deployment_data import DeploymentDataProcessor 
    5757from libs.migration.exception.exceptions import NoDataLineage,\ 
    58     NoAssociatedAuthor, NoAssociatedDeployments 
     58    NoAssociatedAuthor, NoAssociatedDeployments,\ 
     59    NoGeographicalExtensionException 
    5960from libs.migration.authors import authors 
    6061from logging import StreamHandler 
     
    103104        self._deploymentHasSameHash = hasMOSameHash(self._deploymentMigration) 
    104105        self._deploymentHasBeenProcessed = hasMOBeenProcessed(self._deploymentMigration) 
     106        self._report = [] 
    105107 
    106108    def _addResponsiblePartyInfo(self, oldResponsiblePartyInfos, newResponsiblePartyInfo): 
     
    412414            return   
    413415         
    414         ge = extractGeographicExtentInMigrationDocument(self._deploymentMigration) 
    415         if not ge: 
     416        ge = extractGeographicExtentInMigrationDocument(self._deploymentMigration)         
     417        if ge is None: 
    416418            ge = extractGeographicExtentInMigrationDocument(self._dataEntityMigration) 
    417             if ge: 
    418                 geographicExtent = createEX_GeographicBoundingBox(ge['east'], ge['north'], ge['west'], ge['south']) 
    419                 if self._deploymentHasBeenProcessed: 
    420                     DeploymentProcessor.log.warn('The _assignGeographicExtent update is skipped because not implemented') 
    421                 observation.geographicExtent.append(geographicExtent) 
    422             else: 
    423                 print "No Geographic Extent" 
    424             return           
    425         #Still have to update observation.geographicExtent 
     419         
     420        if ge is None: 
     421            self._report.append(NoGeographicalExtensionException(self._deploymentMigration)) 
     422            self._report.append(NoGeographicalExtensionException(self._dataEntityMigration)) 
     423         
     424        geographicExtent = createEX_GeographicBoundingBox(ge['east'], ge['north'], ge['west'], ge['south']) 
     425 
     426        if len(observation.geographicExtent) == 0 or \ 
     427            (len(observation.geographicExtent) > 0 and \ 
     428             not compareGeographicBoundingBoxes(geographicExtent, \ 
     429                observation.geographicExtent[0])): 
     430            self.epbRepo.moles3EPB.updateCedaObject(observation, {'geographicExtent': geographicExtent})              
    426431             
    427432    def _assignCreationDate(self, observation): 
     
    642647         
    643648    def process(self): 
     649        self._report = [] 
    644650        ceda_observation = None 
    645651        #Moles3 object exists...  
     
    648654        else: 
    649655            #... does not exist so create it 
    650             ceda_observation =  ceda_observation = CEDA_Observation() 
     656            ceda_observation = CEDA_Observation() 
    651657     
    652658        self._execute(ceda_observation)     
    653         return ceda_observation 
     659        return self._report, ceda_observation 
Note: See TracChangeset for help on using the changeset viewer.