Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-208-Missing-back-refrences-for-models 85539771c -> 890a2a4a2
wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/890a2a4a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/890a2a4a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/890a2a4a Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models Commit: 890a2a4a21736f95a1ef60ffb808a8038573042e Parents: 8553977 Author: max-orlov <ma...@gigaspaces.com> Authored: Sun May 7 14:58:46 2017 +0300 Committer: max-orlov <ma...@gigaspaces.com> Committed: Sun May 7 14:58:46 2017 +0300 ---------------------------------------------------------------------- aria/modeling/service_template.py | 46 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/890a2a4a/aria/modeling/service_template.py ---------------------------------------------------------------------- diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py index 7fab4fc..86274e4 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