source: mauRepo/MolesManager/trunk/src/libs/migration/client.py @ 8042

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/libs/migration/client.py@8042
Revision 8042, 1.6 KB checked in by mnagni, 8 years ago (diff)

The tables are correctly generated but still some problem with class initialization.
Migration is partially working.
Starting the deployment structure implementation.

Line 
1'''
2Created on 9 Nov 2011
3
4@author: mnagni
5'''
6from libs.migration.db.dbConnection import MOLES3DB, \
7    getObservationCollectionMigrationOrderByDate, _buildFilter
8from libs.migration.processor.dataEntity import DataEntityProcessor
9from libs.migration.processor.loadResources import LoadResources
10from ea_model.moles3_4.utilities.mo_responsiblepartyinfo import MO_ResponsiblePartyInfo
11from ea_model.moles3_4.utilities.mo_rolevalue import MO_RoleValue
12from ea_model.upcomingiso.ci_party import CI_Party
13from libs.commons_db import doInsertOrUpdate
14
15'''
16exist/rest/atoms/published/data_entities/neodc.nerc.ac.uk
17'''
18
19
20session = MOLES3DB.getSession()
21
22'''
23So it works:
24Loads the eXist resources
25Loops over a docStatus
26Loops over the data_entities
27For each data_entity loop over its deployments
28'''
29
30
31
32'''
33ceda_observation = CEDA_Observation()
34ceda_observation.dataLineage = 'mauData'
35ceda_observation.relatedParty = []
36rp = MO_ResponsiblePartyInfo()
37rp.role = MO_RoleValue.cl_author
38rp.party = []
39party = CI_Party()
40party.name = 'Mau'
41rp.party.append(party)
42ceda_observation.relatedParty.append(rp)
43doInsertOrUpdate([ceda_observation], session, update = False)
44session.commit()
45
46
47res = session.query(CEDA_Observation).filter(*[_buildFilter('ceda_observation_id', 2)])
48rp = res[0].relatedParty[0]
49print rp
50'''
51
52
53lr = LoadResources(session)
54lr.process()
55
56sorted_data_ents = getObservationCollectionMigrationOrderByDate(session)
57exs = []
58#loops over the sorted data entities
59for de in sorted_data_ents:   
60    de_path = '%s/%s' % (de.exist_path, de.data_ent_name)
61    dep = DataEntityProcessor(de_path, session)
62    exs.append(dep.process())   
63    session.commit()
64print exs   
65
66
Note: See TracBrowser for help on using the repository browser.