Changeset 8201


Ignore:
Timestamp:
01/04/12 11:04:34 (8 years ago)
Author:
mnagni
Message:

Complete - # 22390: AMEND MOLES2 -> CEDA Moles Author and Co-author migration (plus PI assignment) to CEDA Observation record
 http://team.ceda.ac.uk/trac/ceda/ticket/22390
Complete - # 22397: CEDA Observation geographicExtent
 http://team.ceda.ac.uk/trac/ceda/ticket/22397

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

Legend:

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

    r8199 r8201  
    582582def createMO_Organization(name = None, contactInfo = None): 
    583583    ''' 
    584         Creates a new MO_Organization instance 
     584        Creates a new MO_Organization instance. 
     585        TEMPORARILY RETURNS A CI_ORGANIZATION BECAUSE A DB SCHEMA PROBLEM!!!! 
    585586        @param name: a String 
    586587        @param contactInfo: an array of CI_Contact         
    587588    '''        
    588     ci_party = MO_Organization() 
     589    ci_party = CI_Organisation() 
    589590    if name: 
    590591        ci_party.name = name 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/deployment.py

    r8199 r8201  
    3030from libs.migration.authors import authors 
    3131from logging import StreamHandler 
    32 import logging, datetime 
     32import logging 
     33from datetime import date 
    3334from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_onlinefunctioncode import CI_OnLineFunctionCode 
    3435from libs.migration.processor.check.check import moles3Append 
    3536from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_datetypecode import CI_DateTypeCode 
    3637from ea_model.iso_19115_2006_metadata_corrigendum.constraint_information.md_restrictioncode import MD_RestrictionCode 
     38from copy import deepcopy 
    3739 
    3840class DeploymentProcessor(object): 
     
    244246            if doi['href'] == '10.5285/E8F43A51-0198-4323-A926-FE69225D57DD': 
    245247                #dt = createDateTime('21', '11', '04', '01', '07', '25', '35') 
    246                 py_date = datetime.date(2011, 4, 1) 
     248                py_date = date(2011, 4, 1) 
    247249                dt = createDate(py_date) 
    248250                ci_date = createCI_Date(CI_DateTypeCode.cl_publication, date = dt) 
    249251            elif doi['href'] == '10.5285/78114093-E2BD-4601-8AE5-3551E62AEF2B': 
    250252                #dt = createDateTime('21', '11', '11', '29', '11', '37', '11') 
    251                 py_date = datetime.date(2011, 11, 29)                 
     253                py_date = date(2011, 11, 29)                 
    252254                dt = createDate(py_date)                 
    253255                ci_date = createCI_Date(CI_DateTypeCode.cl_publication, date = dt) 
     
    287289        if party: 
    288290            observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_publisher, [party])) 
    289             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_custodian, [party])) 
    290             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_distributor, [party])) 
    291             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_pointofcontact, [party])) 
    292             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_metadataowner, [party])) 
    293             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_curator, [party]))                                                             
     291            observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_custodian, deepcopy([party]))) 
     292            observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_distributor, deepcopy([party]))) 
     293            observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_pointofcontact, deepcopy([party]))) 
     294            observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_metadataowner, deepcopy([party]))) 
     295            observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_curator, deepcopy([party])))                                                             
    294296 
    295297    def _assignPhenomenonTime(self, observation):         
     
    313315    def _assignPermission(self, observation): 
    314316        access_link = findAccessLinksInMigrationDocument(self._deploymentMigration) 
     317        dwn_link = findDownloadLinksInMigrationDocument(self._deploymentMigration) 
    315318        if len(access_link) == 0: 
    316319            access_link = findAccessLinksInMigrationDocument(self._dataEntityMigration)  
     
    318321        i_accessConstraints = [] 
    319322        i_use_limitation = [] 
     323        md_legal_constraints = None 
    320324         
    321325        if len(access_link) == 0: 
    322             dwn_link = findDownloadLinksInMigrationDocument(self._deploymentMigration) 
    323         if len(dwn_link) == 0: 
    324             dwn_link = findDownloadLinksInMigrationDocument(self._dataEntityMigration) 
    325             if dwn_link and len(dwn_link) == 1:                 
    326                 i_use_limitation.append("These data are open access and available through %s." % (dwn_link['href']) ) 
    327                 #i_accessConstraints.append(MD_RestrictionCode.cl_) 
     326            if len(dwn_link) == 0: 
     327                dwn_link = findDownloadLinksInMigrationDocument(self._dataEntityMigration) 
     328                if dwn_link and len(dwn_link) == 1:                 
     329                    i_use_limitation.append("These data are open access and available through %s." % (dwn_link[0]['href']) ) 
     330                    #i_accessConstraints.append(MD_RestrictionCode.cl_) 
     331                    observation.permission = createMD_LegalConstraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints) 
    328332        else: 
    329333            if access_link and len(access_link) == 1: 
    330                 i_use_limitation.append("Access to these data is restricted. To obtain access please apply for access at: %s" % (access_link['href'])) 
     334                i_use_limitation.append("Access to these data is restricted. To obtain access please apply for access at: %s" % (access_link[0]['href'])) 
    331335                i_accessConstraints.append(MD_RestrictionCode.cl_restricted) 
    332                              
    333         createMD_LegalConstraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints) 
    334          
     336                observation.permission = createMD_LegalConstraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints)                 
     337                                     
    335338        '''                                 
    336339        contentDict = extractContent(self._deploymentMigration) 
Note: See TracChangeset for help on using the changeset viewer.