source: mauRepo/MolesManager/trunk/tests/moles2gui/creationFactory.py @ 8476

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/tests/moles2gui/creationFactory.py@8476
Revision 8476, 3.2 KB checked in by mnagni, 8 years ago (diff)

Implemented the core cedaObject_to_adapter.
At this moment only MO_ResponsiblePartyInfo and MO_party are fully implemented.
Many unittest have been added to the implementation, however it should still be tested against the database

Added a Sphinx documentation folder

Line 
1'''
2BSD Licence
3Copyright (c) 2012, Science & Technology Facilities Council (STFC)
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without modification,
7are permitted provided that the following conditions are met:
8
9    * Redistributions of source code must retain the above copyright notice,
10        this list of conditions and the following disclaimer.
11    * Redistributions in binary form must reproduce the above copyright notice,
12        this list of conditions and the following disclaimer in the documentation
13        and/or other materials provided with the distribution.
14    * Neither the name of the Science & Technology Facilities Council (STFC)
15        nor the names of its contributors may be used to endorse or promote
16        products derived from this software without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29Created on 24 Jul 2012
30
31@author: mnagni
32'''
33from libs.migration.processor.commons import createCI_OnlineResource,\
34    createCI_Address, createCI_Telephone, createCI_Contact,\
35    createMO_Organization, createMO_Individual, createMO_ResponsiblePartyInfo
36from MolesManager.codelist import getCLValue, MM_RoleValue
37
38def assembleMO_Individual(name = 'CedaTest', iid = 1):
39    ret = createMO_Individual(name = name)
40    ret.id = iid
41    return ret
42
43def assembleMO_Organization(name = 'UK Solar System Data Centre website', iid = 1):
44    i_linkage = 'http://www.ukssdc.rl.ac.uk'
45    i_onlineResources = createCI_OnlineResource(linkage = i_linkage, name = name)
46    i_address = createCI_Address(deliveryPoint = ['UK Solar System Data Centre, STFC Rutherford Appleton Laboratory'], \
47                                 electronicMailAddress=['support@rl.ac.uk'], postalCode='OX11 0QX', country='UK', city='Harwell Oxford')                                   
48    i_phone = createCI_Telephone(voice=['+44(0)1235 445173'])                                 
49    contact = createCI_Contact(phone=i_phone, address=i_address, onlineResource=i_onlineResources)                       
50    ret = createMO_Organization(name = 'NERC - UK Solar System Data Centre', contactInfo = [contact])
51    ret.id = iid
52    return ret
53
54def assembleMO_ResponsiblePartyInfo(role = getCLValue(MM_RoleValue.cl_author), iid = 1):
55    """
56        Returns a MO_ResponsiblePartyInfo owning two parties (one MO_Individual and one MO_Organization)
57    """
58    party = [assembleMO_Individual(iid = 1), assembleMO_Organization(iid = 2)]
59    rp = createMO_ResponsiblePartyInfo(role, party)
60    rp.id =iid
61    return rp
Note: See TracBrowser for help on using the repository browser.