|
|
@ -12,6 +12,7 @@ import tools.path_const as P |
|
|
|
import tools.config_tool as config_tool |
|
|
|
import tools.file_tool as file_tool |
|
|
|
import tools.git_tool |
|
|
|
import tools.file_type |
|
|
|
|
|
|
|
TABLE_NAMES = ["component", "co_step", "co_table", "co_artifact", "co_comps"] |
|
|
|
DEFAULT_SYNC = model.entity.SYNC_FULL_GIT2DB |
|
|
@ -19,15 +20,6 @@ DEFAULT_SYNC = model.entity.SYNC_FULL_GIT2DB |
|
|
|
TABLE_NAME = "component" |
|
|
|
""" system-name for this entity """ |
|
|
|
FIELD_ID = "coid" |
|
|
|
FIELD_NAME = D.FIELD_NAME |
|
|
|
FIELD_DESCRIPTION = B.SUBJECT_DESCRIPTION |
|
|
|
FIELD_REFERENCE = B.SUBJECT_REFERENCE |
|
|
|
FIELD_ATTRIBUTES = B.NODE_ATTRIBUTES |
|
|
|
LIST_FIELDS = [FIELD_ID, FIELD_NAME, FIELD_DESCRIPTION, FIELD_REFERENCE] |
|
|
|
""" list of object-attributes """ |
|
|
|
LIST_NODES = [B.NODE_ATTRIBUTES, B.DATA_NODE_TOPICS] |
|
|
|
LIST_SUBTABLES = [B.SUBJECT_ARTIFACTS, B.SUBJECT_COMPS, B.SUBJECT_STEPS, B.SUBJECT_DATATABLES] |
|
|
|
PREFIX_SUBTABLE = "" |
|
|
|
|
|
|
|
CP_SUBJECT_COMPS = "components" |
|
|
|
CP_SUBJECT_STEPS = "steps" |
|
|
@ -67,6 +59,12 @@ def select_components(job, project, application): |
|
|
|
return outList |
|
|
|
|
|
|
|
class Component(model.entity.Entity): |
|
|
|
FIELD_ID = "coid" |
|
|
|
LIST_FIELDS = [FIELD_ID, D.FIELD_NAME, B.SUBJECT_DESCRIPTION, B.SUBJECT_REFERENCE] |
|
|
|
""" list of object-attributes """ |
|
|
|
LIST_NODES = [B.NODE_ATTRIBUTES, B.DATA_NODE_TOPICS] |
|
|
|
LIST_SUBTABLES = [B.SUBJECT_ARTIFACTS, B.SUBJECT_COMPS, B.SUBJECT_STEPS, B.SUBJECT_DATATABLES] |
|
|
|
PREFIX_SUBTABLE = "co" |
|
|
|
coid = 0 |
|
|
|
name = "" |
|
|
|
description = "" |
|
|
@ -75,9 +73,6 @@ class Component(model.entity.Entity): |
|
|
|
application = "" |
|
|
|
attributes = "" |
|
|
|
|
|
|
|
def __init__(self, job="", name=""): |
|
|
|
pass |
|
|
|
|
|
|
|
def read_unique_names(self, job, project, application, gran, args): |
|
|
|
""" |
|
|
|
reads the entity-names from file-storage |
|
|
@ -103,54 +98,37 @@ class Component(model.entity.Entity): |
|
|
|
:param name: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
configPath = tools.config_tool.select_config_path(job, P.KEY_COMP, name, "") |
|
|
|
#repoPath = os.path.join(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_COMPS], name) |
|
|
|
#gitresult = tools.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repoPath, 1) |
|
|
|
config = file_tool.read_file_dict(job, configPath, job.m) |
|
|
|
print("ok") |
|
|
|
for k in LIST_FIELDS: |
|
|
|
if k not in config[TABLE_NAME]: |
|
|
|
continue |
|
|
|
setattr(self, k, config[TABLE_NAME][k]) |
|
|
|
for k in LIST_CP_SUBJECTS: |
|
|
|
if k not in config[TABLE_NAME]: |
|
|
|
continue |
|
|
|
setattr(self, k, config[TABLE_NAME][k]) |
|
|
|
return self |
|
|
|
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 |
|
|
|
|
|
|
|
def getSubtableList(self): |
|
|
|
""" |
|
|
|
returns a list of sub-tables |
|
|
|
:return: LIST_SUBTABLES |
|
|
|
""" |
|
|
|
return LIST_SUBTABLES |
|
|
|
config = self.getConfig(job, P.KEY_COMP, tools.config_tool.get_plain_filename(job, name), "", ttype=B.SUBJECT_COMP) |
|
|
|
return self.setAttributes(job, config, name, self.LIST_FIELDS, self.LIST_NODES, self.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 |
|
|
|
|
|
|
|
def getIDName(self): |
|
|
|
def check_data(self, job, data: dict) -> dict: |
|
|
|
""" |
|
|
|
it returns the name as unique-id - maybe build from few attributes |
|
|
|
it checks the data for the specific form |
|
|
|
:param job: |
|
|
|
:param tdata: |
|
|
|
:param ttype: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
return self.name |
|
|
|
checkNodes = {} |
|
|
|
checkNodes[tools.file_type.MUST_NODES] = [B.SUBJECT_COMPS] |
|
|
|
checkNodes[tools.file_type.MUSTNT_NODES] = [B.DATA_NODE_DATA, B.DATA_NODE_HEADER, B.DATA_NODE_FIELDS, B.DATA_NODE_KEYS] |
|
|
|
checkNodes[tools.file_type.OPT_NODES] = [B.SUBJECT_APPS, B.SUBJECT_VARIANTS, B.SUBJECT_USECASES] |
|
|
|
for conf in data: |
|
|
|
tools.file_type.check_nodes(job, data[conf], checkNodes) |
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
def write_entity(self, job, name): |
|
|
|
return |
|
|
|