def __init__(self, name='', class_idx=0): super().__init__(name=name) self.id = str(uuid.uuid1()) self._class = ActivityClasses[class_idx] self.created_at = get_datetime() self.label = 'Activity' self.openapi_types.update({'label': str})
def __init__(self, name='', user_id='', **kwargs): super().__init__(name=name, user_id=user_id) self.id = str(uuid.uuid1()) self.created_at = get_datetime() for kw in kwargs: self.__setattr__(kw, kwargs[kw]) self.label = 'Agent' self.openapi_types.update({'label': str})
def __init__(self, name='', target_id='', target_version_id='1', **kwargs): super().__init__(name=name, target_id=target_id, target_version_id=target_version_id) self.id = str(uuid.uuid1()) self.created_at = get_datetime() self.label = 'Reference' for kwa in kwargs: self.__setattr__(kwa, kwargs[kwa]) self.openapi_types.update({'label': str})
def __init__(self, start_node, end_node, activity_class=None): super().__init__(start_node=start_node.id, end_node=end_node.id) self.id = str(uuid.uuid1()) self.created_at = get_datetime() self.start_id = start_node self.end_id = end_node start_end_nodes = (start_node.label, end_node.label) self.type = NodeRelationships[start_end_nodes] if start_end_nodes == ('Activity', 'Agent'): self.end_node_role = ActivityRoles[start_node._class][ 'in_subclass'][self.type][end_node.label]['role'] elif start_end_nodes == ('Activity', 'Reference'): self.end_node_role = ActivityRoles[start_node._class][ 'in_subclass'][self.type][end_node.subclass]['role'] elif start_end_nodes == ('Reference', 'Activity'): self.start_node_role = ActivityRoles[end_node._class][ 'out_subclass'][self.type][start_node.subclass]['role'] elif start_end_nodes == ('Reference', 'Agent'): self.end_node_role = ActivityRoles[activity_class]['out_subclass'][ self.type][end_node.label]['role'] self.start_node_role = ActivityRoles[activity_class][ 'out_subclass'][self.type][start_node.subclass]['role']
def create(self): self.id = str(uuid.uuid1()) self.created_at = get_datetime()