source: mauRepo/MolesManager/trunk/src/ea_model/iso_19135_2005_procedures_for_registration/re_submittingorganization.py @ 8197

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19135_2005_procedures_for_registration/re_submittingorganization.py@8197
Revision 8197, 4.1 KB checked in by mnagni, 8 years ago (diff)

New database schema where URL class is a string and MO_Project.subProject use CEDA_Project as subType

Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ascore.utils import has_value, collectionProofHash
22
23'''
24Created on 30-Mar-2012 16:45:21
25
26@author: mnagni
27'''
28
29class RE_SubmittingOrganization(object):
30    '''
31        Represents a data entity defined in a UML diagram and supposed to
32        be persisted in a relational database.
33 
34        This class has been genererated automatically using the Apache Velocity project.
35    '''
36    '''
37        Please note that any access to the inner attributes should be done using
38        the given get/set methods and NOT accessing them directly.
39    '''
40    def __init__(self):
41
42        self.name = None
43        self._register_cl_classificationregister = []
44        self._register_cl_classificationregister = []
45        self._proposalInformation_re_amendmentinformation = []
46        self._proposalInformation_re_additioninformation = []
47        self._proposalInformation_re_clarificationinformation = []
48        self.contact = None
49        super(RE_SubmittingOrganization, self).__init__()
50
51    @property
52    def register(self): 
53        ret = []
54        for item in self._register_cl_classificationregister:
55            ret.append(item)
56        for item in self._register_cl_classificationregister:
57            ret.append(item)
58        return ret
59
60    @register.setter
61    def register(self, value): 
62        if isinstance(value, list):
63            self._register_cl_classificationregister[:]
64            self._register_cl_classificationregister[:]
65            for item in value:
66                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
67                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationregister.CL_ClassificationRegister":
68                    self._register_cl_classificationregister.append(item)
69                    continue
70                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationregister.CL_ClassificationRegister":
71                    self._register_cl_classificationregister.append(item)
72                    continue
73
74    @property
75    def proposalInformation(self):     
76        ret = []
77        for item in self._proposalInformation_re_amendmentinformation:
78            ret.append(item)
79        for item in self._proposalInformation_re_additioninformation:
80            ret.append(item)
81        for item in self._proposalInformation_re_clarificationinformation:
82            ret.append(item)
83        return ret
84
85    @proposalInformation.setter
86    def proposalInformation(self, value):       
87        if isinstance(value, list):
88            self._proposalInformation_re_amendmentinformation[:]
89            self._proposalInformation_re_additioninformation[:]
90            self._proposalInformation_re_clarificationinformation[:]
91            for item in value:
92                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
93                if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_amendmentinformation.RE_AmendmentInformation":
94                    self._proposalInformation_re_amendmentinformation.append(item)
95                    continue
96                if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_additioninformation.RE_AdditionInformation":
97                    self._proposalInformation_re_additioninformation.append(item)
98                    continue
99                if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_clarificationinformation.RE_ClarificationInformation":
100                    self._proposalInformation_re_clarificationinformation.append(item)
101                    continue
102
103    def __key(self):
104        return (self.name, self.register, self.proposalInformation, self.contact)
105
106    def __eq__(self, y):
107        if type(self) != type(y):
108            return False
109        '''
110        Cannot compare classes which do not define a "__key" attribute
111        '''
112        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
113            return self.__key() == y.__key()
114        return id(self) == id(y)
115
116    def __hash__(self):
117        return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.