سؤال

I'm using MantisConnect & Java to feed my bugtracker with issues. Does anyone know how to add attachments, like text files etc. ?

Mikey

هل كانت مفيدة؟

المحلول

Figured it out!

First you create an issue object and add it to your session object. Afterwards you can add an attachment too. This looks something like:

IIssue issue = session.newIssue();
session.addIssue(issue); 
File file = new File(PathToYourAttachment);
LocalFileIssueAttachment attachment = new LocalFileIssueAttachment(file);
session.addIssueAttachment(session.getBiggestIssueId(projects[0].getId()), filename, attachment.getContentType(), attachment.getData());
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top