|
|
@ -16,25 +16,21 @@ import tools.git_tool |
|
|
|
TABLE_NAME = "variant" |
|
|
|
""" system-name for this entity """ |
|
|
|
FIELD_ID = "vrid" |
|
|
|
FIELD_NAME = "name" |
|
|
|
FIELD_DESCRIPTION = B.SUBJECT_DESCRIPTION |
|
|
|
FIELD_REFERENCE = B.SUBJECT_REFERENCE |
|
|
|
FIELD_PROJECT = B.SUBJECT_PROJECT |
|
|
|
FIELD_COMPONENT = B.SUBJECT_COMP |
|
|
|
FIELD_ATTRIBUTES = B.NODE_ATTRIBUTES |
|
|
|
LIST_FIELDS = [FIELD_ID, FIELD_NAME, FIELD_DESCRIPTION, FIELD_REFERENCE, FIELD_PROJECT, FIELD_COMPONENT, FIELD_ATTRIBUTES] |
|
|
|
""" list of object-attributes """ |
|
|
|
LIST_NODES = [B.NODE_ATTRIBUTES] |
|
|
|
LIST_SUBTABLES = [] |
|
|
|
|
|
|
|
FILE_EXTENSION = D.DFILE_TYPE_YML |
|
|
|
UNIQUE_FIELDS = [FIELD_NAME] |
|
|
|
UNIQUE_FIELDS = [D.FIELD_NAME] |
|
|
|
""" unique business field as human identifer """ |
|
|
|
IDENTIFYER_FIELDS = [FIELD_ID] |
|
|
|
""" unique technical field as technical identifer """ |
|
|
|
|
|
|
|
|
|
|
|
class Variant(model.entity.Entity): |
|
|
|
FIELD_ID = "vrid" |
|
|
|
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE, B.SUBJECT_PROJECT] |
|
|
|
""" list of object-attributes """ |
|
|
|
LIST_NODES = [B.NODE_ATTRIBUTES] |
|
|
|
LIST_SUBTABLES = [B.SUBJECT_COMPS] |
|
|
|
""" list of object-attributes """ |
|
|
|
name = "" |
|
|
|
description = "" |
|
|
|
reference = "" |
|
|
@ -42,17 +38,6 @@ class Variant(model.entity.Entity): |
|
|
|
project = "" |
|
|
|
component = "" |
|
|
|
|
|
|
|
def __init__(self, job, project, name=""): |
|
|
|
""" |
|
|
|
to be initialized by readSpec |
|
|
|
project : optional |
|
|
|
alternative parameter |
|
|
|
name : name of variant or default - only from testspec |
|
|
|
obj : object with main attributes |
|
|
|
:param job: |
|
|
|
""" |
|
|
|
self.job = job |
|
|
|
self.project = project |
|
|
|
|
|
|
|
def read_unique_names(self, job, project, application, gran, args): |
|
|
|
""" |
|
|
@ -64,7 +49,8 @@ class Variant(model.entity.Entity): |
|
|
|
:param opt. args additional args |
|
|
|
:return: list of entity-names |
|
|
|
""" |
|
|
|
config = self.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS, tools.config_tool.get_plain_filename(job, "")) |
|
|
|
config = self.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS, |
|
|
|
tools.config_tool.get_plain_filename(job, ""), B.SUBJECT_VARIANT) |
|
|
|
outList = list(config[B.SUBJECT_VARIANTS].keys()) |
|
|
|
return outList |
|
|
|
|
|
|
@ -75,40 +61,28 @@ class Variant(model.entity.Entity): |
|
|
|
:param name: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
config = self.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS, tools.config_tool.get_plain_filename(job, name)) |
|
|
|
return self.setAttributes(job, config, name, LIST_FIELDS, LIST_NODES, LIST_SUBTABLES) |
|
|
|
|
|
|
|
def getFieldList(self): |
|
|
|
""" |
|
|
|
returns a list of scalar attributes |
|
|
|
:return: LIST_FIELDS |
|
|
|
""" |
|
|
|
return LIST_FIELDS |
|
|
|
|
|
|
|
def getNodeList(self): |
|
|
|
""" |
|
|
|
returns a list of sub-nodes - which can be persisted in a clob-field |
|
|
|
:return: LIST_NODES |
|
|
|
""" |
|
|
|
return LIST_NODES |
|
|
|
config = self.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS, |
|
|
|
tools.config_tool.get_plain_filename(job, name), B.SUBJECT_VARIANT) |
|
|
|
return self.setAttributes(job, config, name, self.LIST_FIELDS, self.LIST_NODES, self.LIST_SUBTABLES) |
|
|
|
|
|
|
|
def getSubtableList(self): |
|
|
|
""" |
|
|
|
returns a list of sub-tables |
|
|
|
:return: LIST_SUBTABLES |
|
|
|
""" |
|
|
|
return LIST_SUBTABLES |
|
|
|
|
|
|
|
def getName(self): |
|
|
|
@staticmethod |
|
|
|
def rebuild_data(job, data: dict) -> dict: |
|
|
|
""" |
|
|
|
returns the name - maybe build from other attributes |
|
|
|
gets the subtable-tag from filecsv and sets the subtables in order to workable entity-elements |
|
|
|
:param job: |
|
|
|
:param data: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
return self.name |
|
|
|
data = tools.file_type.popSubjectsNode(job, data) |
|
|
|
data = tools.file_type.popNameNode(job, data) |
|
|
|
return data |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def check_data(job, data: dict) -> dict: |
|
|
|
checkNodes = {} |
|
|
|
checkNodes[tools.file_type.MUST_NODES] = [] |
|
|
|
checkNodes[tools.file_type.MUSTNT_NODES] = [B.DATA_NODE_OPTION, B.DATA_NODE_DATA, B.DATA_NODE_FIELDS, B.DATA_NODE_HEADER] |
|
|
|
checkNodes[tools.file_type.OPT_NODES] = [B.SUBJECT_PROJECTS, B.NODE_ATTRIBUTES] |
|
|
|
return tools.file_type.check_nodes(job, data, checkNodes) |
|
|
|
|
|
|
|
def getIDName(self): |
|
|
|
""" |
|
|
|
it returns the name as unique-id - maybe build from few attributes |
|
|
|
:return: |
|
|
|
""" |
|
|
|
return self.name |
|
|
|