[CORD-2810] Only synchronizers can write feedback state
Change-Id: Ia3f28763a0212a570186e4c6c5cb118c40325b5b
diff --git a/lib/xos-genx/xosgenx/targets/django.xtarget b/lib/xos-genx/xosgenx/targets/django.xtarget
index 8ef8e5f..13d37f9 100644
--- a/lib/xos-genx/xosgenx/targets/django.xtarget
+++ b/lib/xos-genx/xosgenx/targets/django.xtarget
@@ -44,6 +44,11 @@
class {{ m.name }}{{ legacy_tag }}{{ xproto_base_def(m.name, m.bases) }}:
plural_name = "{{ xproto_pluralize(m) }}"
+ {%- set feedback_state_fields = xproto_optioned_fields_to_list(xproto_base_fields(m, proto.message_table) + m.fields, 'feedback_state', 'True') %}
+ {%- if feedback_state_fields|length > 0 %}
+ feedback_state_fields = {{ feedback_state_fields }}
+ {%- endif %}
+
{# {% if m.options.no_sync or m.options.no_policy %}#}
{# {% if m.options.no_sync -%}#}
{# # Removing synchronizer feedback state from model#}
diff --git a/lib/xos-genx/xosgenx/targets/modeldefs.xtarget b/lib/xos-genx/xosgenx/targets/modeldefs.xtarget
index 3b0790a..15c43d7 100644
--- a/lib/xos-genx/xosgenx/targets/modeldefs.xtarget
+++ b/lib/xos-genx/xosgenx/targets/modeldefs.xtarget
@@ -29,6 +29,7 @@
{% endfor %}
{%- endif %}
type: {{ xproto_type_to_ui_type(f) }}
+ read_only: {{ xproto_is_true(f.options.feedback_state) }}
{% set validators = xproto_validators(f) -%}
{% if validators -%}
validators:
diff --git a/lib/xos-genx/xosgenx/targets/service.xtarget b/lib/xos-genx/xosgenx/targets/service.xtarget
index a9ca934..ed78ff1 100644
--- a/lib/xos-genx/xosgenx/targets/service.xtarget
+++ b/lib/xos-genx/xosgenx/targets/service.xtarget
@@ -41,6 +41,11 @@
class {{ m.name }}{{ legacy_tag }}{{ xproto_base_def(m.name, m.bases, legacy_tag, proto.message_names) }}:
plural_name = "{{ xproto_pluralize(m) }}"
+ {%- set feedback_state_fields = xproto_optioned_fields_to_list(xproto_base_fields(m, proto.message_table) + m.fields, 'feedback_state', 'True') %}
+ {%- if feedback_state_fields|length > 0 %}
+ feedback_state_fields = {{ feedback_state_fields }}
+ {%- endif %}
+
KIND = {{ xproto_first_non_empty([m.options.kind, options.kind, options.name, "Set a kind in your xproto!"]) }}
{% if m.options.owner_class_name %}