utils.rc.dtos.solution

Module Contents

Classes

Solution

Represents a solution in the system.

class utils.rc.dtos.solution.Solution(data={})

Represents a solution in the system.

id

The ID of the solution.

Type:

int

name

The name of the solution.

Type:

str

display_name

The display name of the solution.

Type:

str

description

The description of the solution.

Type:

str

version

The version of the solution.

Type:

str

source

The source of the solution, either “SYSTEM” or “CUSTOM”.

Type:

str

projectId

The ID of the project associated with the solution.

Type:

str

sourceProjectId

The ID of the project used to create the solution.

Type:

str

__variables

A dictionary of variables used in the solution.

Type:

dict

create(

name: str, description: str, sourceProjectId: str, display_name: str = None, icon: str = None, version: str = ‘1.0’, tags: list = [], isGlobal: bool = False

) -> Solution

Creates a solution with the given parameters. If a solution with the same name already exists, it returns it.

update() Solution

Updates the solution in the system.

get_solution_by(name
str, version: str = ‘1.0’,

is_global: bool = True) -> Solution:

Returns the solution with the given name and version. If is_global is True, it returns a system solution, otherwise it returns a custom solution.

clean_view(solutions_dict

dict, log_output: bool = True) -> dict: Returns a clean view of the given solutions_dict.

get_all(is_global

bool = None) -> dict: Returns a dictionary of all the solutions in the system.

If is_global is None, it returns all the solutions,

otherwise it returns the system solutions if is_global is True,

and the custom solutions if is_global is False.

is_local_solution(sdict

dict) -> bool: Returns True if the solution is a custom solution, False otherwise.

is_system_solution(sdict

dict) -> bool: Returns True if the solution is a system solution, False otherwise.

deleteSolution(solutionId

int) -> None: Deletes the solution with the given ID.

project_id -> str

Returns the project ID associated with the solution.

is_global -> bool

Returns True if the solution is a system solution, False otherwise.

property project_id
property is_global
__all_sols
static create(name: str, description: str, sourceProjectId: str, display_name: str = None, icon: str = None, version='1.0', tags=[], isGlobal=False)

Creates a new solution.

If a solution with the same name already exists, it will be returned.

Parameters:
  • name (str) – Name of the solution.

  • description (str) – Description of the solution.

  • sourceProjectId (str) – ID of the existing project to create a solution from.

  • display_name (Optional[str]) – Display name of the solution.

  • icon (Optional[str]) – Icon url for the solution.

  • version (str) – Version of the solution. Defaults to ‘1.0’.

  • tags (List[str]) – List of tags for the solution. Defaults to empty list.

  • isGlobal (bool) – Flag indicating whether the solution is a global solution. Defaults to False.

Returns:

Returns the created solution.

Return type:

Solution

Raises:

None.

update()

Updates the solution in the database.

Raises:

AssertionError – If the solution id is None.

Returns:

The updated solution object.

Return type:

Solution

classmethod get_solution_by(name: str, version: str = '1.0', is_global: bool = True)

Retrieves a solution by its name and version.

Parameters:
  • name (str) – The name of the solution to retrieve.

  • version (str, optional) – The version of the solution to retrieve. Defaults to ‘1.0’.

  • is_global (bool, optional) – Whether the solution is a system solution. Defaults to True.

Returns:

The solution object that was retrieved.

Return type:

Solution

classmethod clean_view(solutions_dict, log_output: bool = True)

Cleans up and returns a view of the given solutions dictionary.

Parameters:
  • solutions_dict (dict) – A dictionary of Solution objects.

  • log_output (bool, optional) – Whether to log the cleaned view output. Defaults to True.

Returns:

A dictionary of cleaned Solution view dictionaries.

Return type:

dict

classmethod get_all(is_global=None)

Returns a dictionary of all solutions, either system or local.

Parameters:

is_global – Optional boolean indicating whether to include system solutions (True), local solutions (False), or both (None).

Returns:

A dictionary of Solution objects keyed by solution id.

classmethod is_local_solution(sdict)
classmethod is_system_solution(sdict)
static getAllSolutions()

Deprecated. Please use get_all instead.

Returns:

a dictionary of Solution objects keyed by solution name.

static deleteSolution(solutionId)
classmethod __create_idx(all_solutions)
classmethod __get_key(s_dict)
__get_view_dict()