Problem

You want to change many work items from one type to another.
Polarion does not allow to change the type of multiple work items via bulk edit.

Solution

The easiest way to do a bulk edit type change is via the application of a regular expression on a SVN checkout of your project.
I use Notepad++ on Windows that does a great job.

Example

I lately had to change 400 work items from type „plr“ to type „text“. Those 400 items were a selection out of a few thousands.

The first question is, how to select exactly the items to change at SVN level.

In my case, this was possible using the title attribute, because the changed items should be recognizable by a prefix in the title. So I used that to identify the items to change.

Mark the work items

I added a prefix „RQ “ to every item that had to be changed (Using Excel round-trip)

Another solution would have been to add an extra attribute to the configuration (e.g. a boolean) that is set only on the items that have to be changed.

Find the regular expression

The regexp to apply must do two things for you:
1) match only the items you want to change
2) change the type.

In my case, the match was given by the „RQ „-prefix in the title attribute.

If you do not want to change the title, I suggest you add a boolean „typd“ attribute that you set on all items you want to change. The name „typd“ is because Polarion orders work item attributes alphabetically in the XML files in SVN and „typd“ is just before „type“. That makes the regular expression easier and more reliable.

In my case, I had the prefix in the title

I define a regexp that selects all items that have a title starting with „RQ “ and being of type „prq“ (you might want to select all items that have an attribute „typed“).

My regular expression is this:

(<field id=""title">RQ .*</field>\n.{0,6})<field id="type">)prq

Some explanation on this:

  • ( … ) – is the part to be maintained, this is referenced as „\1“ in the replace field.
  • RQ .*</field> – is the whole title including the closing field-tag.
  • \n.[0,6} – requires a newline and up to six characters before the next tag. This is just for paranoia. In case there is an additional line between title and type, I do not change anything..
  • prq – is my work item type I want to change, note that it is behind the closing parenthesis

I want to replace the type with „text“, so I use this as replace expression:

\1text
  • \1 – means everything that was there before in the parenthesis (= except the type „plr“)
  • text – is the new work item type I want to set.

Apply the regular expression

In notepad++ I apply the regular expression via „In Dateien suchen…“ to all work items in the affected project. Note that the work items may be inside LiveDocs (modules) or in the tracker.

Before committing the change, check that you changed exactly the work items you selected in Polarion. (You see the item count if you start a commit in Tortoise.). Do not commit if the number differs. Go back and check your regexp!

Dependnecies

If Polarion doesn’t offer the bulk edit of work item types out of the box, there must be some reason.

In fact there are some dependencies you must be aware of, if changing work item type:

  • Links
    The new work item type must support the same links as the old one.
    If it doesn’t, you create items with strange invalid links, but technically Polarion will handle this. You can only delete such links.
  • Workflow
    The new work item type must have a compatible workflow configuration. If it doesn’t, you’ll end up with deadlocked work items.
  • LiveDocs
    If the changed work items are located in LiveDocs, you need to pay special attention to them. This may be the most tedious part of the conversion.
    Every LiveDoc that contains an item that has been converted, must be configured to contain the target work item type. This is important, otherwise you’ll get strange behavior in LiveDocs.

Conclusion

Bulk edit of Polarion type is easily possible. You do not need to develop custom Java work item type conversion tools. You can just do it with find&replace and regular expressions.

You must pay attention to the dependencies on links, workflow and documents, otherwise you could damage your Polarion installation.

Polarion: Bulk-edit work item type

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.