You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/03/26 16:31:23 UTC
[2/3] incubator-ariatosca git commit: added service_template
added service_template
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/f48e6328
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f48e6328
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f48e6328
Branch: refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors
Commit: f48e63284032e3990db28500e122829e3418f8a4
Parents: 2ac65e7
Author: max-orlov <ma...@gigaspaces.com>
Authored: Sun Mar 26 14:24:26 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Sun Mar 26 14:24:26 2017 +0300
----------------------------------------------------------------------
aria/modeling/service_common.py | 4 +++
aria/modeling/service_template.py | 51 ++++++++++++++++++++++++++++++++--
2 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f48e6328/aria/modeling/service_common.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index d6b1f33..48c3170 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -275,6 +275,10 @@ class PluginSpecificationBase(TemplateModelMixin):
# endregion
+ @declared_attr
+ def service_template(cls):
+ return relationship.many_to_one(cls, 'service_template')
+
@property
def as_raw(self):
return collections.OrderedDict((
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f48e6328/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py
index 7246ff1..e435a6d 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -423,6 +423,10 @@ class NodeTemplateBase(TemplateModelMixin):
max_instances = Column(Integer, default=None)
@declared_attr
+ def service_template(cls):
+ return relationship.many_to_one(cls, 'service_template')
+
+ @declared_attr
def properties(cls):
return relationship.many_to_many(cls, 'parameter', prefix='properties', dict_key='name')
@@ -440,8 +444,7 @@ class NodeTemplateBase(TemplateModelMixin):
@declared_attr
def requirement_templates(cls):
- return relationship.one_to_many(cls, 'requirement_template', child_fk='node_template_fk',
- child_property='node_template')
+ return relationship.one_to_many(cls, 'requirement_template', child_fk='node_template_fk')
target_node_template_constraints = Column(modeling_types.StrictList(FunctionType))
@@ -572,6 +575,10 @@ class GroupTemplateBase(TemplateModelMixin):
'service_template_fk']
@declared_attr
+ def service_template(cls):
+ return relationship.many_to_one(cls, 'service_template')
+
+ @declared_attr
def type(cls):
return relationship.many_to_one(cls, 'type')
@@ -677,6 +684,10 @@ class PolicyTemplateBase(TemplateModelMixin):
'service_template_fk']
@declared_attr
+ def service_template(cls):
+ return relationship.many_to_one(cls, 'service_template')
+
+ @declared_attr
def type(cls):
return relationship.many_to_one(cls, 'type')
@@ -843,6 +854,10 @@ class SubstitutionTemplateMappingBase(TemplateModelMixin):
'requirement_template_fk']
@declared_attr
+ def substitution_template(cls):
+ return relationship.one_to_many(cls, 'substitution_template', dict_key='name')
+
+ @declared_attr
def node_template(cls):
return relationship.one_to_one(cls, 'node_template')
@@ -968,6 +983,10 @@ class RequirementTemplateBase(TemplateModelMixin):
'relationship_template_fk']
@declared_attr
+ def node_template(cls):
+ return relationship.many_to_one(cls, 'node_template')
+
+ @declared_attr
def target_node_type(cls):
return relationship.many_to_one(cls, 'type', fk='target_node_type_fk',
parent_property=False)
@@ -1246,6 +1265,10 @@ class CapabilityTemplateBase(TemplateModelMixin):
'node_template_fk']
@declared_attr
+ def node_template(cls):
+ return relationship.many_to_one(cls, 'node_template')
+
+ @declared_attr
def type(cls):
return relationship.many_to_one(cls, 'type')
@@ -1379,6 +1402,18 @@ class InterfaceTemplateBase(TemplateModelMixin):
'relationship_template_fk']
@declared_attr
+ def relationship_template(cls):
+ return relationship.one_to_many(cls, 'relationship_template')
+
+ @declared_attr
+ def group_template(cls):
+ return relationship.many_to_one(cls, 'group_template')
+
+ @declared_attr
+ def node_template(cls):
+ return relationship.many_to_one(cls, 'node_template')
+
+ @declared_attr
def type(cls):
return relationship.many_to_one(cls, 'type')
@@ -1497,6 +1532,14 @@ class OperationTemplateBase(TemplateModelMixin):
description = Column(Text)
@declared_attr
+ def service_template(cls):
+ return relationship.many_to_one(cls, 'service_template')
+
+ @declared_attr
+ def interface_template(cls):
+ return relationship.one_to_many(cls, 'interface_template')
+
+ @declared_attr
def plugin_specification(cls):
return relationship.one_to_one(cls, 'plugin_specification')
@@ -1617,6 +1660,10 @@ class ArtifactTemplateBase(TemplateModelMixin):
'node_template_fk']
@declared_attr
+ def node_template(cls):
+ return relationship.many_to_one(cls, 'node_template')
+
+ @declared_attr
def type(cls):
return relationship.many_to_one(cls, 'type')