source: mauRepo/MolesManager/trunk/src/ea_model/iso_19135_2005_procedures_for_registration/re_register.py @ 8088

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

New ea_model library.
No more use the django.forms. Now uses JSON and Dojo(javascript)
DB creation files are now executed as standard python function (before was used a system execution call)
Added an html example to play/work offline with DOJO

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
22
23'''
24Created on 10-Feb-2012 12:03:16
25
26@author: mnagni
27'''
28
29class RE_Register(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.owner = None
43        self.manager = None
44        self.version = None
45        self._containedItemClass_cl_classificationlegendclass = []
46        self._containedItemClass_cl_classificationruleclass = []
47        self._containedItemClass_cl_classificationlegendclass = []
48        self._containedItemClass_cl_classificationruleclass = []
49        self.dateOfLastChange = None
50        self.contentSummary = None
51        self.citation = []
52        self.submitter = []
53        self.name = None
54        self.uniformResourceIdentifier = []
55        self.alternativeLanguages = []
56        self.operatingLanguage = None
57        self._containedItem_re_subregisterdescription = []
58        self._containedItem_cl_classificationlegenditem = []
59        self._containedItem_cl_classificationlegenditem = []
60        self._containedItem_cl_classificationruleitem = []
61        self._containedItem_cl_classificationruleitem = []
62        super(RE_Register, self).__init__()
63
64    @property
65    def containedItemClass(self):       
66        ret = []
67        for item in self._containedItemClass_cl_classificationlegendclass:
68            ret.append(item)
69        for item in self._containedItemClass_cl_classificationruleclass:
70            ret.append(item)
71        for item in self._containedItemClass_cl_classificationlegendclass:
72            ret.append(item)
73        for item in self._containedItemClass_cl_classificationruleclass:
74            ret.append(item)
75        return ret
76
77    @containedItemClass.setter
78    def containedItemClass(self, value):       
79        if isinstance(value, list):
80            self._containedItemClass_cl_classificationlegendclass[:]
81            self._containedItemClass_cl_classificationruleclass[:]
82            self._containedItemClass_cl_classificationlegendclass[:]
83            self._containedItemClass_cl_classificationruleclass[:]
84            for item in value:
85                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
86                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegendclass.CL_ClassificationLegendClass":
87                    self._containedItemClass_cl_classificationlegendclass.append(item)
88                    continue
89                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleclass.CL_ClassificationRuleClass":
90                    self._containedItemClass_cl_classificationruleclass.append(item)
91                    continue
92                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegendclass.CL_ClassificationLegendClass":
93                    self._containedItemClass_cl_classificationlegendclass.append(item)
94                    continue
95                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleclass.CL_ClassificationRuleClass":
96                    self._containedItemClass_cl_classificationruleclass.append(item)
97                    continue
98
99    @property
100    def containedItem(self):   
101        ret = []
102        for item in self._containedItem_re_subregisterdescription:
103            ret.append(item)
104        for item in self._containedItem_cl_classificationlegenditem:
105            ret.append(item)
106        for item in self._containedItem_cl_classificationlegenditem:
107            ret.append(item)
108        for item in self._containedItem_cl_classificationruleitem:
109            ret.append(item)
110        for item in self._containedItem_cl_classificationruleitem:
111            ret.append(item)
112        return ret
113
114    @containedItem.setter
115    def containedItem(self, value):     
116        if isinstance(value, list):
117            self._containedItem_re_subregisterdescription[:]
118            self._containedItem_cl_classificationlegenditem[:]
119            self._containedItem_cl_classificationlegenditem[:]
120            self._containedItem_cl_classificationruleitem[:]
121            self._containedItem_cl_classificationruleitem[:]
122            for item in value:
123                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
124                if valueClass == "ea_model.iso_19135_2005_procedures_for_registration.re_subregisterdescription.RE_SubregisterDescription":
125                    self._containedItem_re_subregisterdescription.append(item)
126                    continue
127                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem":
128                    self._containedItem_cl_classificationlegenditem.append(item)
129                    continue
130                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationlegenditem.CL_ClassificationLegendItem":
131                    self._containedItem_cl_classificationlegenditem.append(item)
132                    continue
133                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem":
134                    self._containedItem_cl_classificationruleitem.append(item)
135                    continue
136                if valueClass == "ea_model.iso_19144_1_classification_systems.cl_classificationruleitem.CL_ClassificationRuleItem":
137                    self._containedItem_cl_classificationruleitem.append(item)
138                    continue
139
140    def __key(self):
141        return (self.owner, self.manager, self.version, self.containedItemClass, self.dateOfLastChange, self.contentSummary, self.citation, self.submitter, self.name, self.uniformResourceIdentifier, self.alternativeLanguages, self.operatingLanguage, self.containedItem)
142
143    def __eq__(self, y):
144        '''
145        Cannot compare classes which do not define a "__key" attribute
146        '''
147        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
148            return self.__key() == y.__key()
149        return id(self) == id(y)
150
151    def __hash__(self):
152        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.