Skip to content

Commit

Permalink
merge: Merge pull request #106 from DSD-DBS/add-document-project-support
Browse files Browse the repository at this point in the history
Add support for documents in separate projects, status filters and text work items
  • Loading branch information
micha91 authored Sep 4, 2024
2 parents 41a00c1 + 6abc00a commit b5a368f
Show file tree
Hide file tree
Showing 21 changed files with 1,201 additions and 361 deletions.
11 changes: 4 additions & 7 deletions capella2polarion/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,10 @@ def render_documents(
overwrite_layouts,
)

new_documents, updated_documents, work_items = renderer.render_documents(
configs, documents
)

polarion_worker.post_documents(new_documents)
polarion_worker.update_documents(updated_documents)
polarion_worker.update_work_items(work_items)
projects_document_data = renderer.render_documents(configs, documents)
for project, project_data in projects_document_data.items():
polarion_worker.create_documents(project_data.new_docs, project)
polarion_worker.update_documents(project_data.updated_docs, project)


if __name__ == "__main__":
Expand Down
13 changes: 13 additions & 0 deletions capella2polarion/connectors/polarion_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import collections.abc as cabc

import bidict
import polarion_rest_api_client as polarion_api

from capella2polarion import data_models

Expand Down Expand Up @@ -114,3 +115,15 @@ def remove_work_items_by_capella_uuid(self, uuids: cabc.Iterable[str]):
for uuid in uuids:
del self._work_items[uuid]
del self._id_mapping[uuid]


DocumentRepository = dict[
tuple[str | None, str, str],
tuple[polarion_api.Document | None, list[polarion_api.WorkItem]],
]
"""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.
"""
Loading

0 comments on commit b5a368f

Please sign in to comment.