hopefully, someone can help me with a specific problem we encountered just recently, when switching to Polarion ALM 17.3.3.
First off, we have a WorkFlow Function defined in our Project, that is supposed to copy an Attachment from a relative path in the repository to the Attachment of the Workitem, when creating and thus initially saving said workitem.
The code is as follows:
Code: Select all
//Retrieve current Workitem + ID
var wi = workflowContext.getWorkItem();
var wiId = wi.getId();
//Retrieve Attachment relative Path as URL
var baseUrl = PlatformContext.getPlatform().lookupService(IConfigService.class).getPropertyValue("base.url");
var attachmentRelativePath = arguments.getAsString("attachment.relativePath");
//Getting Repository Service
var repoService = PlatformContext.getPlatform().lookupService(IRepositoryService.class);
//forming Uri from URL+String - the SVN repository Uri is needed
var uri = new URI(baseUrl + attachmentRelativePath);
//Getting location to the Uri
var loc = repoService.getLocationForAccessibleURL(uri)
//Getting the connection to get access to the file
var connection = repoService.getConnection(loc);
//Getting file Input Stream to be able to Store as attachment
var stream = connection.getContent(loc);
//Add as attachment to Uri
wi.createAttachment(wiId + ".xlsm", wiId + ".xlsm", stream).save();
Basically: Get Workitem, get URL for Attachment, retrieve location and content of Attachment as InputStream, save after calling Workitem.createAttachment Method.
This worked on Polarion ALM 16.3 and 17.2 versions.
However, since the switch, we receive the following error:
java.lang.UnsupportedOperationException: Modifications are prohibited in read only transaction.
The StackTrace for this error in the Serverlog reports that while saving the Workitem, it seems that an implicit ReadOnly Transaction is called for the save-handling of the workitem:
Most curiosly, the workitem is still saved however, and the attachment is created for the workitem as well, when refreshing the workitem query page, as can be seen here:
So, as a summary: The function works, generally, but throws an error while saving the workitem.
I would now like to know - is this a configuration problem? Is there a setting for changing implicit transactions from Readonly to WriteTransactions, or is there a problem with the function code that needs to be updated?
If anyone has an idea on this topic, I'd be really happy to know.
Thanks in advance!