source: mauRepo/MolesManager/trunk/src/ea_model/iso_19109_2005_application_schema/general_feature_model/gf_featuretype.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19109_2005_application_schema/general_feature_model/gf_featuretype.py@8091
Revision 8091, 4.7 KB checked in by mnagni, 8 years ago (diff)

The migration process now includes
1) deployment_data files
2) XML document hash
3) full Dojo support


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 16-Feb-2012 16:18:11
25
26@author: mnagni
27'''
28
29class GF_FeatureType(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.theGF_InheritanceRelation = []
43        self._carrierOfCharacteristics_gf_attributetype = []
44        self._carrierOfCharacteristics_gf_associationrole = []
45        self._carrierOfCharacteristics_gf_operation = []
46        self._linkBetween_gf_temporalassociationtype = []
47        self._linkBetween_gf_aggregationtype = []
48        self._linkBetween_gf_spatialassociationtype = []
49        self.featureTypeMetadata = []
50        self.typeName = None
51        self.isAbstract = None
52        self.constrainedBy = []
53        self.definition = None
54        super(GF_FeatureType, self).__init__()
55
56    @property
57    def carrierOfCharacteristics(self): 
58        ret = []
59        for item in self._carrierOfCharacteristics_gf_attributetype:
60            ret.append(item)
61        for item in self._carrierOfCharacteristics_gf_associationrole:
62            ret.append(item)
63        for item in self._carrierOfCharacteristics_gf_operation:
64            ret.append(item)
65        return ret
66
67    @carrierOfCharacteristics.setter
68    def carrierOfCharacteristics(self, value): 
69        if isinstance(value, list):
70            self._carrierOfCharacteristics_gf_attributetype[:]
71            self._carrierOfCharacteristics_gf_associationrole[:]
72            self._carrierOfCharacteristics_gf_operation[:]
73            for item in value:
74                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
75                if valueClass == "ea_model.iso_19109_2005_application_schema.general_feature_model.gf_attributetype.GF_AttributeType":
76                    self._carrierOfCharacteristics_gf_attributetype.append(item)
77                    continue
78                if valueClass == "ea_model.iso_19109_2005_application_schema.general_feature_model.gf_associationrole.GF_AssociationRole":
79                    self._carrierOfCharacteristics_gf_associationrole.append(item)
80                    continue
81                if valueClass == "ea_model.iso_19109_2005_application_schema.general_feature_model.gf_operation.GF_Operation":
82                    self._carrierOfCharacteristics_gf_operation.append(item)
83                    continue
84
85    @property
86    def linkBetween(self):     
87        ret = []
88        for item in self._linkBetween_gf_temporalassociationtype:
89            ret.append(item)
90        for item in self._linkBetween_gf_aggregationtype:
91            ret.append(item)
92        for item in self._linkBetween_gf_spatialassociationtype:
93            ret.append(item)
94        return ret
95
96    @linkBetween.setter
97    def linkBetween(self, value):       
98        if isinstance(value, list):
99            self._linkBetween_gf_temporalassociationtype[:]
100            self._linkBetween_gf_aggregationtype[:]
101            self._linkBetween_gf_spatialassociationtype[:]
102            for item in value:
103                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
104                if valueClass == "ea_model.iso_19109_2005_application_schema.general_feature_model.gf_temporalassociationtype.GF_TemporalAssociationType":
105                    self._linkBetween_gf_temporalassociationtype.append(item)
106                    continue
107                if valueClass == "ea_model.iso_19109_2005_application_schema.general_feature_model.gf_aggregationtype.GF_AggregationType":
108                    self._linkBetween_gf_aggregationtype.append(item)
109                    continue
110                if valueClass == "ea_model.iso_19109_2005_application_schema.general_feature_model.gf_spatialassociationtype.GF_SpatialAssociationType":
111                    self._linkBetween_gf_spatialassociationtype.append(item)
112                    continue
113
114    def __key(self):
115        return (self.theGF_InheritanceRelation, self.carrierOfCharacteristics, self.linkBetween, self.featureTypeMetadata, self.typeName, self.isAbstract, self.constrainedBy, self.definition)
116
117    def __eq__(self, y):
118        '''
119        Cannot compare classes which do not define a "__key" attribute
120        '''
121        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
122            return self.__key() == y.__key()
123        return id(self) == id(y)
124
125    def __hash__(self):
126        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.