Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-149-functions-in-operation-configuration b1c97e244 -> 
84d8da592 (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/5798bbfc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/5798bbfc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/5798bbfc

Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 5798bbfc7d1a95965a4c44d2ebad5dad245c824a
Parents: 78d6019
Author: Ran Ziv <r...@gigaspaces.com>
Authored: Sun May 7 14:58:46 2017 +0300
Committer: Ran Ziv <r...@gigaspaces.com>
Committed: Mon May 22 15:17:21 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/5798bbfc/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 1eb95a3..12195a1 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -211,10 +211,6 @@ class ServiceTemplateBase(TemplateModelMixin):
         return relationship.one_to_many(cls, 'service', dict_key='name')
 
     @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')
 
@@ -483,6 +479,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
@@ -507,22 +519,6 @@ class NodeTemplateBase(TemplateModelMixin):
     def attributes(cls):
         return relationship.many_to_many(cls, 'parameter', 
prefix='attributes', 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)
@@ -1209,11 +1205,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
@@ -1222,6 +1213,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
@@ -1845,7 +1841,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):

Reply via email to