Changeset 8496


Ignore:
Timestamp:
08/08/12 14:52:24 (7 years ago)
Author:
mnagni
Message:

Incomplete - # 22534: Add versiojn number to the gui page
 http://team.ceda.ac.uk/trac/ceda/ticket/22534

Location:
mauRepo/MolesManager/trunk/cedaMoles
Files:
13 edited

Legend:

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

    r8494 r8496  
    4646from ea_model.ceda_metadatamodel.ceda_project.ceda_project import CEDA_Project 
    4747from cedaMoles.MolesManager.codelist import MM_RoleValue, getCLValue 
    48 from cedaMoles.libs.migration.processor.commons import fromPhenomenonTimeToString 
     48from cedaMoles.libs.migration.processor.commons import from_pt_to_string 
    4949from datetime import datetime 
    5050from ascore.utils import synchAttributes 
     
    405405             
    406406        pt =  member.phenomenonTime 
    407         ptString = fromPhenomenonTimeToString(pt) 
     407        ptString = from_pt_to_string(pt) 
    408408        if ptString[0] is not None:                     
    409409            ptStart.append(datetime.strptime(ptString[0], dateFormat)) 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/commons.py

    r8495 r8496  
    118118MOLES_NS = "{http://ndg.nerc.ac.uk/schema/moles2beta}" 
    119119#htmlNS = "{http://www.w3.org/1999/xhtml}" 
    120 GEORSS_NS="{http://www.georss.org/georss/10}" 
    121 GML_NS="{http://www.opengis.net/gml}" 
     120GEORSS_NS = "{http://www.georss.org/georss/10}" 
     121GML_NS = "{http://www.opengis.net/gml}" 
    122122DATE_FORMAT = '%Y-%m-%d' 
    123123DATETIME_FORMAT = DATE_FORMAT + 'T%H:%M:%SZ' 
     
    134134                                 namespaceHTMLElements=False) 
    135135 
    136 def calculateHash(text): 
     136def calculate_hash(text): 
    137137    """ 
    138138        Returns an md5 hexadecimal representation of the given text 
     
    144144    return encoder.hexdigest() 
    145145 
    146 def buildExistDocPath(doc_status, doc_type, doc_owner, doc_name): 
     146def build_exist_doc_path(doc_status, doc_type, doc_owner, doc_name): 
    147147    ''' 
    148148        @param doc_status: one value from commons.docStatus 
     
    151151        @param doc_name: one value from commons.DOC_OWNERS         
    152152    '''         
    153     return '%s/%s' % (buildExistOwnerPath(doc_status, doc_type, doc_owner), doc_name) 
    154  
    155 def buildExistOwnerPath(doc_status, doc_type, doc_owner): 
     153    return '%s/%s' % (_build_exist_owner_path(doc_status, doc_type, doc_owner), doc_name) 
     154 
     155def _build_exist_owner_path(doc_status, doc_type, doc_owner): 
    156156    ''' 
    157157        @param doc_status: one value from commons.docStatus 
     
    159159        @param doc_owner: one value from commons.DOC_OWNERS 
    160160    '''         
    161     return '%s/%s' % (buildExistTypePath(doc_status, doc_type), doc_owner) 
    162  
    163 def buildExistTypePath(doc_status, doc_type): 
     161    return '%s/%s' % (build_exist_type_path(doc_status, doc_type), doc_owner) 
     162 
     163def build_exist_type_path(doc_status, doc_type): 
    164164    ''' 
    165165        @param doc_status: one value from commons.docStatus 
    166166        @param doc_type: one value from commons.docCollections  
    167167    '''         
    168     return '%s/%s' % (buildExistStatusPath(doc_status), doc_type) 
    169  
    170 def buildExistStatusPath(doc_status): 
    171     ''' 
    172         @param doc_status: one value from commons.docStatus  
    173     '''         
    174     return '/exist/rest/atoms/%s' % (doc_status) 
    175  
    176 def getAtomDocumentByMO(migration_object): 
     168    return '%s/%s' % ('/exist/rest/atoms/%s' % (doc_status), doc_type) 
     169 
     170def _get_atom_document_by_mo(migration_object): 
    177171    if migration_object is None: 
    178172        raise Exception("migrationObject is None") 
     
    180174                   'DataEntityMigration': DT_DATA_ENTITIES, \ 
    181175                   'DeploymentDataMigration': DT_DEPLOYMENT_DATA}      
    182     return getAtomDocumentAsElementtree(migration_object.doc_status, \ 
     176    return get_atom_document_as_elementtree(migration_object.doc_status, \ 
    183177                                    mo_type_dict[type(migration_object).__name__], \ 
    184178                                    migration_object.doc_owner, migration_object.doc_name) 
    185179 
    186 def getAtomDocumentHashByMO(migration_object): 
     180def get_atom_document_hash_by_mo(migration_object): 
    187181    if migration_object is None: 
    188182        raise Exception("migrationObject is None")     
     
    193187                                  mo_type_dict[type(migration_object).__name__],\ 
    194188                                   migration_object.doc_owner, migration_object.doc_name) 
    195     return calculateHash(text) 
    196  
    197 def getAtomDocumentHash(doc_status, doc_type, doc_owner, doc_name): 
    198     source = buildExistDocPath(doc_status, doc_type, doc_owner, doc_name) 
    199     text = _get_document(source) 
    200     return calculateHash(text) 
    201  
    202 def hasMOBeenProcessed(migration_object): 
     189    return calculate_hash(text) 
     190 
     191def has_mo_been_processed(migration_object): 
    203192    ''' 
    204193        Checks if a migration object has been already processed. 
     
    217206    return True 
    218207 
    219 def hasMOSameHash(migration_object): 
     208def has_mo_same_hash(migration_object): 
    220209    ''' 
    221210        Checks if a migration object has changed. 
     
    225214            same of the migrationObject, otherwise False 
    226215    ''' 
    227     if not hasMOBeenProcessed(migration_object): 
     216    if not has_mo_been_processed(migration_object): 
    228217        return False 
    229     return getAtomDocumentHashByMO(migration_object) == migration_object.doc_hash 
    230  
    231 def getAtomDocumentByType(migration_object, doc_type): 
    232     if migration_object is None: 
    233         raise Exception("migrationObject is None")     
    234     return getAtomDocumentAsElementtree(migration_object.doc_status, \ 
    235                                         doc_type, migration_object.doc_owner, \ 
    236                                         migration_object.doc_name) 
     218    return get_atom_document_hash_by_mo(migration_object) == migration_object.doc_hash 
    237219 
    238220def _get_atom_document_as_text(doc_status, doc_type, doc_owner, doc_name): 
    239     source = buildExistDocPath(doc_status, doc_type, doc_owner, doc_name) 
     221    source = build_exist_doc_path(doc_status, doc_type, doc_owner, doc_name) 
    240222    return _get_document(source) 
    241223 
    242 def getAtomDocumentAsElementtree(doc_status, doc_type, doc_owner, doc_name): 
    243     source = buildExistDocPath(doc_status, doc_type, doc_owner, doc_name) 
     224def get_atom_document_as_elementtree(doc_status, doc_type, doc_owner, doc_name): 
     225    source = build_exist_doc_path(doc_status, doc_type, doc_owner, doc_name) 
    244226    return _get_xml_document(source) 
    245227 
     
    275257    conn = HTTPConnection(host = HOST, port = PORT) 
    276258    conn.connect() 
    277     #req = conn.request('GET', source) 
     259    conn.request('GET', source) 
    278260    res = conn.getresponse() 
    279261    xml_doc = res.read() 
    280     ''' 
    281     print (xmlDoc) 
    282     ''' 
    283262    conn.close() 
    284263    return xml_doc 
     
    289268    return element.text 
    290269 
    291 def findMolesCreationDate(resource_xml): 
     270def find_moles_creation_date(resource_xml): 
    292271    creation_date = resource_xml.find('%sentity/%smolesISO/%screated' \ 
    293272                                    % (MOLES_NS, MOLES_NS, MOLES_NS)) 
    294273    return _return_not_none_text(creation_date) 
    295274 
    296 def findMolesPublishedDate(resource_xml): 
     275def _find_moles_published_date(resource_xml): 
    297276    creation_date = resource_xml.find('%sentity/%smolesISO/%spublished' \ 
    298277                                    % (MOLES_NS, MOLES_NS, MOLES_NS)) 
    299278    return _return_not_none_text(creation_date) 
    300279 
    301 def findMolesLineage(data_entity_migration): 
    302     resource_xml = getAtomDocumentByMO(data_entity_migration) 
     280def find_moles_lineage(data_entity_migration): 
     281    resource_xml = _get_atom_document_by_mo(data_entity_migration) 
    303282    lineage = resource_xml.find('%sentity/%smolesISO/%slineage' \ 
    304283                               % (MOLES_NS, MOLES_NS, MOLES_NS)) 
     
    307286    return lineage.text 
    308287 
    309 def extractMolesProviderID(migration_object): 
    310     resource_xml = getAtomDocumentByMO(migration_object) 
     288def extract_moles_provider_id(migration_object): 
     289    resource_xml = _get_atom_document_by_mo(migration_object) 
    311290    provider_id = resource_xml.find('%sentity/%smolesISO/%sproviderID' \ 
    312291                                   % (MOLES_NS, MOLES_NS, MOLES_NS)) 
    313292    return _return_not_none_text(provider_id) 
    314293 
    315 def extractMolesQuality(migration_object): 
    316     resourceXML = getAtomDocumentByMO(migration_object) 
    317     quality = resourceXML.find('%sentity/%smolesISO/%squality' \ 
    318                                % (MOLES_NS, MOLES_NS, MOLES_NS)) 
    319     return _return_not_none_text(quality) 
    320  
    321 def extractMolesTemporalRange(migration_object): 
    322     resource_xml = getAtomDocumentByMO(migration_object) 
     294def extract_moles_temporal_range(migration_object): 
     295    resource_xml = _get_atom_document_by_mo(migration_object) 
    323296    temporal_range = resource_xml.find('%stemporalRange' % (MOLES_NS)) 
    324297    return _return_not_none_text(temporal_range) 
    325298 
    326 def extractMolesCreationDate(migration_object): 
    327     resource_xml = getAtomDocumentByMO(migration_object) 
    328     return findMolesCreationDate(resource_xml) 
    329  
    330 def extractMolesPublishedDate(migration_object): 
    331     resource_xml = getAtomDocumentByMO(migration_object) 
    332     return findMolesPublishedDate(resource_xml) 
    333  
    334 def extractQuality(data_entity_migration): 
    335     resource_xml = getAtomDocumentByMO(data_entity_migration) 
     299def extract_moles_creation_date(migration_object): 
     300    resource_xml = _get_atom_document_by_mo(migration_object) 
     301    return find_moles_creation_date(resource_xml) 
     302 
     303def extract_moles_published_date(migration_object): 
     304    resource_xml = _get_atom_document_by_mo(migration_object) 
     305    return _find_moles_published_date(resource_xml) 
     306 
     307def extract_quality(data_entity_migration): 
     308    resource_xml = _get_atom_document_by_mo(data_entity_migration) 
    336309    quality = resource_xml.find('%sentity/%smolesISO/%squality' \ 
    337310                               % (MOLES_NS, MOLES_NS, MOLES_NS)) 
    338311    return _return_not_none_text(quality) 
    339312 
    340 def extractUpdateFrequency(data_entity_migration): 
    341     resource_xml = getAtomDocumentByMO(data_entity_migration) 
     313def extract_update_frequency(data_entity_migration): 
     314    resource_xml = _get_atom_document_by_mo(data_entity_migration) 
    342315    update_frequency = resource_xml.find('%sentity/%smolesISO/%supdateFrequency' \ 
    343316                                        % (MOLES_NS, MOLES_NS, MOLES_NS)) 
    344317    return _return_not_none_text(update_frequency) 
    345318 
    346 def extractContent(data_entity_migration): 
     319def extract_content(data_entity_migration): 
    347320    """ 
    348321        Returns a dictionary containing the div composing the 
    349322        <content> element in a dataentity document. 
    350323    """ 
    351     resource_xml = getAtomDocumentByMO(data_entity_migration) 
     324    resource_xml = _get_atom_document_by_mo(data_entity_migration) 
    352325    content = resource_xml.find('%scontent' % (ATOM_NS)) 
    353326    text = _return_not_none_text(content) 
     
    362335    return contentDict 
    363336 
    364 def findAuthorsInResource(resource_migration): 
     337def find_authors_in_resource(resource_migration): 
    365338    ''' 
    366339        Returns a dictionary with the following keys: 
     
    369342    ''' 
    370343    ret = {}    
    371     resource_xml = getAtomDocumentByMO(resource_migration) 
    372     ret['authors'] = findAuthorInResource(resource_xml) 
    373     ret['contributors'] = findContributorInResource(resource_xml) 
     344    resource_xml = _get_atom_document_by_mo(resource_migration) 
     345    ret['authors'] = _find_author_in_resource(resource_xml) 
     346    ret['contributors'] = _find_contributor_in_resource(resource_xml) 
    374347    return ret 
    375348 
    376 def findAuthorInResource(resource_xml):  
     349def _find_author_in_resource(resource_xml):  
    377350    author = resource_xml.find('%sauthor/%sname' % (ATOM_NS, ATOM_NS)) 
    378351    return _return_not_none_text(author) 
    379352 
    380 def findContributorInResource(resource_xml):  
     353def _find_contributor_in_resource(resource_xml):  
    381354    contributors = resource_xml.find('%scontributor/%sname' % (ATOM_NS, ATOM_NS)) 
    382355    return _return_not_none_text(contributors) 
    383356 
    384 def findPublishedDate(resource_migration): 
    385     resource_xml = getAtomDocumentByMO(resource_migration) 
     357def find_published_date(resource_migration): 
     358    resource_xml = _get_atom_document_by_mo(resource_migration) 
    386359    publishedDate = resource_xml.find('%spublished' % (ATOM_NS)) 
    387360    return _return_not_none_text(publishedDate) 
    388361 
    389 def findUpdatedDate(resource_migration): 
    390     resource_xml = getAtomDocumentByMO(resource_migration) 
     362def find_updated_date(resource_migration): 
     363    resource_xml = _get_atom_document_by_mo(resource_migration) 
    391364    publishedDate = resource_xml.find('%supdated' % (ATOM_NS)) 
    392365    return _return_not_none_text(publishedDate) 
    393366 
    394 def findSummary(resource_migration): 
     367def find_summary(resource_migration): 
    395368    """ 
    396369        Returns the <entry><summary> tag of an atom document 
     
    398371        @return: the <summary> value or None if empty 
    399372    """ 
    400     resource_xml = getAtomDocumentByMO(resource_migration) 
     373    resource_xml = _get_atom_document_by_mo(resource_migration) 
    401374    summary = resource_xml.find('%ssummary' % (ATOM_NS)) 
    402375    return _return_not_none_text(summary) 
    403376 
    404 def findID(data_ent_xml): 
     377def find_id(data_ent_xml): 
    405378    ent_id = data_ent_xml.find('%sid' % (ATOM_NS)) 
    406379    return _return_not_none_text(ent_id) 
     
    422395    return links_dict 
    423396 
    424 def findLinksInMigrationDocument(data_entity_migration): 
    425     data_ent_XML = getAtomDocumentByMO(data_entity_migration) 
     397def find_links_in_migration_document(data_entity_migration): 
     398    data_ent_XML = _get_atom_document_by_mo(data_entity_migration) 
    426399    links_dict = _extract_links(data_ent_XML, LINK_MARKERS) 
    427400    return links_dict 
     
    429402 
    430403 
    431 def findDownloadLinksInMigrationDocument(migration_object): 
     404def find_download_links_in_migration_document(migration_object): 
    432405    """ 
    433406        Return a list of dictionaries describing a <link rel="...DOWNLOAD..."> tag type 
     
    436409        @return: a list of dictionaries 
    437410    """ 
    438     links_dict = findLinksInMigrationDocument(migration_object) 
     411    links_dict = find_links_in_migration_document(migration_object) 
    439412    if links_dict.has_key('DOWNLOAD'): 
    440413        return links_dict['DOWNLOAD']     
    441414    return {}        
    442415 
    443 def findAccessLinksInMigrationDocument(migration_object): 
     416def find_access_links_in_migration_document(migration_object): 
    444417    """ 
    445418        Return a list of dictionaries describing a <link rel="...ACCESS..."> tag type 
     
    448421        @return: a list of dictionaries 
    449422    """ 
    450     links_dict = findLinksInMigrationDocument(migration_object) 
     423    links_dict = find_links_in_migration_document(migration_object) 
    451424    if links_dict.has_key('ACCESS'): 
    452425        return links_dict['ACCESS']      
    453426    return {}     
    454427 
    455 def findDocumentationInMigrationDocument(migration_object): 
     428def find_documentation_in_migration_document(migration_object): 
    456429    """ 
    457430        Return a list of dictionaries describing a <link rel="...DOCUMENTATION...">  
     
    461434        @return: a list of dictionaries 
    462435    """ 
    463     links_dict = findLinksInMigrationDocument(migration_object) 
     436    links_dict = find_links_in_migration_document(migration_object) 
    464437    if links_dict.has_key('DOCUMENTATION'): 
    465438        return links_dict['DOCUMENTATION']      
    466439    return {} 
    467440 
    468 def findDOIInMigrationDocument(migration_object): 
     441def find_doi_in_migration_document(migration_object): 
    469442    """ 
    470443        Return a dictionary describing a <link rel="...DOCUMENTATION..."> tag type 
     
    473446        @return: a dictionary relative to the DOI, None otherwise 
    474447    """ 
    475     for link in findDocumentationInMigrationDocument(migration_object): 
     448    for link in find_documentation_in_migration_document(migration_object): 
    476449        if link['href'].startswith('http://dx.doi.org/doi:'): 
    477450            return link 
    478451    return None 
    479452 
    480 def findDeploymentsInDE(data_entity_migration): 
    481     links_dict = findLinksInMigrationDocument(data_entity_migration) 
     453def find_deployments_in_de(data_entity_migration): 
     454    links_dict = find_links_in_migration_document(data_entity_migration) 
    482455    links = _extract_links_by_marker(links_dict, 'Deployment') 
    483456    return [depName + '.atom' for depName in links] 
    484457 
    485 def findSubTypeInDPT(resourceMigration): 
    486     resource_xml = getAtomDocumentByMO(resourceMigration) 
     458def find_subtype_in_dpt(resourceMigration): 
     459    resource_xml = _get_atom_document_by_mo(resourceMigration) 
    487460    categories = resource_xml.findall('%scategory' % (ATOM_NS)) 
    488461    for category in categories: 
     
    490463            return category.get("label")     
    491464         
    492 def extractTitle(deploymentMigration): 
    493     resource_xml = getAtomDocumentByMO(deploymentMigration) 
     465def extract_title(deploymentMigration): 
     466    resource_xml = _get_atom_document_by_mo(deploymentMigration) 
    494467    title = resource_xml.find('%stitle' % (ATOM_NS)) 
    495468    return _return_not_none_text(title) 
    496469 
    497 def extractSummary(migrationObject): 
    498     resource_xml = getAtomDocumentByMO(migrationObject) 
     470def extract_summary(migrationObject): 
     471    resource_xml = _get_atom_document_by_mo(migrationObject) 
    499472    summary = resource_xml.find('%ssummary' % (ATOM_NS)) 
    500473    return _return_not_none_text(summary) 
    501474 
    502 def extractGeographicExtentInMigrationDocument(migration_object): 
     475def extract_ge_in_migration_doc(migration_object): 
    503476    """ 
    504477        Extracts if existing the georss:where/gel:Enveloper/upper-lowerCorner elements. 
     
    508481        the values are float 
    509482    """ 
    510     resource_xml = getAtomDocumentByMO(migration_object) 
     483    resource_xml = _get_atom_document_by_mo(migration_object) 
    511484    upper_corner = resource_xml.find('%swhere/%sEnvelope/%supperCorner' \ 
    512485                                   % (GEORSS_NS, GML_NS, GML_NS)) 
     
    521494    return ret 
    522495 
    523 def findLinksInDeployment(migration_object): 
     496def find_links_in_deployment(migration_object): 
    524497    """ 
    525498        Returns a dictionary of links owned by the given dataEntity document 
     
    528501    """ 
    529502    links = {} 
    530     links_dict = findLinksInMigrationDocument(migration_object) 
     503    links_dict = find_links_in_migration_document(migration_object) 
    531504    for marker in LINK_MARKERS:     
    532505        links[marker] = _extract_links_by_marker(links_dict, marker) 
     
    548521    return dpt 
    549522 
    550  
    551 def getResourceRefs(deployment_refs): 
    552     ''' 
    553         Returns a list of Elements representing the inner resource reference items 
    554         @param resourceRefs: the name of the eXist collection name below the  
    555         'deployments' one 
    556     '''   
    557     xml_depl = _get_xml_document(deployment_refs) 
    558     return xml_depl.findall('%scollection/%sresource' % (EXIST_NS, EXIST_NS)) 
    559  
    560 def getOwnerRefs(doc_status, doc_type, doc_owner): 
     523def get_owner_refs(doc_status, doc_type, doc_owner): 
    561524    ''' 
    562525        Returns a list of Elements representing the inner resource reference items 
     
    564527        'deployments' one 
    565528    '''       
    566     xml_depl = _get_xml_document(buildExistOwnerPath(doc_status, doc_type, doc_owner)) 
     529    xml_depl = _get_xml_document(_build_exist_owner_path(doc_status, doc_type, doc_owner)) 
    567530    return xml_depl.findall('%scollection/%sresource' % (EXIST_NS, EXIST_NS)) 
    568531 
    569 def getTypeRefs(docStatus, docType): 
    570     ''' 
    571         Returns a list of Elements representing the inner resource reference items 
    572         @param resourceRefs: the name of the eXist collection name below the  
    573         'deployments' one 
    574     '''       
    575     xml_depl = _get_xml_document(buildExistTypePath(docStatus, docType)) 
    576     return xml_depl.findall('%scollection/%sresource' % (EXIST_NS, EXIST_NS)) 
    577  
    578  
    579  
    580 def getCollectionRefs(published_refs): 
     532def get_collection_refs(published_refs): 
    581533    ''' 
    582534        Returns a list of Elements representing the inner deployment reference items 
     
    587539    return xml_publ.findall('%scollection/%scollection' % (EXIST_NS, EXIST_NS)) 
    588540 
    589 def getResource(source, resource_name): 
    590     resource_source = '%s/%s' % (source, resource_name) 
    591     resource_doc = _get_document(resource_source) 
    592     return XML(resource_doc) 
    593  
    594 def createMD_Keywords(keywords, k_type=None, thesaurusName=None): 
     541def create_md_keywords(keywords, k_type=None, thesaurusName=None): 
    595542    ''' 
    596543        Creates a new MD_Keywords instance. 
     
    606553     
    607554 
    608 def createDateTime(datetime): 
     555def create_datetime(datetime): 
    609556    ''' 
    610557        Creates a new DateTime instance. 
     
    624571    return dateTime         
    625572         
    626 def createDate(date): 
     573def create_date(date): 
    627574    ''' 
    628575        Creates a new Date instance. 
     
    636583    return idate        
    637584         
    638 def createTM_Position(anyOther = None, \ 
     585def create_tm_position(anyOther = None, \ 
    639586                      date8601 = None, \ 
    640587                      dateTime8601 = None, \ 
     
    658605    return tm_position             
    659606 
    660 def createTM_Instant(position): 
     607def create_tm_instant(position): 
    661608    ''' 
    662609        Creates a new TM_Position instance 
     
    667614    return tm_instant 
    668615 
    669 def createTM_Period(begin, end): 
     616def create_tm_period(begin, end): 
    670617    ''' 
    671618        Creates a new TM_Position instance 
     
    677624    return tm_period 
    678625 
    679 def createCI_Address(deliveryPoint = None, electronicMailAddress = None, \ 
     626def create_ci_address(deliveryPoint = None, electronicMailAddress = None, \ 
    680627                     city = None, country = None, postalCode = None): 
    681628    ''' 
     
    702649    return ci_address 
    703650 
    704 def createCI_OnlineResource(linkage, name=None): 
     651def create_ci_onlineresource(linkage, name=None): 
    705652    ''' 
    706653        Creates a new CI_OnlineResource instance 
     
    714661    return ci_online_resource 
    715662 
    716 def createCI_Telephone(voice=None, facsimile=None): 
     663def create_ci_telephone(voice=None, facsimile=None): 
    717664    ''' 
    718665        Creates a new CI_Telephone instance 
     
    727674    return ci_telephone 
    728675 
    729 def createCI_Contact(phone, address = None, onlineResource = None): 
     676def create_ci_contact(phone, address = None, onlineResource = None): 
    730677    ''' 
    731678        Creates a new CI_Contact instance 
     
    742689    return ci_contact 
    743690 
    744 def createMO_Individual(name = None, contactInfo = None): 
     691def create_mo_individual(name = None, contactInfo = None): 
    745692    ''' 
    746693        Creates a new MO_Individual instance 
     
    755702    return ci_party 
    756703 
    757 def createMO_Organization(name = None, contactInfo = None): 
     704def create_mo_organization(name = None, contactInfo = None): 
    758705    ''' 
    759706        Creates a new MO_Organization instance. 
     
    768715    return ci_party 
    769716 
    770 def createMO_ResponsiblePartyInfo(role, i_party): 
     717def create_mo_responsible_party_info(role, i_party): 
    771718    """ 
    772719        @param role: a CI_RoleCode/MO_RoleValue assigned to this ResponsibleParty 
     
    779726 
    780727 
    781 def createCI_Date(dateType, date = None): 
     728def create_ci_date(dateType, date = None): 
    782729    """ 
    783730        Creates a new CI_Date 
     
    791738    return ci_date 
    792739 
    793 def createCI_Citation(title, date = None, icitedResponsibleParty = None): 
     740def create_ci_citation(title, date = None, icitedResponsibleParty = None): 
    794741    """ 
    795742        Creates a new CI_Citation 
     
    806753    return ci_citation 
    807754 
    808 def createMD_Constraints(useLimitation = None): 
     755def create_md_constraints(useLimitation = None): 
    809756    """ 
    810757        Creates a new MD_Constrains 
     
    816763    return md_constraints 
    817764 
    818 def createMD_LegalConstraints(useLimitation = None, accessConstrains = None): 
     765def create_md_legal_constraints(useLimitation = None, accessConstrains = None): 
    819766    """ 
    820767        Creates a new MD_LegalConstrains 
     
    829776    return md_legalconstraints 
    830777 
    831 def createMD_Identifier(code, authority = None): 
     778def create_md_identifier(code, authority = None): 
    832779    """ 
    833780        Creates a new MD_Identifier 
     
    843790    return md_identifier 
    844791 
    845 def createCI_ResponsibleParty(role, organizationName = None, individualName = None): 
     792def create_ci_responsible_party(role, organizationName = None, individualName = None): 
    846793    """ 
    847794        Creates a new CI_ResponsibeParty 
     
    856803    return ci_responsible_party 
    857804 
    858 def createMD_Metadata(date_stamp, contact, language = None): 
     805def create_md_metadata(date_stamp, contact, language = None): 
    859806    """ 
    860807        Creates a new MD_Metadata 
     
    871818    return md_metadata 
    872819 
    873 def createMO_OnlineResource(linkage, instance = None, name = None, function = None, \ 
     820def create_mo_online_resource(linkage, instance = None, name = None, function = None, \ 
    874821                            description = None, applicationProfile = None): 
    875822    """ 
     
    895842    return on_line_resource         
    896843 
    897 def createCEDA_Result(curation_category, internal_path, source = None): 
     844def create_ceda_result(curation_category, internal_path, source = None): 
    898845    """ 
    899846        Creates a new CEDA_Result 
     
    911858 
    912859 
    913 def createDQ_ConformanceResult(explanation, pass_, specification): 
     860def create_dq_conformance_result(explanation, pass_, specification): 
    914861    """ 
    915862        Creates a DQ_ConformanceResult instance 
     
    924871    return dq_conformanceResult 
    925872 
    926 def createDQ_Element(result): 
     873def create_dq_element(result): 
    927874    """ 
    928875        Creates a DQ_Element instance 
     
    934881    return dq_element 
    935882 
    936 def createEX_GeographicBoundingBox(east, north, west, south): 
     883def create_ex_geographic_boundingbox(east, north, west, south): 
    937884    """ 
    938885        Creates an EX_GeographicBoundingBox instance 
     
    949896    return ex_geographic_bb 
    950897     
    951 def createCEDA_Processing(): 
     898def create_ceda_processing(): 
    952899    ceda_processing = CEDA_Processing() 
    953900    return ceda_processing 
    954901 
    955902 
    956 def createCEDA_Instrument(): 
     903def create_ceda_instrument(): 
    957904    ceda_instrument = CEDA_Instrument() 
    958905    return ceda_instrument 
    959906 
    960 def createCEDA_CompositeProcess(): 
     907def create_ceda_composite_process(): 
    961908    ceda_cp = CEDA_CompositeProcess() 
    962909    return ceda_cp 
    963910 
    964 def createCEDA_Acquisition(): 
     911def create_ceda_acquisition(): 
    965912    ceda_acquisition = CEDA_Acquisition() 
    966913    return ceda_acquisition 
    967914 
    968 def createCEDA_Review(reviewer, reviewFrequency, reviewStatus): 
     915def create_ceda_review(reviewer, reviewFrequency, reviewStatus): 
    969916    """ 
    970917        Returns a new CEDA_Review 
     
    979926    return ceda_review 
    980927 
    981 def createCEDA_Project(abstract = None, publication_state = None, \ 
     928def create_ceda_project(abstract = None, publication_state = None, \ 
    982929                       documentation = None, project_resource=None): 
    983930    ceda_project = CEDA_Project() 
     
    992939    return ceda_project 
    993940 
    994 def fromDateStringToPhenomenonTime(doc_phenomenon_time): 
     941def from_date_string_to_pt(doc_phenomenon_time): 
    995942    """ 
    996943        Transforms a date string like '2002-07-22' (startDate) in a TM_Instant instance or    
     
    1002949        if '/' in doc_phenomenon_time: 
    1003950            period = doc_phenomenon_time.split('/') 
    1004             begin_date = createDate(isoDateStringToTimeDate(period[0])) 
    1005             begin_position = createTM_Position(date8601 = begin_date) 
    1006             begin_tm_instant = createTM_Instant(begin_position) 
     951            begin_date = create_date(isoDateStringToTimeDate(period[0])) 
     952            begin_position = create_tm_position(date8601 = begin_date) 
     953            begin_tm_instant = create_tm_instant(begin_position) 
    1007954             
    1008             end_date = createDate(isoDateStringToTimeDate(period[1])) 
    1009             end_position = createTM_Position(date8601 = end_date) 
    1010             end_tm_instant = createTM_Instant(end_position) 
     955            end_date = create_date(isoDateStringToTimeDate(period[1])) 
     956            end_position = create_tm_position(date8601 = end_date) 
     957            end_tm_instant = create_tm_instant(end_position) 
    1011958             
    1012             pt = createTM_Period(begin_tm_instant, end_tm_instant) 
     959            pt = create_tm_period(begin_tm_instant, end_tm_instant) 
    1013960        else: 
    1014             tm_position = createTM_Position(date8601 = \ 
    1015                                             createDate(isoDateStringToTimeDate(doc_phenomenon_time))) 
    1016             pt = createTM_Instant(tm_position) 
     961            tm_position = create_tm_position(date8601 = \ 
     962                                            create_date(isoDateStringToTimeDate(doc_phenomenon_time))) 
     963            pt = create_tm_instant(tm_position) 
    1017964        return pt 
    1018965 
    1019 def fromPhenomenonTimeToString(phenomenonTime): 
     966def from_pt_to_string(phenomenonTime): 
    1020967    """ 
    1021968        Transforms a TM_Instant instance in a date string like '2002-07-22' (startDate) or    
     
    1036983    return startDate, endDate 
    1037984 
    1038 def comparePhenomenonTimes(p1, p2): 
    1039     s1 = fromPhenomenonTimeToString(p1) 
    1040     s2 = fromPhenomenonTimeToString(p2) 
     985def compare_phenomenon_times(p1, p2): 
     986    s1 = from_pt_to_string(p1) 
     987    s2 = from_pt_to_string(p2) 
    1041988    return s1[0] == s2[0] and s1[1] == s2[1]  
    1042989 
     
    1045992    return str(datetime.date(int(idate.year), int(idate.month), int(idate.day))) 
    1046993 
    1047 def fromGeographicBoundingBoxToString(gbb): 
     994def _from_geographic_bb_to_string(gbb): 
    1048995    if gbb is None: 
    1049996        return None 
     
    1052999     
    10531000def compareGeographicBoundingBoxes(gb1, gb2): 
    1054     return fromGeographicBoundingBoxToString(gb1) == fromGeographicBoundingBoxToString(gb2) 
     1001    return _from_geographic_bb_to_string(gb1) == _from_geographic_bb_to_string(gb2) 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/dataEntity.py

    r8494 r8496  
    3434    migrationObjectDescription, NoAssociatedDeployments,\ 
    3535    NoGeographicalExtensionException, NoCitationException 
    36 from cedaMoles.libs.migration.processor.commons import findDeploymentsInDE,\ 
    37     createMD_Identifier, extractContent,\ 
    38     hasMOSameHash, createCI_Citation, createCI_Date, findPublishedDate,\ 
    39     isoDateTimeStringToTimeDate, findUpdatedDate, createDate,\ 
    40     calculateHash, findDOIInMigrationDocument,\ 
    41     hasMOBeenProcessed, getAtomDocumentHashByMO, extractTitle, extractSummary,\ 
    42     createEX_GeographicBoundingBox, fromDateStringToPhenomenonTime,\ 
    43     comparePhenomenonTimes, compareGeographicBoundingBoxes 
     36from cedaMoles.libs.migration.processor.commons import find_deployments_in_de,\ 
     37    create_md_identifier, extract_content,\ 
     38    has_mo_same_hash, create_ci_citation, create_ci_date, find_published_date,\ 
     39    isoDateTimeStringToTimeDate, find_updated_date, create_date,\ 
     40    calculate_hash, find_doi_in_migration_document,\ 
     41    has_mo_been_processed, get_atom_document_hash_by_mo, extract_title, extract_summary,\ 
     42    create_ex_geographic_boundingbox, from_date_string_to_pt,\ 
     43    compare_phenomenon_times, compareGeographicBoundingBoxes 
    4444from cedaMoles.libs.migration.processor.deployment import DeploymentProcessor 
    4545from logging import StreamHandler 
     
    6969        #    raise MigrationObjectException("DataEntityProcessor cannot process an None item") 
    7070        self._dataEntityMigration = dataEntityMigration         
    71         self._dataEntityHasSameHash = hasMOSameHash(self._dataEntityMigration)     
    72         self._dataEntityHasBeenProcessed = hasMOBeenProcessed(self._dataEntityMigration)    
     71        self._dataEntityHasSameHash = has_mo_same_hash(self._dataEntityMigration)     
     72        self._dataEntityHasBeenProcessed = has_mo_been_processed(self._dataEntityMigration)    
    7373        self.epbRepo = epbRepo 
    7474        self._report = [] 
     
    8080            east, north = upperCornerData.split() 
    8181            west, south = lowerCornerData.split() 
    82             geographicExtent = createEX_GeographicBoundingBox(float(east), float(north), \ 
     82            geographicExtent = create_ex_geographic_boundingbox(float(east), float(north), \ 
    8383                                                              float(west), float(south)) 
    8484             
     
    9797        if end is not None: 
    9898            dateString = '%s/%s' % (start, end) 
    99         pt = fromDateStringToPhenomenonTime(dateString) 
     99        pt = from_date_string_to_pt(dateString) 
    100100         
    101101        if pt is not None and ceda_observationCollection.phenomenonTime is not None \ 
    102102            and (len(ceda_observationCollection.phenomenonTime) == 0 \ 
    103103                 or (len(ceda_observationCollection.phenomenonTime) == 1 and \ 
    104                      not comparePhenomenonTimes(ceda_observationCollection.phenomenonTime[0], pt))): 
     104                     not compare_phenomenon_times(ceda_observationCollection.phenomenonTime[0], pt))): 
    105105            self.epbRepo.moles3EPB.updateCedaObject(ceda_observationCollection, {'phenomenonTime': pt})         
    106106 
    107107    def _assignDescription(self, ceda_observationCollection): 
    108         description = extractSummary(self._dataEntityMigration) 
     108        description = extract_summary(self._dataEntityMigration) 
    109109             
    110110        if description: 
     
    112112     
    113113    def _processTitle(self, ceda_observationCollection): 
    114         ititle = extractTitle(self._dataEntityMigration) 
     114        ititle = extract_title(self._dataEntityMigration) 
    115115        if ceda_observationCollection.identifier: 
    116116            for ident in ceda_observationCollection.identifier: 
     
    122122  
    123123        #Else create new 
    124         i_citation = createCI_Citation(title = CEDA_TITLE) 
    125         newIdentifier = createMD_Identifier(code = ititle, authority=i_citation) 
     124        i_citation = create_ci_citation(title = CEDA_TITLE) 
     125        newIdentifier = create_md_identifier(code = ititle, authority=i_citation) 
    126126         
    127127        if self._dataEntityHasBeenProcessed: 
     
    133133     
    134134    def _processCitation(self, ceda_observationCollection): 
    135         contentDict = extractContent(self._dataEntityMigration) 
     135        contentDict = extract_content(self._dataEntityMigration) 
    136136        if not contentDict.has_key('citation'): 
    137137            self._report(NoCitationException(self._dataEntityMigration)) 
     
    141141 
    142142        ci_dates = [] 
    143         doc_date = findPublishedDate(self._dataEntityMigration)             
     143        doc_date = find_published_date(self._dataEntityMigration)             
    144144        if doc_date: 
    145             i_date = createDate(isoDateTimeStringToTimeDate(doc_date))            
    146             ci_dates.append(createCI_Date(getCLValue(CI_DateTypeCode.cl_publication), date = i_date)) 
    147  
    148         doc_date = findUpdatedDate(self._dataEntityMigration)             
     145            i_date = create_date(isoDateTimeStringToTimeDate(doc_date))            
     146            ci_dates.append(create_ci_date(getCLValue(CI_DateTypeCode.cl_publication), date = i_date)) 
     147 
     148        doc_date = find_updated_date(self._dataEntityMigration)             
    149149        if doc_date: 
    150             i_date = createDate(isoDateTimeStringToTimeDate(doc_date))                 
    151             ci_dates.append(createCI_Date(getCLValue(CI_DateTypeCode.cl_revision), date = i_date)) 
    152              
    153         i_citation = createCI_Citation(title = 'ceda_moles2_citation', date=ci_dates) 
    154         newIdentifier = createMD_Identifier(code = contentDict['citation'], authority=i_citation) 
     150            i_date = create_date(isoDateTimeStringToTimeDate(doc_date))                 
     151            ci_dates.append(create_ci_date(getCLValue(CI_DateTypeCode.cl_revision), date = i_date)) 
     152             
     153        i_citation = create_ci_citation(title = 'ceda_moles2_citation', date=ci_dates) 
     154        newIdentifier = create_md_identifier(code = contentDict['citation'], authority=i_citation) 
    155155 
    156156        if self._dataEntityHasBeenProcessed: 
     
    174174         
    175175        #Is a first time process? 
    176         if not hasMOBeenProcessed(self._dataEntityMigration): 
    177             docHash = getAtomDocumentHashByMO(self._dataEntityMigration) 
     176        if not has_mo_been_processed(self._dataEntityMigration): 
     177            docHash = get_atom_document_hash_by_mo(self._dataEntityMigration) 
    178178            ceda_observationCollection.publicationState = getCLValue(MM_ObservationPublicationStateValue.cl_working) 
    179179            self.epbRepo.moles3EPB.persistInstance(ceda_observationCollection) 
     
    183183 
    184184        #Has to updated the hash? 
    185         if not self._dataEntityHasSameHash and hasMOBeenProcessed(self._dataEntityMigration): 
    186             docHash = getAtomDocumentHashByMO(self._dataEntityMigration) 
     185        if not self._dataEntityHasSameHash and has_mo_been_processed(self._dataEntityMigration): 
     186            docHash = get_atom_document_hash_by_mo(self._dataEntityMigration) 
    187187            self.epbRepo.migrationEPB.updateMigrationObject(self._dataEntityMigration, \ 
    188188                {'doc_hash': docHash}) 
     
    192192            #Adds the CedaGUID 
    193193            ceda_guid = CedaGUID() 
    194             ceda_guid.id = calculateHash(self._dataEntityMigration.data_ent_id) 
     194            ceda_guid.id = calculate_hash(self._dataEntityMigration.data_ent_id) 
    195195            setattr(ceda_guid, 'ceda_observationcollection', ceda_observationCollection.id) 
    196196            self.epbRepo.moles3EPB.persistInstance(ceda_guid) 
     
    198198 
    199199    def _processDOI(self, deploymentMigration, ceda_observation, deProcessor, single_deployment):         
    200         doi = findDOIInMigrationDocument(deploymentMigration)                                                               
     200        doi = find_doi_in_migration_document(deploymentMigration)                                                               
    201201        if single_deployment: 
    202202            if doi is None: 
    203                 doi = findDOIInMigrationDocument(self._dataEntityMigration) 
     203                doi = find_doi_in_migration_document(self._dataEntityMigration) 
    204204                    #collection_identifier = Moles3EPB.extractCollectionIdentifierByTitle(MD_CODE_MOLES2_CITATION, self.migrationSessions.molesSession) 
    205205                    #if collection_identifier.count()==1: 
     
    250250         
    251251        #retrieves the associated deployment links from the data_entity 
    252         deploymentsLinks = findDeploymentsInDE(self._dataEntityMigration)         
     252        deploymentsLinks = find_deployments_in_de(self._dataEntityMigration)         
    253253        #retrieves the DataEntityMigration sorted by creation date 
    254254        deploymentMigrations = self.epbRepo.migrationEPB.getAllDeploymentsMigrationByDataEntitySortedByDate( \ 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/deployment.py

    r8490 r8496  
    3131@author: Maurizio Nagni 
    3232''' 
    33 from cedaMoles.libs.migration.processor.commons import findMolesLineage, \ 
    34     createMO_ResponsiblePartyInfo,\ 
    35     DO_BADC, DO_NEODC, findAuthorsInResource, \ 
    36     createMD_Identifier, extractSummary, extractQuality, \ 
    37     hasMOSameHash, getAtomDocumentHashByMO, extractTitle,\ 
    38         createCEDA_Result,\ 
    39     createEX_GeographicBoundingBox, extractGeographicExtentInMigrationDocument, \ 
    40     findDownloadLinksInMigrationDocument,\ 
    41     extractContent, createCI_Citation, createCI_Date, createDate,\ 
    42     createTM_Position, createTM_Instant, extractMolesCreationDate,\ 
    43     createDateTime, isoDateTimeStringToTimeDate, extractMolesProviderID,\ 
    44     DO_UKSSDC, createMO_Organization,\ 
    45     createCI_Contact, createCI_Address, createCI_OnlineResource,\ 
    46     createCI_Telephone, extractMolesTemporalRange,\ 
    47     findAccessLinksInMigrationDocument,\ 
    48     findLinksInDeployment, createMD_LegalConstraints,\ 
    49     createDQ_Element, createDQ_ConformanceResult, findUpdatedDate,\ 
    50     createMD_Metadata, createMO_OnlineResource, createCEDA_Review, calculateHash,\ 
    51     createCI_ResponsibleParty, extractUpdateFrequency,\ 
    52     findLinksInMigrationDocument, findSubTypeInDPT, extractMolesPublishedDate,\ 
    53     createMD_Keywords, hasMOBeenProcessed, createMO_Individual,\ 
    54     fromDateStringToPhenomenonTime, \ 
    55     comparePhenomenonTimes, compareGeographicBoundingBoxes 
     33from cedaMoles.libs.migration.processor.commons import find_moles_lineage, \ 
     34    create_mo_responsible_party_info,\ 
     35    DO_BADC, DO_NEODC, find_authors_in_resource, \ 
     36    create_md_identifier, extract_summary, extract_quality, \ 
     37    has_mo_same_hash, get_atom_document_hash_by_mo, extract_title,\ 
     38        create_ceda_result,\ 
     39    create_ex_geographic_boundingbox, extract_ge_in_migration_doc, \ 
     40    find_download_links_in_migration_document,\ 
     41    extract_content, create_ci_citation, create_ci_date, create_date,\ 
     42    create_tm_position, create_tm_instant, extract_moles_creation_date,\ 
     43    create_datetime, isoDateTimeStringToTimeDate, extract_moles_provider_id,\ 
     44    DO_UKSSDC, create_mo_organization,\ 
     45    create_ci_contact, create_ci_address, create_ci_onlineresource,\ 
     46    create_ci_telephone, extract_moles_temporal_range,\ 
     47    find_access_links_in_migration_document,\ 
     48    find_links_in_deployment, create_md_legal_constraints,\ 
     49    create_dq_element, create_dq_conformance_result, find_updated_date,\ 
     50    create_md_metadata, create_mo_online_resource, create_ceda_review, calculate_hash,\ 
     51    create_ci_responsible_party, extract_update_frequency,\ 
     52    find_links_in_migration_document, find_subtype_in_dpt, extract_moles_published_date,\ 
     53    create_md_keywords, has_mo_been_processed, create_mo_individual,\ 
     54    from_date_string_to_pt, \ 
     55    compare_phenomenon_times, compareGeographicBoundingBoxes 
    5656from cedaMoles.libs.epb import EPB 
    5757from cedaMoles.libs.migration.processor.deployment_data import DeploymentDataProcessor 
     
    112112        self._deployment_migration = deployment_migration 
    113113        self.epbRepo = epbRepo 
    114         self._dataEntityHasSameHash = hasMOSameHash(self._data_entity_migration) 
    115         self._deploymentHasSameHash = hasMOSameHash(self._deployment_migration) 
    116         self._deploymentHasBeenProcessed = hasMOBeenProcessed(self._deployment_migration) 
     114        self._dataEntityHasSameHash = has_mo_same_hash(self._data_entity_migration) 
     115        self._deploymentHasSameHash = has_mo_same_hash(self._deployment_migration) 
     116        self._deploymentHasBeenProcessed = has_mo_been_processed(self._deployment_migration) 
    117117        self._report = [] 
    118118 
     
    139139        try: 
    140140            if tmp_auth['author'] == 'unknown': 
    141                 doc_authors = findAuthorsInResource(self._data_entity_migration) 
     141                doc_authors = find_authors_in_resource(self._data_entity_migration) 
    142142                tmp_auth = authors[doc_authors['authors']] 
    143143             
     
    154154            for item in tmp_auth['co_author_type']:            
    155155                if (tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)] == 'unknown'): 
    156                     doc_authors = findAuthorsInResource(self._data_entity_migration) 
     156                    doc_authors = find_authors_in_resource(self._data_entity_migration) 
    157157                    tmp_auth = authors[doc_authors['contributors']] 
    158158                    break 
     
    189189             
    190190            py_date = None 
    191             cited_responsible = createCI_ResponsibleParty(role=getCLValue(CI_RoleCode.cl_publisher), \ 
     191            cited_responsible = create_ci_responsible_party(role=getCLValue(CI_RoleCode.cl_publisher), \ 
    192192                                                              organizationName='NERC - British Atmospheric Data Centre') 
    193193            if doi.upper() == '10.5285/E8F43A51-0198-4323-A926-FE69225D57DD': 
     
    201201                 
    202202            if py_date:    
    203                 dt = createDate(py_date) 
    204                 ci_date = createCI_Date(getCLValue(CI_DateTypeCode.cl_publication), date = dt) 
    205                 i_authority = createCI_Citation("DOI", date = ci_date) 
    206                 identifier = createMD_Identifier(code = doi, authority=i_authority) 
     203                dt = create_date(py_date) 
     204                ci_date = create_ci_date(getCLValue(CI_DateTypeCode.cl_publication), date = dt) 
     205                i_authority = create_ci_citation("DOI", date = ci_date) 
     206                identifier = create_md_identifier(code = doi, authority=i_authority) 
    207207                self.epbRepo.moles3EPB.updateCedaObject(observation, {'identifier': identifier}) 
    208208                DeploymentProcessor.log.info("DOI: %s" % (doi))                                   
     
    212212            return 
    213213         
    214         provider_id = extractMolesProviderID(self._deployment_migration) 
     214        provider_id = extract_moles_provider_id(self._deployment_migration) 
    215215        i_keywords = [] 
    216216        if provider_id == DO_BADC: 
     
    221221            #Is a first time process? 
    222222            if not self._deploymentHasBeenProcessed:  
    223                 ceda_observation.keywords.append(createMD_Keywords(i_keywords)) 
     223                ceda_observation.keywords.append(create_md_keywords(i_keywords)) 
    224224            else: 
    225225                ceda_observation.keywords.keyword = i_keywords           
     
    229229            return 
    230230         
    231         data_lineage = findMolesLineage(self._data_entity_migration) 
     231        data_lineage = find_moles_lineage(self._data_entity_migration) 
    232232        if data_lineage is None: 
    233233            raise NoDataLineage(self._data_entity_migration) 
     
    241241 
    242242        i_sources = []                 
    243         download = findDownloadLinksInMigrationDocument(self._deployment_migration) 
     243        download = find_download_links_in_migration_document(self._deployment_migration) 
    244244        content = None 
    245245        if len(download) == 0: 
    246             download = findDownloadLinksInMigrationDocument(self._data_entity_migration) 
    247             content = extractContent(self._data_entity_migration) 
     246            download = find_download_links_in_migration_document(self._data_entity_migration) 
     247            content = extract_content(self._data_entity_migration) 
    248248        else: 
    249             content = extractContent(self._deployment_migration) 
     249            content = extract_content(self._deployment_migration) 
    250250        for dwn in download: 
    251251            int_description = None 
     
    256256            if dwn['href'].startswith('http://badc.nerc.ac.uk/browse') or dwn['href'].startswith('http://neodc.nerc.ac.uk/browse'): 
    257257                int_description = "download directly from archive"     
    258             i_sources.append(createMO_OnlineResource(linkage = dwn['href'], name = dwn['title'], \ 
     258            i_sources.append(create_mo_online_resource(linkage = dwn['href'], name = dwn['title'], \ 
    259259                                                   function = getCLValue(CI_OnLineFunctionCode.cl_download), \ 
    260260                                                   description = int_description, applicationProfile = int_applicationProfile)) 
     
    275275 
    276276        if not self._deploymentHasBeenProcessed:                      
    277             observation.result = createCEDA_Result(i_category, i_logical_path, source = i_sources) 
     277            observation.result = create_ceda_result(i_category, i_logical_path, source = i_sources) 
    278278            return  
    279279         
     
    290290            return 
    291291            
    292         provider_id = extractMolesProviderID(self._deployment_migration) 
     292        provider_id = extract_moles_provider_id(self._deployment_migration) 
    293293        party = None 
    294294        if provider_id == DO_BADC: 
    295295            i_linkage = 'http://badc.rl.ac.uk' 
    296             i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = 'British Atmospheric Data Centre Website') 
    297             i_address = createCI_Address(deliveryPoint = ['British Atmospheric Data Centre, STFC Rutherford Appleton Laboratory'], \ 
     296            i_onlineResources = create_ci_onlineresource(linkage = i_linkage, name = 'British Atmospheric Data Centre Website') 
     297            i_address = create_ci_address(deliveryPoint = ['British Atmospheric Data Centre, STFC Rutherford Appleton Laboratory'], \ 
    298298                                         electronicMailAddress=['badc@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                    
    299             i_phone = createCI_Telephone(voice=['+44(0)1235 446432'])                                   
    300             contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
    301             party = createMO_Organization(name = "NERC - British Atmospheric Data Centre", contactInfo = [contact]) 
     299            i_phone = create_ci_telephone(voice=['+44(0)1235 446432'])                                   
     300            contact = create_ci_contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
     301            party = create_mo_organization(name = "NERC - British Atmospheric Data Centre", contactInfo = [contact]) 
    302302        elif provider_id == DO_NEODC: 
    303303            i_linkage = 'http://www.neodc.rl.ac.uk' 
    304             i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = 'NERC Earth Observation Data Centre website') 
    305             i_address = createCI_Address(deliveryPoint = ['NERC - Earth Observation Data Centre, STFC Rutherford Appleton Laboratory'], \ 
     304            i_onlineResources = create_ci_onlineresource(linkage = i_linkage, name = 'NERC Earth Observation Data Centre website') 
     305            i_address = create_ci_address(deliveryPoint = ['NERC - Earth Observation Data Centre, STFC Rutherford Appleton Laboratory'], \ 
    306306                                         electronicMailAddress=['neodc@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                    
    307             i_phone = createCI_Telephone(voice=['+44(0)1235 446432'])                                  
    308             contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
    309             party = createMO_Organization(name = 'NERC - Earth Observation Data Centre', contactInfo = [contact]) 
     307            i_phone = create_ci_telephone(voice=['+44(0)1235 446432'])                                  
     308            contact = create_ci_contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
     309            party = create_mo_organization(name = 'NERC - Earth Observation Data Centre', contactInfo = [contact]) 
    310310        elif provider_id == DO_UKSSDC: 
    311311            i_linkage = 'http://www.ukssdc.rl.ac.uk' 
    312             i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = 'UK Solar System Data Centre website') 
    313             i_address = createCI_Address(deliveryPoint = ['UK Solar System Data Centre, STFC Rutherford Appleton Laboratory'], \ 
     312            i_onlineResources = create_ci_onlineresource(linkage = i_linkage, name = 'UK Solar System Data Centre website') 
     313            i_address = create_ci_address(deliveryPoint = ['UK Solar System Data Centre, STFC Rutherford Appleton Laboratory'], \ 
    314314                                         electronicMailAddress=['support@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                    
    315             i_phone = createCI_Telephone(voice=['+44(0)1235 445173'])                                  
    316             contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
    317             party = createMO_Organization(name = 'NERC - UK Solar System Data Centre', contactInfo = [contact]) 
     315            i_phone = create_ci_telephone(voice=['+44(0)1235 445173'])                                  
     316            contact = create_ci_contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
     317            party = create_mo_organization(name = 'NERC - UK Solar System Data Centre', contactInfo = [contact]) 
    318318         
    319319        if party and not self._deploymentHasBeenProcessed: 
    320320            newrp = [] 
    321             newrp.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_publisher), [party])) 
    322             newrp.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_custodian), deepcopy([party]))) 
    323             newrp.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_distributor), deepcopy([party]))) 
    324             newrp.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_pointofcontact), deepcopy([party]))) 
    325             newrp.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_metadataowner), deepcopy([party]))) 
    326             newrp.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_curator), deepcopy([party]))) 
     321            newrp.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_publisher), [party])) 
     322            newrp.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_custodian), deepcopy([party]))) 
     323            newrp.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_distributor), deepcopy([party]))) 
     324            newrp.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_pointofcontact), deepcopy([party]))) 
     325            newrp.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_metadataowner), deepcopy([party]))) 
     326            newrp.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_curator), deepcopy([party]))) 
    327327            self.epbRepo.moles3EPB.updateCedaObject(observation, {'relatedParty': newrp})             
    328328            return         
     
    333333            return 
    334334                 
    335         doc_quality = extractQuality(self._data_entity_migration) 
    336         doc_date = findUpdatedDate(self._data_entity_migration) 
     335        doc_quality = extract_quality(self._data_entity_migration) 
     336        doc_date = find_updated_date(self._data_entity_migration) 
    337337        ci_dates = []             
    338338        if doc_date: 
    339             i_date = createDate(isoDateTimeStringToTimeDate(doc_date))                 
    340             ci_dates.append(createCI_Date(getCLValue(CI_DateTypeCode.cl_revision), date = i_date))             
     339            i_date = create_date(isoDateTimeStringToTimeDate(doc_date))                 
     340            ci_dates.append(create_ci_date(getCLValue(CI_DateTypeCode.cl_revision), date = i_date))             
    341341        else: 
    342             i_date = createDate(isoDateTimeStringToTimeDate(datetime.datetime.now())) 
    343             ci_dates.append(createCI_Date(getCLValue(CI_DateTypeCode.cl_creation), date = i_date)) 
    344  
    345         i_specification = createCI_Citation(title = "CEDA Data Quality Statement", date=ci_dates) 
    346         i_dq_result = createDQ_ConformanceResult(doc_quality, True, i_specification) 
    347         i_quality_element = createDQ_Element(i_dq_result) 
     342            i_date = create_date(isoDateTimeStringToTimeDate(datetime.datetime.now())) 
     343            ci_dates.append(create_ci_date(getCLValue(CI_DateTypeCode.cl_creation), date = i_date)) 
     344 
     345        i_specification = create_ci_citation(title = "CEDA Data Quality Statement", date=ci_dates) 
     346        i_dq_result = create_dq_conformance_result(doc_quality, True, i_specification) 
     347        i_quality_element = create_dq_element(i_dq_result) 
    348348         
    349349        if not self._deploymentHasBeenProcessed:      
     
    356356            return 
    357357         
    358         description = extractSummary(self._deployment_migration) 
     358        description = extract_summary(self._deployment_migration) 
    359359        if description is None: 
    360             description = extractSummary(self._data_entity_migration) 
     360            description = extract_summary(self._data_entity_migration) 
    361361             
    362362        if description: 
     
    367367            return 
    368368                      
    369         doc_title = extractTitle(self._deployment_migration) 
     369        doc_title = extract_title(self._deployment_migration) 
    370370        if doc_title is None: 
    371             doc_title = extractTitle(self._data_entity_migration) 
     371            doc_title = extract_title(self._data_entity_migration) 
    372372         
    373373        if doc_title.startswith('deployment_') or doc_title.startswith('Deployment_'): 
    374             links = findLinksInMigrationDocument(self._deployment_migration) 
     374            links = find_links_in_migration_document(self._deployment_migration) 
    375375            dptList = links['DPT'] 
    376376            if links.has_key('DPT'): 
     
    382382                        doc_title += ' and ' + dptList[-1] 
    383383                                                         
    384             links = findLinksInDeployment(self._deployment_migration) 
     384            links = find_links_in_deployment(self._deployment_migration) 
    385385            if links.has_key('OBS'): 
    386386                obsList = [] 
    387387                for obs in links['OBS']: 
    388388                    observationStation = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment_migration, obs + '.atom') 
    389                     obsList.append((extractTitle(observationStation), findSubTypeInDPT(observationStation))) 
     389                    obsList.append((extract_title(observationStation), find_subtype_in_dpt(observationStation))) 
    390390                 
    391391                if obsList[0][1] in ['stationary platform' ,'moving platform', 'ship','aircraft','satellite','computer']: 
     
    404404                    activity = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment_migration, link + '.atom')                     
    405405      
    406                     projSubType = findSubTypeInDPT(activity) 
    407                     doc_title += ' for the ' + extractTitle(activity) 
     406                    projSubType = find_subtype_in_dpt(activity) 
     407                    doc_title += ' for the ' + extract_title(activity) 
    408408                    if projSubType[0:14] == 'dgActivityData': 
    409409                        doc_title += ' ' + projSubType[14:] 
     
    413413            if doc_title[0:10] != 'Data from' : 
    414414                doc_title = "Data from " + doc_title             
    415         auth = createCI_Citation(title = 'ceda_title')                   
    416         identifier = createMD_Identifier(code = doc_title, authority = auth) 
     415        auth = create_ci_citation(title = 'ceda_title')                   
     416        identifier = create_md_identifier(code = doc_title, authority = auth) 
    417417         
    418418        if not self._deploymentHasBeenProcessed:  
     
    425425            return   
    426426         
    427         ge = extractGeographicExtentInMigrationDocument(self._deployment_migration)         
     427        ge = extract_ge_in_migration_doc(self._deployment_migration)         
    428428        if ge is None: 
    429             ge = extractGeographicExtentInMigrationDocument(self._data_entity_migration) 
     429            ge = extract_ge_in_migration_doc(self._data_entity_migration) 
    430430         
    431431        if ge is None: 
     
    433433            self._report.append(NoGeographicalExtensionException(self._data_entity_migration)) 
    434434         
    435         geographicExtent = createEX_GeographicBoundingBox(ge['east'], ge['north'], ge['west'], ge['south']) 
     435        geographicExtent = create_ex_geographic_boundingbox(ge['east'], ge['north'], ge['west'], ge['south']) 
    436436 
    437437        if len(observation.geographicExtent) == 0 or \ 
     
    445445            return   
    446446         
    447         creation_date = extractMolesPublishedDate(self._deployment_migration) 
     447        creation_date = extract_moles_published_date(self._deployment_migration) 
    448448        if creation_date is None: 
    449             creation_date = extractMolesCreationDate(self._deployment_migration) 
     449            creation_date = extract_moles_creation_date(self._deployment_migration) 
    450450        py_datetime = isoDateTimeStringToTimeDate(creation_date) 
    451         date_time = createDateTime(py_datetime)     
    452         tm_position = createTM_Position(dateTime8601 = date_time) 
     451        date_time = create_datetime(py_datetime)     
     452        tm_position = create_tm_position(dateTime8601 = date_time) 
    453453         
    454454        if not self._deploymentHasBeenProcessed:  
    455             observation.resultTime = createTM_Instant(tm_position) 
     455            observation.resultTime = create_tm_instant(tm_position) 
    456456            return         
    457457        #Still have to update observation.geographicExtent 
     
    461461            return   
    462462               
    463         doc_phenomenon_time = extractMolesTemporalRange(self._deployment_migration)  
    464         pt = fromDateStringToPhenomenonTime(doc_phenomenon_time)     
    465          
    466         if not self._deploymentHasBeenProcessed or not comparePhenomenonTimes(pt,observation.phenomenonTime): 
     463        doc_phenomenon_time = extract_moles_temporal_range(self._deployment_migration)  
     464        pt = from_date_string_to_pt(doc_phenomenon_time)     
     465         
     466        if not self._deploymentHasBeenProcessed or not compare_phenomenon_times(pt,observation.phenomenonTime): 
    467467            self.epbRepo.moles3EPB.updateCedaObject(observation, {'phenomenonTime': pt}) 
    468468        #Now update phenomenonTime but has to remove the previous phenomenonTime                 
     
    472472            return  
    473473         
    474         access_link = findAccessLinksInMigrationDocument(self._deployment_migration) 
    475         dwn_link = findDownloadLinksInMigrationDocument(self._deployment_migration) 
     474        access_link = find_access_links_in_migration_document(self._deployment_migration) 
     475        dwn_link = find_download_links_in_migration_document(self._deployment_migration) 
    476476        if len(access_link) == 0: 
    477             access_link = findAccessLinksInMigrationDocument(self._data_entity_migration)  
     477            access_link = find_access_links_in_migration_document(self._data_entity_migration)  
    478478 
    479479        i_accessConstraints = [] 
     
    483483        if len(access_link) == 0: 
    484484            if len(dwn_link) == 0: 
    485                 dwn_link = findDownloadLinksInMigrationDocument(self._data_entity_migration) 
     485                dwn_link = find_download_links_in_migration_document(self._data_entity_migration) 
    486486                if dwn_link and len(dwn_link) == 1:                 
    487487                    i_use_limitation.append("These data are open access and available through %s." % (dwn_link[0]['href']) ) 
    488488                    #i_accessConstraints.append(MD_RestrictionCode.cl_) 
    489                     observation.permission = createMD_LegalConstraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints) 
     489                    observation.permission = create_md_legal_constraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints) 
    490490        else: 
    491491            if access_link and len(access_link) == 1: 
    492492                i_use_limitation.append("Access to these data is restricted. To obtain access please apply for access at: %s" % (access_link[0]['href'])) 
    493493                i_accessConstraints.append(getCLValue(MD_RestrictionCode.cl_restricted)) 
    494                 observation.permission = createMD_LegalConstraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints) 
     494                observation.permission = create_md_legal_constraints(useLimitation = i_use_limitation, accessConstrains = i_accessConstraints) 
    495495                 
    496496        if not self._deploymentHasBeenProcessed: 
     
    499499                                     
    500500        '''                                 
    501         contentDict = extractContent(self._deployment_migration) 
     501        contentDict = extract_content(self._deployment_migration) 
    502502        if not contentDict.has_key('access-restricted'): 
    503             contentDict = extractContent(self._data_entity_migration) 
     503            contentDict = extract_content(self._data_entity_migration) 
    504504        '''             
    505505 
     
    510510        i_code = 'http://badc.nerc.ac.uk/view/%s__ATOM__%s' % (self._deployment_migration.doc_owner, self._deployment_migration.doc_name) 
    511511        i_code = i_code.replace('.atom', '') 
    512         #i_code = buildExistDocPath(self._deployment_migration.doc_status, DT_DEPLOYMENTS, self._deployment_migration.doc_owner, self._deployment_migration.doc_name) 
    513         i_authority = createCI_Citation('moles2url') 
    514         identifier = createMD_Identifier(code = i_code, authority = i_authority) 
     512        i_authority = create_ci_citation('moles2url') 
     513        identifier = create_md_identifier(code = i_code, authority = i_authority) 
    515514        if not self._deploymentHasBeenProcessed:              
    516515            ceda_observation.identifier.append(identifier) 
     
    521520            return 
    522521                
    523         i_party = createMO_Individual(name = 'Graham Parton') 
    524         i_reviewer = createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_processor), [i_party]) 
     522        i_party = create_mo_individual(name = 'Graham Parton') 
     523        i_reviewer = create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_processor), [i_party]) 
    525524        ceda_observation.metadataManagement.append( \ 
    526             createCEDA_Review(reviewer=i_reviewer, reviewFrequency=getCLValue(CEDA_ReviewFrequencyValue.cl_yearly), \ 
     525            create_ceda_review(reviewer=i_reviewer, reviewFrequency=getCLValue(CEDA_ReviewFrequencyValue.cl_yearly), \ 
    527526                              reviewStatus=getCLValue(CEDA_ReviewStatusValue.cl_required)))   
    528527 
     
    531530            return 
    532531         
    533         i_date_stamp = createDate(datetime.datetime.now()) 
     532        i_date_stamp = create_date(datetime.datetime.now()) 
    534533        #i_contact = createCI_Citation("", date = i_date_stamp) 
    535         i_contact = createCI_ResponsibleParty(getCLValue(CI_RoleCode.cl_user)) 
    536         ceda_observation.metadata = createMD_Metadata(date_stamp=i_date_stamp, contact = [i_contact], language = "English") 
     534        i_contact = create_ci_responsible_party(getCLValue(CI_RoleCode.cl_user)) 
     535        ceda_observation.metadata = create_md_metadata(date_stamp=i_date_stamp, contact = [i_contact], language = "English") 
    537536                         
    538537    def _processResultAccumulation(self, ceda_observation):   
     
    540539            return                       
    541540 
    542             updateFrequency = extractUpdateFrequency(self._data_entity_migration) 
     541            updateFrequency = extract_update_frequency(self._data_entity_migration) 
    543542            if updateFrequency: 
    544543                resultAccumulation = MD_MaintenanceFrequencyCode.from_string(updateFrequency) 
     
    557556         
    558557        whereAreAuthors = self._deployment_migration         
    559         doc_authors = findAuthorsInResource(self._deployment_migration)         
     558        doc_authors = find_authors_in_resource(self._deployment_migration)         
    560559        if doc_authors['authors'] in [DO_BADC, DO_NEODC]: 
    561             doc_authors = findAuthorsInResource(self._data_entity_migration) 
     560            doc_authors = find_authors_in_resource(self._data_entity_migration) 
    562561            whereAreAuthors = self._data_entity_migration  
    563562                 
     
    569568 
    570569            if len(ret['ind']) > 0: 
    571                 i_party = createMO_Individual(name = ret['ind'][0]) 
    572                 observation.relatedParty.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_author), [i_party]))                  
     570                i_party = create_mo_individual(name = ret['ind'][0]) 
     571                observation.relatedParty.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_author), [i_party]))                  
    573572            if len(ret['org']) > 0: 
    574                 i_party = createMO_Organization(name = ret['org'][0]) 
    575                 observation.relatedParty.append(createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_author), [i_party])) 
     573                i_party = create_mo_organization(name = ret['org'][0]) 
     574                observation.relatedParty.append(create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_author), [i_party])) 
    576575             
    577576            if len(ret['ind']) > 1: 
     
    597596        i_party = [] 
    598597        for nm in ind_names: 
    599             i_party.append(createMO_Individual(name = nm)) 
     598            i_party.append(create_mo_individual(name = nm)) 
    600599                 
    601600        for nm in org_names: 
    602             i_party.append(createMO_Organization(name = nm)) 
     601            i_party.append(create_mo_organization(name = nm)) 
    603602             
    604603        if i_party: 
    605604            if not self._deploymentHasBeenProcessed: 
    606                 rp = createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_coinvestigator), i_party) 
     605                rp = create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_coinvestigator), i_party) 
    607606                self.epbRepo.moles3EPB.updateCedaObject(observation, {'relatedParty': rp}) 
    608607                return 
     
    629628         
    630629        #Is a first time process? 
    631         if not hasMOBeenProcessed(self._deployment_migration): 
     630        if not has_mo_been_processed(self._deployment_migration): 
    632631            ceda_observation.publicationState = getCLValue(MM_ObservationPublicationStateValue.cl_working)           
    633             docHash = getAtomDocumentHashByMO(self._data_entity_migration) 
     632            docHash = get_atom_document_hash_by_mo(self._data_entity_migration) 
    634633            self.epbRepo.moles3EPB.persistInstance(ceda_observation)         
    635634            self.epbRepo.migrationEPB.updateMigrationObject(self._deployment_migration, \ 
     
    640639        if self.epbRepo.moles3EPB.retrieveGUIDFromInstance(ceda_observation) is None:        
    641640            ceda_guid = CedaGUID() 
    642             ceda_guid.id = calculateHash(self._deployment_migration.depl_id) 
     641            ceda_guid.id = calculate_hash(self._deployment_migration.depl_id) 
    643642            ceda_guid.ceda_observation = ceda_observation.id 
    644643            self.epbRepo.moles3EPB.persistInstance(ceda_guid) 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/deployment_data.py

    r8486 r8496  
    3131@author: Maurizio Nagni 
    3232''' 
    33 from cedaMoles.libs.migration.processor.commons import findSubTypeInDPT,\ 
    34     createCEDA_Processing, createCEDA_Instrument, createCEDA_Project,\ 
    35     findSummary, findDocumentationInMigrationDocument, createCI_Citation,\ 
    36     createMO_OnlineResource, findLinksInDeployment, hasMOBeenProcessed,\ 
    37     getAtomDocumentHashByMO, calculateHash, hasMOSameHash 
     33from cedaMoles.libs.migration.processor.commons import find_subtype_in_dpt,\ 
     34    create_ceda_processing, create_ceda_instrument, create_ceda_project,\ 
     35    find_summary, find_documentation_in_migration_document, create_ci_citation,\ 
     36    create_mo_online_resource, find_links_in_deployment, has_mo_been_processed,\ 
     37    get_atom_document_hash_by_mo, calculate_hash, has_mo_same_hash 
    3838from ea_model.moles3_4.utilities.ceda_publicationstatevalue import CEDA_PublicationStateValue 
    3939from cedaMoles.MolesManager.codelist import getCLValue 
     
    5454        self._deploymentMigration = deploymentMigration 
    5555        self.epbRepo = epbRepo         
    56         self._links = findLinksInDeployment(self._deploymentMigration) 
     56        self._links = find_links_in_deployment(self._deploymentMigration) 
    5757         
    5858    def _commitDeploymentMigration(self, associateWithCedaObservation, dataProductionTool, dataProductionToolField): 
     
    6161                                    
    6262    def _createProject(self, activity):         
    63         i_abstract = findSummary(activity) 
    64         doc_link = findDocumentationInMigrationDocument(activity) 
     63        i_abstract = find_summary(activity) 
     64        doc_link = find_documentation_in_migration_document(activity) 
    6565        i_documentation = None 
    6666        i_resource = None 
    6767        if doc_link and len(doc_link) == 1: 
    68             i_documentation = createCI_Citation("Documentation resource") 
    69             i_resource = createMO_OnlineResource(doc_link[0]['href']) 
    70         project = createCEDA_Project(abstract=i_abstract, publication_state=getCLValue(CEDA_PublicationStateValue.cl_working), \ 
     68            i_documentation = create_ci_citation("Documentation resource") 
     69            i_resource = create_mo_online_resource(doc_link[0]['href']) 
     70        project = create_ceda_project(abstract=i_abstract, publication_state=getCLValue(CEDA_PublicationStateValue.cl_working), \ 
    7171                                     documentation=i_documentation, project_resource=i_resource) 
    7272        self._commitDeploymentMigration(project, activity, 'ceda_project_id') 
     
    7878            for link in self._links['ACTIVITY']: 
    7979                activity = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, link + '.atom') 
    80                 deploymentDataHasSameHash = hasMOSameHash(activity)     
    81                 deploymentDataHasBeenProcessed = hasMOBeenProcessed(activity)                
     80                deploymentDataHasSameHash = has_mo_same_hash(activity)     
     81                deploymentDataHasBeenProcessed = has_mo_been_processed(activity)                
    8282                try : 
    8383                    if activity.ceda_project_id is not None: 
     
    9393                #Is a first time process? 
    9494                if not deploymentDataHasBeenProcessed: 
    95                     docHash = getAtomDocumentHashByMO(activity) 
     95                    docHash = get_atom_document_hash_by_mo(activity) 
    9696                    self.epbRepo.migrationEPB.updateMigrationObject(activity, \ 
    9797                        {'ceda_project_id': project.id, \ 
     
    100100                #Has to updated the hash? 
    101101                if not deploymentDataHasSameHash and deploymentDataHasBeenProcessed: 
    102                     docHash = getAtomDocumentHashByMO(activity) 
     102                    docHash = get_atom_document_hash_by_mo(activity) 
    103103                    self.epbRepo.migrationEPB.updateMigrationObject(activity, \ 
    104104                        {'doc_hash': docHash}) 
     
    108108                    #Adds the CedaGUID 
    109109                    ceda_guid = CedaGUID() 
    110                     ceda_guid.id = calculateHash(activity.deployment_data_id) 
     110                    ceda_guid.id = calculate_hash(activity.deployment_data_id) 
    111111                    setattr(ceda_guid, 'ceda_project', project.id) 
    112112                    self.epbRepo.moles3EPB.persistInstance(ceda_guid) 
     
    123123             
    124124            #has the document changed?             
    125             #if hasMOSameHash(dataProductionTool): 
    126             #    dataProductionTool.doc_hash = getAtomDocumentHashByMO(self._deploymentMigration) 
     125            #if has_mo_same_hash(dataProductionTool): 
     126            #    dataProductionTool.doc_hash = get_atom_document_hash_by_mo(self._deploymentMigration) 
    127127            #    self._migrationSessions.migrationSession.commit() 
    128128            #    continue 
    129129             
    130             subType = findSubTypeInDPT(dataProductionTool) 
     130            subType = find_subtype_in_dpt(dataProductionTool) 
    131131             
    132132            if subType == 'model': 
    133133                #MigrationEPB.loadAttributes(dataProductionTool, 'ceda_processing_id') 
    134134                if dataProductionTool.ceda_processing_id is None: 
    135                     associateWithCedaObservation = createCEDA_Processing() 
     135                    associateWithCedaObservation = create_ceda_processing() 
    136136                    self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_processing_id') 
    137137                    if not (hasCedaComposite or hasCedaProcessing): 
     
    145145                #MigrationEPB.loadAttributes(dataProductionTool, 'ceda_instrument_id') 
    146146                if dataProductionTool.ceda_instrument_id is None: 
    147                     associateWithCedaObservation = createCEDA_Instrument() 
     147                    associateWithCedaObservation = create_ceda_instrument() 
    148148                    self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_instrument_id') 
    149149                else: 
     
    157157  
    158158            #has the document changed?             
    159             #if hasMOSameHash(observationStation): 
    160             #    observationStation.doc_hash = getAtomDocumentHashByMO(self._deploymentMigration) 
     159            #if has_mo_same_hash(observationStation): 
     160            #    observationStation.doc_hash = get_atom_document_hash_by_mo(self._deploymentMigration) 
    161161            #    self._migrationSessions.migrationSession.commit() 
    162162            #    continue                        
    163163             
    164             subType = findSubTypeInDPT(observationStation) 
     164            subType = find_subtype_in_dpt(observationStation) 
    165165            if subType == 'satellite': 
    166166                #MigrationEPB.loadAttributes(dataProductionTool, 'ceda_compositeprocess_id')                 
    167167                if dataProductionTool.ceda_compositeprocess_id is None: 
    168                     associateWithCedaObservation = createCEDA_Processing() 
     168                    associateWithCedaObservation = create_ceda_processing() 
    169169                    self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_compositeprocess_id')    
    170170                    if not hasCedaComposite: 
     
    180180                    pass 
    181181                    ''' 
    182                     associateWithCedaObservation = createCEDA_Acquisition() 
     182                    associateWithCedaObservation = create_ceda_acquisition() 
    183183                    self._commitDeploymentMigration(associateWithCedaObservation, dataProductionTool, 'ceda_acquisition_id') 
    184184                    '''                 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/loadResources.py

    r8486 r8496  
    3131@author: Maurizio Nagni 
    3232''' 
    33 from cedaMoles.libs.migration.processor.commons import DOC_STATUS, getCollectionRefs,\ 
    34     findMolesCreationDate, findID, stringToTimestamp, buildExistTypePath,\ 
    35     buildExistDocPath, DT_DATA_ENTITIES, DT_DEPLOYMENTS, DT_DEPLOYMENT_DATA,\ 
    36     getOwnerRefs, getAtomDocumentAsElementtree 
     33from cedaMoles.libs.migration.processor.commons import DOC_STATUS, get_collection_refs,\ 
     34    find_moles_creation_date, find_id, stringToTimestamp, build_exist_type_path,\ 
     35    build_exist_doc_path, DT_DATA_ENTITIES, DT_DEPLOYMENTS, DT_DEPLOYMENT_DATA,\ 
     36    get_owner_refs, get_atom_document_as_elementtree 
    3737from cedaMoles.libs.migration.exception.exceptions import NoCreationDate, NoDocumentID 
    3838from cedaMoles.libs.migration.db.classes import DeploymentDataMigration,\ 
     
    8383    def _loadCollections(self, docStatus, docType, migrationClass): 
    8484        ex = [] 
    85         refs = getCollectionRefs(buildExistTypePath(docStatus, docType))             
     85        refs = get_collection_refs(build_exist_type_path(docStatus, docType))             
    8686        for ref in refs: 
    8787            docOwner = ref.get('name')   
     
    9494    def _loadMigrationDocs(self, docStatus, docOwner, docType, migrationClass): 
    9595        ex = [] 
    96         refs = getOwnerRefs(docStatus, docType, docOwner)                     
     96        refs = get_owner_refs(docStatus, docType, docOwner)                     
    9797        for ref in refs: 
    9898            docName = ref.get('name') 
     
    101101            except Exception as e: 
    102102                if hasattr(e, 'value'): 
    103                     e.value = buildExistDocPath(docStatus, docType, docOwner, docName) 
     103                    e.value = build_exist_doc_path(docStatus, docType, docOwner, docName) 
    104104                ex.append(e) 
    105105        return ex 
     
    115115          
    116116        #The docHash has to be set/check when the document is processed!   
    117         #docHash = getAtomDocumentHash(docStatus, docType, docOwner, docName) 
    118         xmlDocument = getAtomDocumentAsElementtree(docStatus, docType, docOwner, docName) 
    119         doc_id = findID(xmlDocument) 
     117        xmlDocument = get_atom_document_as_elementtree(docStatus, docType, docOwner, docName) 
     118        doc_id = find_id(xmlDocument) 
    120119          
    121120        #The document has been already classified 
     
    130129 
    131130    def _extractID(self, xmlDocument): 
    132         doc_id = findID(xmlDocument)  
     131        doc_id = find_id(xmlDocument)  
    133132        if doc_id is None: 
    134133            raise NoDocumentID(doc_id) 
     
    136135 
    137136    def _extractCreationDate(self, xmlDocument): 
    138         creationDate = findMolesCreationDate(xmlDocument)             
     137        creationDate = find_moles_creation_date(xmlDocument)             
    139138        if creationDate is None: 
    140139            raise NoCreationDate(creationDate) 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/cedamoles/mo/responsiblePartyInfo.py

    r8487 r8496  
    3131@author: mnagni 
    3232''' 
    33 from cedaMoles.libs.migration.processor.commons import createMO_ResponsiblePartyInfo,\ 
    34     createCI_OnlineResource, createCI_Address, createCI_Telephone,\ 
    35     createCI_Contact, createMO_Organization 
     33from cedaMoles.libs.migration.processor.commons import create_mo_responsible_party_info,\ 
     34    create_ci_onlineresource, create_ci_address, create_ci_telephone,\ 
     35    create_ci_contact, create_mo_organization 
    3636from cedaMoles.MolesManager.codelist import getCLValue, MM_RoleValue 
    3737from ea_model.moles3_4.utilities.mo_organisation import MO_Organisation 
     
    4343    parties = [] 
    4444    i_linkage = 'http://badc.rl.ac.uk' 
    45     i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = 'British Atmospheric Data Centre Website') 
    46     i_address = createCI_Address(deliveryPoint = ['British Atmospheric Data Centre, STFC Rutherford Appleton Laboratory'], \ 
     45    i_onlineResources = create_ci_onlineresource(linkage = i_linkage, name = 'British Atmospheric Data Centre Website') 
     46    i_address = create_ci_address(deliveryPoint = ['British Atmospheric Data Centre, STFC Rutherford Appleton Laboratory'], \ 
    4747                                 electronicMailAddress=['badc@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                    
    48     i_phone = createCI_Telephone(voice=['+44(0)1235 446432'])                                   
    49     contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                         
    50     parties.append(createMO_Organization(name = "NERC - British Atmospheric Data Centre", contactInfo = [contact])) 
     48    i_phone = create_ci_telephone(voice=['+44(0)1235 446432'])                                   
     49    contact = create_ci_contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                         
     50    parties.append(create_mo_organization(name = "NERC - British Atmospheric Data Centre", contactInfo = [contact])) 
    5151     
    5252    i_linkage = 'http://www.neodc.rl.ac.uk' 
    53     i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = 'NERC Earth Observation Data Centre website') 
    54     i_address = createCI_Address(deliveryPoint = ['NERC - Earth Observation Data Centre, STFC Rutherford Appleton Laboratory'], \ 
     53    i_onlineResources = create_ci_onlineresource(linkage = i_linkage, name = 'NERC Earth Observation Data Centre website') 
     54    i_address = create_ci_address(deliveryPoint = ['NERC - Earth Observation Data Centre, STFC Rutherford Appleton Laboratory'], \ 
    5555                                 electronicMailAddress=['neodc@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                    
    56     i_phone = createCI_Telephone(voice=['+44(0)1235 446432'])                                  
    57     contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                         
    58     parties.append(createMO_Organization(name = 'NERC - Earth Observation Data Centre', contactInfo = [contact]))        
    59     return createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_publisher), parties)     
     56    i_phone = create_ci_telephone(voice=['+44(0)1235 446432'])                                  
     57    contact = create_ci_contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                         
     58    parties.append(create_mo_organization(name = 'NERC - Earth Observation Data Centre', contactInfo = [contact]))        
     59    return create_mo_responsible_party_info(getCLValue(MM_RoleValue.cl_publisher), parties)     
    6060 
    6161class ResponsiblePartyInfoTest(CedaMolesTest): 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/migration/commontest.py

    r8486 r8496  
    66from unittest import TestCase 
    77from cedaMoles.libs.migration.processor.commons import isoDateTimeStringToTimeDate,\ 
    8     fromDateStringToPhenomenonTime, fromPhenomenonTimeToString,\ 
    9     comparePhenomenonTimes 
     8    from_date_string_to_pt, from_pt_to_string,\ 
     9    compare_phenomenon_times 
    1010 
    1111 
     
    2525    def testFromDateStringToPhenomenonTime(self): 
    2626        temporalRange = '2002-07-22/2011-08-06' 
    27         pt = fromDateStringToPhenomenonTime(temporalRange) 
     27        pt = from_date_string_to_pt(temporalRange) 
    2828        print pt 
    2929         
    3030    def testFromPhenomenonTimeToString(self): 
    3131        temporalRange = '2002-07-22/2011-08-06' 
    32         pt = fromDateStringToPhenomenonTime(temporalRange) 
    33         ptString = fromPhenomenonTimeToString(pt) 
     32        pt = from_date_string_to_pt(temporalRange) 
     33        ptString = from_pt_to_string(pt) 
    3434        startDate, endDate = temporalRange.split('/')         
    3535        self.assertTrue(startDate == ptString[0], "Error")         
     
    3737         
    3838        temporalRange = '2002-07-22' 
    39         pt = fromDateStringToPhenomenonTime(temporalRange) 
    40         ptString = fromPhenomenonTimeToString(pt) 
     39        pt = from_date_string_to_pt(temporalRange) 
     40        ptString = from_pt_to_string(pt) 
    4141        startDate, endDate = temporalRange, None         
    4242        self.assertTrue(startDate == ptString[0], "Error")         
     
    4444         
    4545    def testComparePhenomenonTimes(self): 
    46         p1 = fromDateStringToPhenomenonTime('2002-07-22/2011-08-06') 
    47         p2 = fromDateStringToPhenomenonTime('2002-07-22/2011-08-06') 
    48         self.assertTrue(comparePhenomenonTimes(p1,p2), "Error") 
     46        p1 = from_date_string_to_pt('2002-07-22/2011-08-06') 
     47        p2 = from_date_string_to_pt('2002-07-22/2011-08-06') 
     48        self.assertTrue(compare_phenomenon_times(p1,p2), "Error") 
    4949         
    50         p2 = fromDateStringToPhenomenonTime('2002-07-22/2011-08-05') 
    51         self.assertFalse(comparePhenomenonTimes(p1,p2), "Error") 
     50        p2 = from_date_string_to_pt('2002-07-22/2011-08-05') 
     51        self.assertFalse(compare_phenomenon_times(p1,p2), "Error") 
    5252         
    53         p2 = fromDateStringToPhenomenonTime('2002-07-22') 
    54         self.assertFalse(comparePhenomenonTimes(p1,p2), "Error") 
     53        p2 = from_date_string_to_pt('2002-07-22') 
     54        self.assertFalse(compare_phenomenon_times(p1,p2), "Error") 
    5555         
  • mauRepo/MolesManager/trunk/cedaMoles/tests/migration/loadresource.py

    r8494 r8496  
    77from cedaMoles.libs.migration.processor.loadResources import LoadResources 
    88from cedaMoles.libs.migration.db.classes import DataEntityMigration 
    9 from cedaMoles.libs.migration.processor.commons import calculateHash 
     9from cedaMoles.libs.migration.processor.commons import calculate_hash 
    1010 
    1111class LoadResourceTest(CedaMolesTest):   
     
    1515        migrationClass = DataEntityMigration() 
    1616        doc_id = 123 
    17         docHash = calculateHash('123_docHash') 
     17        docHash = calculate_hash('123_docHash') 
    1818        docCreation = '2009-12-10T03:16:25Z' 
    1919        lr.createMigrationDoc(migrationClass, doc_id, '123_docName', \ 
     
    2323                                              docHash, docCreation)) 
    2424        self.assertTrue(lr.updateMigrationDoc(migrationClass, doc_id,  
    25                                                 calculateHash('321_docHash'), \ 
     25                                                calculate_hash('321_docHash'), \ 
    2626                                            docCreation)) 
    2727        self.assertTrue(lr.updateMigrationDoc(migrationClass, doc_id, \ 
    28                                                 calculateHash('321_docHash'), \ 
     28                                                calculate_hash('321_docHash'), \ 
    2929                                            '2012-12-10T03:16:25Z')) 
    3030                 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/migration/moles3epbtests.py

    r8494 r8496  
    55''' 
    66import logging, datetime 
    7 from cedaMoles.libs.migration.processor.commons import createCI_Date, \ 
    8     createDateTime, createDate, createTM_Position, createTM_Instant 
     7from cedaMoles.libs.migration.processor.commons import create_ci_date, \ 
     8    create_datetime, create_date, create_tm_position, create_tm_instant 
    99from ea_model.iso_19115_2006_metadata_corrigendum.\ 
    1010    citation_and_responsible_party_information.ci_datetypecode \ 
     
    123123        session = self.epbRepo.moles3EPB.getNewMolesSession(); 
    124124        py_date = datetime.date(2011, 4, 1) 
    125         dt = createDate(py_date) 
    126         ci_date = createCI_Date(CI_DateTypeCode.cl_creation, dt) 
     125        dt = create_date(py_date) 
     126        ci_date = create_ci_date(CI_DateTypeCode.cl_creation, dt) 
    127127         
    128128        Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 
     
    213213    def _createDateTime(self): 
    214214        py_date = datetime.datetime(2011, 4, 1, 00, 00, 00) 
    215         return createDateTime(py_date)     
     215        return create_datetime(py_date)     
    216216     
    217217    def _createCI_Date(self): 
    218218        py_date = datetime.date(2011, 4, 1) 
    219         dt = createDate(py_date) 
    220         return createCI_Date(CI_DateTypeCode.cl_creation, dt) 
     219        dt = create_date(py_date) 
     220        return create_ci_date(CI_DateTypeCode.cl_creation, dt) 
    221221     
    222222    def _createTM_Position(self): 
    223223        newDateTime = self._createDateTime()                 
    224         return createTM_Position(dateTime8601 = newDateTime) 
     224        return create_tm_position(dateTime8601 = newDateTime) 
    225225 
    226226    def _createTM_Instant(self): 
    227227        tm_position = self._createTM_Position()         
    228         return createTM_Instant(tm_position) 
     228        return create_tm_instant(tm_position) 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/migration/test_utils.py

    r8486 r8496  
    55''' 
    66from ea_model.ceda_metadatamodel.ceda_observationcollection.ceda_observationcollection import CEDA_ObservationCollection 
    7 from cedaMoles.libs.migration.processor.commons import createCI_Citation,\ 
    8     createMD_Identifier 
     7from cedaMoles.libs.migration.processor.commons import create_ci_citation,\ 
     8    create_md_identifier 
    99from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation 
    1010from ea_model.ceda_metadatamodel.ceda_project.ceda_project import CEDA_Project 
     
    1717    ''' 
    1818    observationCollection = CEDA_ObservationCollection() 
    19     auth = createCI_Citation('test_title') 
    20     i_identifier = createMD_Identifier(code = 'test_code', authority=auth) 
     19    auth = create_ci_citation('test_title') 
     20    i_identifier = create_md_identifier(code = 'test_code', authority=auth) 
    2121    observationCollection.identifier.append(i_identifier)       
    2222    return observationCollection 
     
    3131    ''' 
    3232    observation = CEDA_Observation() 
    33     i_identifier = createMD_Identifier(code = 'test_code', authority=createCI_Citation('test_title')) 
     33    i_identifier = create_md_identifier(code = 'test_code', authority=create_ci_citation('test_title')) 
    3434    observation.identifier.append(i_identifier)       
    35     i_identifier = createMD_Identifier(code = 'mau_code', authority=createCI_Citation('mau_title')) 
     35    i_identifier = create_md_identifier(code = 'mau_code', authority=create_ci_citation('mau_title')) 
    3636    observation.identifier.append(i_identifier)   
    3737    observation.dataLineage = "test_dataLineage"         
  • mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/creationFactory.py

    r8486 r8496  
    3131@author: mnagni 
    3232''' 
    33 from cedaMoles.libs.migration.processor.commons import createCI_OnlineResource,\ 
    34     createCI_Address, createCI_Telephone, createCI_Contact,\ 
    35     createMO_Organization, createMO_Individual, createMO_ResponsiblePartyInfo,\ 
    36     isoDateTimeStringToTimeDate, createDateTime, createTM_Position,\ 
    37     createTM_Instant, fromDateStringToPhenomenonTime 
     33from cedaMoles.libs.migration.processor.commons import create_ci_onlineresource,\ 
     34    create_ci_address, create_ci_telephone, create_ci_contact,\ 
     35    create_mo_organization, create_mo_individual, create_mo_responsible_party_info,\ 
     36    isoDateTimeStringToTimeDate, create_datetime, create_tm_position,\ 
     37    create_tm_instant, from_date_string_to_pt 
    3838from cedaMoles.MolesManager.codelist import getCLValue, MM_RoleValue 
    3939from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation 
    4040 
    4141def assembleMO_Individual(name = 'CedaTest', iid = 1): 
    42     ret = createMO_Individual(name = name) 
     42    ret = create_mo_individual(name = name) 
    4343    ret.id = iid 
    4444    return ret 
     
    4646def assembleMO_Organization(name = 'UK Solar System Data Centre website', iid = 1): 
    4747    i_linkage = 'http://www.ukssdc.rl.ac.uk' 
    48     i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = name) 
    49     i_address = createCI_Address(deliveryPoint = ['UK Solar System Data Centre, STFC Rutherford Appleton Laboratory'], \ 
     48    i_onlineResources = create_ci_onlineresource(linkage = i_linkage, name = name) 
     49    i_address = create_ci_address(deliveryPoint = ['UK Solar System Data Centre, STFC Rutherford Appleton Laboratory'], \ 
    5050                                 electronicMailAddress=['support@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                    
    51     i_phone = createCI_Telephone(voice=['+44(0)1235 445173'])                                  
    52     contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
    53     ret = createMO_Organization(name = 'NERC - UK Solar System Data Centre', contactInfo = [contact]) 
     51    i_phone = create_ci_telephone(voice=['+44(0)1235 445173'])                                  
     52    contact = create_ci_contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                        
     53    ret = create_mo_organization(name = 'NERC - UK Solar System Data Centre', contactInfo = [contact]) 
    5454    ret.id = iid 
    5555    return ret 
     
    6060    """ 
    6161    party = [assembleMO_Individual(iid = 1), assembleMO_Organization(iid = 2)] 
    62     rp = createMO_ResponsiblePartyInfo(role, party) 
     62    rp = create_mo_responsible_party_info(role, party) 
    6363    rp.id =iid 
    6464    return rp 
     
    7272    """ 
    7373    py_datetime = isoDateTimeStringToTimeDate(timestring) 
    74     date_time = createDateTime(py_datetime)     
    75     tm_position = createTM_Position(dateTime8601 = date_time) 
    76     return createTM_Instant(tm_position) 
     74    date_time = create_datetime(py_datetime)     
     75    tm_position = create_tm_position(dateTime8601 = date_time) 
     76    return create_tm_instant(tm_position) 
    7777 
    7878def assembleObservation(phenomenonTime = '2002-07-22/2011-08-06'): 
     
    8080    ceda_observation.relatedParty = assembleMO_ResponsiblePartyInfo() 
    8181    ceda_observation.resultTime = assembleTM_Instant() 
    82     ceda_observation.phenomenonTime = fromDateStringToPhenomenonTime(phenomenonTime) 
     82    ceda_observation.phenomenonTime = from_date_string_to_pt(phenomenonTime) 
    8383    return ceda_observation 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/om/period.py

    r8487 r8496  
    3535from cedaMoles.MolesManager.views.moles2gui import encodeCedaMoles2Json,\ 
    3636    decodeJson2CedaMoles, getData 
    37 from cedaMoles.libs.migration.processor.commons import fromDateStringToPhenomenonTime 
     37from cedaMoles.libs.migration.processor.commons import from_date_string_to_pt 
    3838 
    3939 
     
    5454        Validates a simple encode/decode 
    5555        """ 
    56         period = fromDateStringToPhenomenonTime('2002-07-22/2011-08-06')  
     56        period = from_date_string_to_pt('2002-07-22/2011-08-06')  
    5757        json = encodeCedaMoles2Json(period) 
    5858        #----------------------- test ------------------------ 
     
    7070        Decodes an updated json object 
    7171        """ 
    72         period = fromDateStringToPhenomenonTime('2002-07-22/2011-08-06')  
     72        period = from_date_string_to_pt('2002-07-22/2011-08-06')  
    7373        json = encodeCedaMoles2Json(period) 
    7474        decJson = loads(json) 
Note: See TracChangeset for help on using the changeset viewer.