ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject incubator-ariatosca git commit: ARIA-208 Fix models relationships [Forced Update!]
Date Mon, 22 May 2017 12:15:04 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-208-Missing-back-refrences-for-models 890a2a4a2 -> d1628c395 (forced
update)


ARIA-208 Fix models relationships


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/d1628c39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d1628c39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d1628c39

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: d1628c39558c57f8889e8fef57a4b6a28ff32e77
Parents: 8553977
Author: Ran Ziv <ran@gigaspaces.com>
Authored: Sun May 7 14:58:46 2017 +0300
Committer: Ran Ziv <ran@gigaspaces.com>
Committed: Mon May 22 15:14:47 2017 +0300

----------------------------------------------------------------------
 aria/modeling/service_template.py | 49 ++++++++++++++++------------------
 1 file changed, 23 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d1628c39/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py
index 7fab4fc..644b8f4 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -210,10 +210,6 @@ class ServiceTemplateBase(TemplateModelMixin):
         return relationship.one_to_many(cls, 'service')
 
     @declared_attr
-    def operation_templates(cls):
-        return relationship.one_to_many(cls, 'operation_template')
-
-    @declared_attr
     def node_templates(cls):
         return relationship.one_to_many(cls, 'node_template', dict_key='name')
 
@@ -482,6 +478,22 @@ class NodeTemplateBase(TemplateModelMixin):
     def nodes(cls):
         return relationship.one_to_many(cls, 'node')
 
+    @declared_attr
+    def interface_templates(cls):
+        return relationship.one_to_many(cls, 'interface_template', dict_key='name')
+
+    @declared_attr
+    def artifact_templates(cls):
+        return relationship.one_to_many(cls, 'artifact_template', dict_key='name')
+
+    @declared_attr
+    def capability_templates(cls):
+        return relationship.one_to_many(cls, 'capability_template', dict_key='name')
+
+    @declared_attr
+    def requirement_templates(cls):
+        return relationship.one_to_many(cls, 'requirement_template', child_fk='node_template_fk')
+
     # endregion
 
     # region many_to_one relationships
@@ -502,22 +514,6 @@ class NodeTemplateBase(TemplateModelMixin):
     def properties(cls):
         return relationship.many_to_many(cls, 'parameter', prefix='properties', dict_key='name')
 
-    @declared_attr
-    def interface_templates(cls):
-        return relationship.one_to_many(cls, 'interface_template', dict_key='name')
-
-    @declared_attr
-    def artifact_templates(cls):
-        return relationship.one_to_many(cls, 'artifact_template', dict_key='name')
-
-    @declared_attr
-    def capability_templates(cls):
-        return relationship.one_to_many(cls, 'capability_template', dict_key='name')
-
-    @declared_attr
-    def requirement_templates(cls):
-        return relationship.one_to_many(cls, 'requirement_template', child_fk='node_template_fk')
-
     # endregion
 
     description = Column(Text)
@@ -1190,11 +1186,6 @@ class RequirementTemplateBase(TemplateModelMixin):
     def relationships(cls):
         return relationship.one_to_many(cls, 'relationship')
 
-    @declared_attr
-    def target_node_type(cls):
-        return relationship.many_to_one(
-            cls, 'type', fk='target_node_type_fk', back_populates=relationship.NO_BACK_POP)
-
     # endregion
 
     # region many_to_one relationships
@@ -1203,6 +1194,11 @@ class RequirementTemplateBase(TemplateModelMixin):
     def node_template(cls):
         return relationship.many_to_one(cls, 'node_template', fk='node_template_fk')
 
+    @declared_attr
+    def target_node_type(cls):
+        return relationship.many_to_one(
+            cls, 'type', fk='target_node_type_fk', back_populates=relationship.NO_BACK_POP)
+
     # endregion
 
     # region many_to_many relationships
@@ -1826,7 +1822,8 @@ class OperationTemplateBase(TemplateModelMixin):
 
     @declared_attr
     def service_template(cls):
-        return relationship.many_to_one(cls, 'service_template')
+        return relationship.many_to_one(cls, 'service_template',
+                                        back_populates='workflow_templates')
 
     @declared_attr
     def interface_template(cls):


Mime
View raw message