jesper-raemaekers / python-polarion

A Python package to access the Polarion WSDL API.
MIT License
56 stars 35 forks source link

Accessing additional workitem properties #26

Closed krishtej23 closed 2 years ago

krishtej23 commented 3 years ago

Hi, I am trying to access getExternalLinkingModules() from https://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/tracker/model/IWorkItem.html#getExternalLinkingModules() as

docList = projectObj.getWorkitem("XYZ-1234").getExternalLinkingModules()

but I get an error saying getExternalLinkingModules() is not there. How can I access this function? Thanks in advance.

jesper-raemaekers commented 3 years ago

I created an example in a branch. It´s not ready yet to integrate as the remove method is not working yet. Hopefully this example helps.

krishtej23 commented 3 years ago

I see you are adding addExternalItem() but I was looking for getExternalLinkingModules(). Is getExternalLinkingModules() accessed through addExternalItem()?

jesper-raemaekers commented 3 years ago

Ah I misread. In this case the answer is a no. This function is not available via the wsdl api.

krishtej23 commented 3 years ago

So there is no way of accessing that function?

jesper-raemaekers commented 3 years ago

No. you can view the list of available functions of the API on http:///polarion/ws/services . I find that there is nothing to find references, or a comparable function to getExternalLinkingModules. Maybe it's doable by creating a query to look for this, but i haven't tried.

krishtej23 commented 3 years ago

Ok. I couldn't directly replicate this function but atleast I could get an SQL query to get ONLY the referenced items in a document and then get the location of them. This way I exported them to an excel and could search in there.

jesper-raemaekers commented 3 years ago

Could you share the query so i can test with it?

krishtej23 commented 3 years ago

Query:

sampleQuery = "SQL:(SELECT item.* FROM POLARION.WORKITEM item, POLARION.MODULE doc, POLARION.PROJECT proj WHERE proj.C_ID = **project_ID** AND doc.FK_PROJECT = proj.C_PK AND doc.C_ID = **document_id** 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)) AND NOT document.id:\"**Space_name**/**document_id**\" AND type:**workitem_type**"

calling this via Tracker services

list_Of_WI = services.queryWorkItems(ref_wi_query, "outlineNumber", "customFields.source")

This gives ONLY the list of work items in a particular document that are referenced. I then looped through all the documents in a space and exported the list of work items to excel. There I searched for a work item and it gives me a list of documents that work item is referenced in.