Hi all!
I'm trying to get attaches were attached during transition as a files.
I can get them using
def attaches = issue.modifiedFields.get(IssueFieldConstants.ATTACHMENT)?.newValue
and i get list of temporary filenames. And i can get them like files using
attaches .each{attach ->
log.warn 'New Attach'
log.warn attach
newAttList.add(new LazyMap ('fileName': attach, 'file':new File(temporaryAttachmentDirectory, attach)))
}
But there are not properly filenames - only temporary like temp2135062013794563645. So i can't do anything correct with this files.
Otherwise, i can get list of TemporaryWebAttachment objects using
def temporaryAttachmentUtil = ComponentAccessor.getComponent(TemporaryWebAttachmentManager)
def formToken = ActionContext.getRequest()?.getParameter(IssueFieldConstants.FORM_TOKEN)
def newAttaches = temporaryAttachmentUtil.getTemporaryWebAttachmentsByFormToken(formToken)
But i couldn't find out how can i get File object from TemporaryWebAttachment. It has filename property, but it's only name of file wich was attached, but i can't find it nowere in filesystem. Also i can't attachment from issue via attachment name - only by attachment id. But i can't get attachment id information from TemporaryWebAttachment.
Anybody knows how to get file object from transition attachment? I'll be greatly thankfull.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.