capella2polarion.connectors package¶
Package for all conversion related activities.
Submodules¶
capella2polarion.connectors.polarion_repo module¶
Module providing a universal PolarionDataRepository class.
- capella2polarion.connectors.polarion_repo.DocumentRepository¶
A dict providing a mapping for documents and their text workitems.
It has (project, space, name) of the document as key and (document, workitems) as value. The project can be None and the None value means that the document is in the same project as the model sync work items.
alias of
dict
[tuple
[str
|None
,str
,str
],tuple
[Document
|None
,list
[WorkItem
]]]
- class capella2polarion.connectors.polarion_repo.PolarionDataRepository(polarion_work_items: list[CapellaWorkItem] | None = None)¶
Bases:
object
A mapping to access all contents by Capella and Polarion IDs.
This class only holds data already present in Polarion. It only receives updates if data were written to Polarion. There shall be no intermediate data stored here during serialization.
- get_work_item_by_capella_uuid(capella_uuid: str) CapellaWorkItem | None ¶
Return a Work Item for a provided Capella UUID.
- get_work_item_by_polarion_id(work_item_id: str) CapellaWorkItem | None ¶
Return a Work Item for a provided Work Item ID.
- items() Iterator[tuple[str, str, CapellaWorkItem]] ¶
Yield all Capella UUIDs, Work Item IDs and Work Items.
- remove_work_items_by_capella_uuid(uuids: Iterable[str])¶
Remove entries for the given Capella UUIDs.
- update_work_items(work_items: list[CapellaWorkItem])¶
Update all mappings for the given Work Items.
- capella2polarion.connectors.polarion_repo.check_work_items(work_items: Iterable[CapellaWorkItem])¶
Raise a
ValueError
if any work item has no ID.
capella2polarion.connectors.polarion_worker module¶
Module for polarion API client work.
- class capella2polarion.connectors.polarion_worker.CapellaPolarionWorker(params: PolarionWorkerParams, force_update: bool = False)¶
Bases:
object
CapellaPolarionWorker encapsulate the Polarion API Client work.
- compare_and_update_work_item(converter_data: ConverterData)¶
Patch a given WorkItem.
- compare_and_update_work_items(converter_session: dict[str, ConverterData]) None ¶
Update work items in a Polarion project.
- create_documents(document_datas: list[DocumentData], document_project: str | None = None)¶
Create new documents.
Notes
If the
document_project
isNone
the default client is taken.
- create_missing_work_items(converter_session: dict[str, ConverterData]) None ¶
Post work items in a Polarion project.
- delete_orphaned_work_items(converter_session: dict[str, ConverterData]) None ¶
Delete work items in a Polarion project.
If the delete flag is set to
False
in the context work items are marked asto be deleted
via the status attribute.
- get_document(space: str, name: str, document_project: str | None = None) Document | None ¶
Get a document from polarion and return None if not found.
Notes
If the
document_project
isNone
the default client is taken.
- static get_missing_link_ids(left: Iterable[WorkItemLink], right: Iterable[WorkItemLink]) dict[str, WorkItemLink] ¶
Return an ID-Link dict of links present in left and not in right.
- load_polarion_documents(document_infos: Iterable[DocumentInfo]) dict[tuple[str | None, str, str], tuple[Document | None, list[WorkItem]]] ¶
Load the documents referenced and text work items from Polarion.
- load_polarion_work_item_map()¶
Return a map from Capella UUIDs to Polarion work items.
- update_attachments(new: CapellaWorkItem, old_checksums: dict[str, str], new_checksums: dict[str, str], old_attachments: list[WorkItemAttachment]) bool ¶
Delete, create and update attachments in one go.
Returns True if new attachments were created. After execution all attachments of the new work item should have IDs.
- update_documents(document_datas: list[DocumentData], document_project: str | None = None)¶
Update existing documents.
Notes
If the
document_project
isNone
the default client is taken.
- class capella2polarion.connectors.polarion_worker.PolarionWorkerParams(project_id: str, url: str, pat: str, delete_work_items: bool)¶
Bases:
object
Container for Polarion Params.
- capella2polarion.connectors.polarion_worker.WORK_ITEMS_IN_PROJECT_QUERY = "SQL:(SELECT item.* FROM POLARION.WORKITEM item, POLARION.MODULE doc, POLARION.PROJECT proj WHERE proj.C_ID = '{project}' AND doc.FK_PROJECT = proj.C_PK AND doc.C_ID = '{doc_name}' AND doc.C_MODULEFOLDER = '{doc_folder}' AND item.C_TYPE = '{wi_type}' AND EXISTS (SELECT rel1.* FROM POLARION.REL_MODULE_WORKITEM rel1 WHERE rel1.FK_URI_MODULE = doc.C_URI AND rel1.FK_URI_WORKITEM = item.C_URI))"¶
An SQL query to get work items which are inserted in a given document.