Ignore:
Timestamp:
02/05/12 11:54:02 (7 years ago)
Author:
mnagni
Message:

added a method on moles3epb to retrieve a CEDA_Observation author

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/MolesManager/moles3epb.py

    r8264 r8295  
    1616from sqlalchemy.orm import mapper 
    1717from MolesManager.ceda_guid import CedaGUID 
     18from ea_model.moles3_4.utilities.mo_responsiblepartyinfo import MO_ResponsiblePartyInfo 
     19from ea_model.moles3_4.utilities.mo_rolevalue import MO_RoleValue 
    1820 
    1921 
     
    110112        intSession = Moles3EPB._getSession(session) 
    111113        return intSession.query(CEDA_ObservationCollection, CEDA_Observation).filter(CEDA_ObservationCollection.id==obs_coll_id).filter(CEDA_Observation.id==obs_id).count() > 0 
     114 
     115    @classmethod 
     116    def observationAuthor(self, obs_id, session = None): 
     117        """ 
     118            Lists the CEDA_Observation author. 
     119            @param obs_id: the CEDA_Observation id             
     120            @return: True if the collection contains the given observation, False otherwise   
     121        """ 
     122        intSession = Moles3EPB._getSession(session) 
     123        ret = intSession.query(MO_ResponsiblePartyInfo).join(MO_Observation). \ 
     124            filter(MO_ResponsiblePartyInfo.role == MO_RoleValue.cl_author). \ 
     125            filter(MO_Observation.id == obs_id) 
     126        return ret 
    112127 
    113128    @classmethod 
Note: See TracChangeset for help on using the changeset viewer.