|
@@ -219,10 +219,6 @@ String function cmd_attr_optional(write : Boolean, model : Element, element_name
|
|
|
if (set_in(dict_keys(attrs), attr_name)):
|
|
if (set_in(dict_keys(attrs), attr_name)):
|
|
|
String attr_edge
|
|
String attr_edge
|
|
|
attr_edge = reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_name))
|
|
attr_edge = reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_name))
|
|
|
- if (optional):
|
|
|
|
|
- log("Setting to optional")
|
|
|
|
|
- else:
|
|
|
|
|
- log("Setting to mandatory")
|
|
|
|
|
model_undefine_attribute(model, element_name, attr_name)
|
|
model_undefine_attribute(model, element_name, attr_name)
|
|
|
model_define_attribute_ID(model, element_name, attr_name, optional, attrs[attr_name], attr_edge)
|
|
model_define_attribute_ID(model, element_name, attr_name, optional, attrs[attr_name], attr_edge)
|
|
|
return "Success"!
|
|
return "Success"!
|
|
@@ -243,7 +239,6 @@ String function cmd_undefine_attribute(write : Boolean, model : Element, element
|
|
|
if (set_in(dict_keys(attrs), attr_name)):
|
|
if (set_in(dict_keys(attrs), attr_name)):
|
|
|
if (set_in(dict_keys(attrs), attr_name)):
|
|
if (set_in(dict_keys(attrs), attr_name)):
|
|
|
model_undefine_attribute(model, element_name, attr_name)
|
|
model_undefine_attribute(model, element_name, attr_name)
|
|
|
- log("REMOVE OK")
|
|
|
|
|
return "Success"!
|
|
return "Success"!
|
|
|
else:
|
|
else:
|
|
|
return "Attribute not defined: " + attr_name!
|
|
return "Attribute not defined: " + attr_name!
|
|
@@ -376,14 +371,16 @@ String function cmd_read_defined_attrs(model : Element, element_name : String):
|
|
|
Element attr_list
|
|
Element attr_list
|
|
|
Element attr_keys
|
|
Element attr_keys
|
|
|
String attr_key
|
|
String attr_key
|
|
|
|
|
+ Element optionality
|
|
|
|
|
|
|
|
result = "Success: "
|
|
result = "Success: "
|
|
|
if (dict_in(model["model"], element_name)):
|
|
if (dict_in(model["model"], element_name)):
|
|
|
attr_list = getInstantiatableAttributes(model, element_name, "AttributeLink")
|
|
attr_list = getInstantiatableAttributes(model, element_name, "AttributeLink")
|
|
|
|
|
+ optionality = getAttributeOptionality(model, element_name, "AttributeLink")
|
|
|
attr_keys = dict_keys(attr_list)
|
|
attr_keys = dict_keys(attr_list)
|
|
|
while (0 < set_len(attr_keys)):
|
|
while (0 < set_len(attr_keys)):
|
|
|
attr_key = set_pop(attr_keys)
|
|
attr_key = set_pop(attr_keys)
|
|
|
- if (value_eq(read_attribute(model, reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_key)), "optional"), True)):
|
|
|
|
|
|
|
+ if (optionality[attr_key]):
|
|
|
result = string_join(result, attr_key) + " ?: " + cast_string(attr_list[attr_key]) + "\n"
|
|
result = string_join(result, attr_key) + " ?: " + cast_string(attr_list[attr_key]) + "\n"
|
|
|
else:
|
|
else:
|
|
|
result = string_join(result, attr_key) + " : " + cast_string(attr_list[attr_key]) + "\n"
|
|
result = string_join(result, attr_key) + " : " + cast_string(attr_list[attr_key]) + "\n"
|