Changeset 8210 for mauRepo


Ignore:
Timestamp:
03/04/12 08:16:48 (8 years ago)
Author:
mnagni
Message:

Complete - # 22424: CEDA Project - documentation
 http://team.ceda.ac.uk/trac/ceda/ticket/22424

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

Legend:

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

    r8209 r8210  
    3333from ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_position import TM_Position 
    3434from ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_instant import TM_Instant 
    35 from ea_model.moles3_4.utilities.mo_organization import MO_Organization 
    3635from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_contact import CI_Contact 
    3736from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_address import CI_Address 
     
    324323    return linksDict 
    325324 
     325 
     326 
    326327def findDownloadLinksInMigrationDocument(migrationObject): 
    327328    """ 
     
    344345    return linksDict['ACCESS'] 
    345346 
     347def findDocumentationInMigrationDocument(migrationObject): 
     348    """ 
     349        Return a list of dictionaries describing a <link rel="...DOCUMENT..."> tag type 
     350        Each dictionary has two keys: 'href' and 'title' 
     351        @param migrationObject: the migration instance to retrieve and parse 
     352        @return: a list of dictionaries 
     353    """ 
     354    linksDict = findLinksInMigrationDocument(migrationObject) 
     355    return linksDict['DOCUMENT'] 
     356 
    346357def findDOIInMigrationDocument(migrationObject): 
    347358    """ 
     
    351362        @return: a dictionary relative to the DOI, None otherwise 
    352363    """ 
    353     linksDict = findLinksInMigrationDocument(migrationObject) 
    354     for link in linksDict['DOCUMENTATION']: 
     364    for link in findDocumentationInMigrationDocument(migrationObject): 
    355365        if link['href'].startswith('doi:'): 
    356366            return link 
     
    828838    return ceda_acquisition 
    829839 
    830 def createCEDA_Project(abstract = None, publication_state = None): 
     840def createCEDA_Project(abstract = None, publication_state = None, documentation = None, project_resource=None): 
    831841    ceda_project = CEDA_Project() 
    832842    if abstract: 
     
    834844    if publication_state: 
    835845        ceda_project.publicationState = publication_state         
     846    if documentation and type(documentation) == list: 
     847        ceda_project.documentation = documentation 
     848    if project_resource and type(project_resource) == list: 
     849        ceda_project.projectResource = project_resource    
    836850    return ceda_project     
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/deployment_data.py

    r8209 r8210  
    44@author: mnagni 
    55''' 
    6 from libs.migration.processor.commons import findLinksInDeployment,\ 
    7     findSubTypeInDPT, hasAtomDocumentSameHash, getAtomDocumentHashByMO,\ 
     6from libs.migration.processor.commons import findSubTypeInDPT,\ 
    87    createCEDA_Processing, createCEDA_Instrument, createCEDA_Project,\ 
    9     findSummary 
     8    findSummary, findDocumentationInMigrationDocument, createCI_Citation,\ 
     9    createMO_OnlineResource 
    1010from libs.migration.MigrationEPB import MigrationEPB 
    1111from MolesManager.moles3epb import Moles3EPB 
     
    2727        if links.has_key('ACTIVITY'): 
    2828            for link in links['ACTIVITY']: 
    29                 activity = MigrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, link + '.atom', self._migrationSessions.migrationSession) 
     29                activity = MigrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, link + '.atom', \ 
     30                                                                         self._migrationSessions.migrationSession) 
    3031                i_abstract = findSummary(activity) 
    31                 project = createCEDA_Project(abstract=i_abstract, publication_state=MO_PublicationStateValue.cl_working) 
     32                doc_link = findDocumentationInMigrationDocument(activity) 
     33                i_documentation = None 
     34                i_resource = None 
     35                if doc_link and len(doc_link) == 1: 
     36                    i_documentation = createCI_Citation("Documentation resource") 
     37                    i_resource = createMO_OnlineResource(doc_link[0]['href']) 
     38                project = createCEDA_Project(abstract=i_abstract, publication_state=MO_PublicationStateValue.cl_working, \ 
     39                                             documentation=i_documentation, project_resource=i_resource) 
    3240                self._commitDeploymentMigration(project, activity, 'ceda_project_id') 
    3341        return project 
     
    3947        hasCedaAcquisition = False 
    4048        for dpt in links['DPT']: 
    41             dataProductionTool = MigrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, dpt + '.atom', self._migrationSessions.migrationSession) 
     49            dataProductionTool = MigrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, dpt + \ 
     50                                                                               '.atom', self._migrationSessions.migrationSession) 
    4251             
    4352            #has the document changed?             
     
    6271        #if not a DPT.subType == 'model' then.... 
    6372        for obs in links['OBS']: 
    64             observationStation = MigrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, obs + '.atom', self._migrationSessions.migrationSession) 
     73            observationStation = MigrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, obs + \ 
     74                                                                               '.atom', self._migrationSessions.migrationSession) 
    6575  
    6676            #has the document changed?             
Note: See TracChangeset for help on using the changeset viewer.