Changeset 8225 for mauRepo


Ignore:
Timestamp:
12/04/12 14:22:18 (8 years ago)
Author:
mnagni
Message:

Incomplete - # 22403: CEDA Observation - ceda Internal information
 http://team.ceda.ac.uk/trac/ceda/ticket/22403

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

Legend:

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

    r8221 r8225  
    4242from ea_model.ceda_metadatamodel.ceda_project.ceda_project import CEDA_Project 
    4343from ea_model.iso_19115_2006_metadata_corrigendum.metadata_entity_set_information.md_metadata import MD_Metadata 
     44from ea_model.ceda_metadatamodel.ceda_utilities.ceda_review import CEDA_Review 
    4445 
    4546base = '/exist/rest/atoms' 
     
    651652    return ci_party 
    652653 
    653 def createMO_ResponsiblePartyInfo_(role, i_party): 
     654def createMO_ResponsiblePartyInfo(role, i_party): 
    654655    """ 
    655656        @param role: a CI_RoleCode/MO_RoleValue assigned to this ResponsibleParty 
     
    660661    mo_responsableInfo.party.extend(i_party) 
    661662    return mo_responsableInfo 
    662  
    663 def createMO_ResponsiblePartyInfoAsCI_Organization(role, names): 
    664     ''' 
    665         @param role: a CI_RoleCode/MO_RoleValue assigned to this ResponsibleParty 
    666         @param names: the name assigned to each CI_Party 
    667     ''' 
    668     return createMO_ResponsiblePartyInfo(role, names, CI_Organisation) 
    669  
    670 def createMO_ResponsiblePartyInfoAsCI_Individual(role, names): 
    671     ''' 
    672         @param role: a CI_RoleCode/MO_RoleValue assigned to this ResponsibleParty 
    673         @param names: the name assigned to each CI_Party 
    674     ''' 
    675     return createMO_ResponsiblePartyInfo(role, names, CI_Individual) 
    676  
    677 def createMO_ResponsiblePartyInfo(role, names, partyType = CI_Party): 
    678     """ 
    679         @param role: a CI_RoleCode/MO_RoleValue assigned to this ResponsibleParty 
    680         @param names: the name assigned to each CI_Party 
    681         @param partyType: the CI_Party implementation to use  
    682     """ 
    683     mo_responsableInfo = MO_ResponsiblePartyInfo() 
    684     mo_responsableInfo.role = role 
    685     parties = [] 
    686     for name in names: 
    687         ci_org = partyType() 
    688         ci_org.name = name 
    689         parties.append(ci_org) 
    690     mo_responsableInfo.party = parties 
    691     return mo_responsableInfo 
    692  
    693663 
    694664 
     
    859829    return ceda_acquisition 
    860830 
     831def createCEDA_Review(reviewer, reviewFrequency, reviewStatus): 
     832    """ 
     833        Returns a new CEDA_Review 
     834        @param reviewer: an MO_ResponsibilityPartyInfo 
     835        @param reviewFrequency: a CEDA_ReviewFrequencyValue 
     836        @param reviewStatus: a CEDA_ReviewStatusValue 
     837    """ 
     838    ceda_review = CEDA_Review() 
     839    ceda_review.reviewer = reviewer 
     840    ceda_review.reviewFrequency = reviewFrequency  
     841    ceda_review.reviewStatus = reviewStatus            
     842    return ceda_review 
     843 
    861844def createCEDA_Project(abstract = None, publication_state = None, documentation = None, project_resource=None): 
    862845    ceda_project = CEDA_Project() 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/deployment.py

    r8221 r8225  
    1414    createTM_Position, createTM_Instant, extractMolesCreationDate,\ 
    1515    createDateTime, isoDateTimeStringToTimeDate, extractMolesProviderID,\ 
    16     DO_UKSSDC, createMO_ResponsiblePartyInfo_, createMO_Organization,\ 
     16    DO_UKSSDC, createMO_Organization,\ 
    1717    createCI_Contact, createCI_Address, createCI_OnlineResource,\ 
    1818    createCI_Telephone, extractMolesTemporalRange, isoDateStringToTimeDate,\ 
     
    2020    findLinksInDeployment, createMD_LegalConstraints, extractMolesQuality,\ 
    2121    createDQ_Element, createDQ_ConformanceResult, findUpdatedDate,\ 
    22     createMD_Metadata, createMO_OnlineResource 
     22    createMD_Metadata, createMO_OnlineResource, createCEDA_Review 
    2323from ea_model.moles3_4.utilities.mo_rolevalue import MO_RoleValue 
    2424from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation 
     
    4242from libs.migration.InfodbEPB import InfodbEPB 
    4343from ea_model.ceda_metadatamodel.ceda_result import ceda_curationvalue 
     44from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewfrequencyvalue import CEDA_ReviewFrequencyValue 
     45from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewstatusvalue import CEDA_ReviewStatusValue 
     46from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_rolecode import CI_RoleCode 
    4447 
    4548class DeploymentProcessor(object): 
     
    8083        ''' 
    8184        #First is assumend to be the author 
    82         parsedParties.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_author, authors[:1]))     
    83         parsedParties.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_coinvestigator, authors[1:]))             
     85        i_party = createMO_Organization(name = authors[:1]) 
     86        parsedParties.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_author, [i_party])) 
     87        i_party = [] 
     88        if len(authors) < 2: 
     89            return 
     90         
     91        for i_name in authors[:1]:  
     92            i_party.append(createMO_Organization(name = i_name))            
     93        parsedParties.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_coinvestigator, i_party))             
    8494 
    8595    def _addResponsiblePartyInfo(self, oldResponsiblePartyInfos, newResponsiblePartyInfo): 
     
    100110        for nm in names: 
    101111            i_party = creation_function(name = nm) 
    102             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(role, [i_party]))         
     112            observation.relatedParty.append(createMO_ResponsiblePartyInfo(role, [i_party]))         
    103113 
    104114    def _assignName(self, observation):         
     
    114124 
    115125        i_party = createMO_Organization(name = CEDA) 
    116         observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_curator, [i_party]))                                
     126        observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_curator, [i_party]))                                
    117127         
    118128        if authors.has_key(doc_authors['authors']): 
     
    332342         
    333343        if party: 
    334             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_publisher, [party])) 
    335             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_custodian, deepcopy([party]))) 
    336             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_distributor, deepcopy([party]))) 
    337             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_pointofcontact, deepcopy([party]))) 
    338             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_metadataowner, deepcopy([party]))) 
    339             observation.relatedParty.append(createMO_ResponsiblePartyInfo_(MO_RoleValue.cl_curator, deepcopy([party])))                                                             
     344            observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_publisher, [party])) 
     345            observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_custodian, deepcopy([party]))) 
     346            observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_distributor, deepcopy([party]))) 
     347            observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_pointofcontact, deepcopy([party]))) 
     348            observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_metadataowner, deepcopy([party]))) 
     349            observation.relatedParty.append(createMO_ResponsiblePartyInfo(MO_RoleValue.cl_curator, deepcopy([party])))                                                             
    340350 
    341351    def _assignPhenomenonTime(self, observation):         
     
    398408        i_contact = createCI_Citation("", date = i_date_stamp) 
    399409        ceda_observation.metadata = createMD_Metadata(date_stamp=i_date_stamp, contact = i_contact, language = "English") 
     410     
     411    def _assignInternalReview(self, ceda_observation): 
     412        i_party = createCI_Individual(name = 'Graham Parton') 
     413        i_reviewer = createMO_ResponsiblePartyInfo(MO_RoleValue.cl_processor, [i_party]) 
     414        ceda_observation.internalReview = \ 
     415            createCEDA_Review(reviewer=i_reviewer, reviewFrequency=CEDA_ReviewFrequencyValue.cl_yearly, \ 
     416                              reviewStatus=CEDA_ReviewStatusValue.cl_required)    
    400417     
    401418    def createNewObservation(self): 
     
    416433        self._assignMoles2Link(ceda_observation) 
    417434        self._assignQuality(ceda_observation)                 
     435        self._assignInternalReview(ceda_observation)         
    418436        #self._assignLanguage(ceda_observation)         
    419437        Moles3EPB.addCedaObject(ceda_observation, self._migrationSessions.molesSession, True) 
Note: See TracChangeset for help on using the changeset viewer.