can someone help with a standalone code which can download the files on the attachments tab of a change ?
can someone help with a standalone code which can download the files on the attachments tab of a change object in Oracle Agile PLM 9.3.6 and store it to my local pc location ? The code to download all the files of any type uploaded on the change object ?
Iterator attItr = change.getTable(ItemConstants.TABLE_ATTACHMENTS).iterator();
while (attItr.hasNext()) {
IRow row = (IRow) attItr.next();
String fileName = row.getValue(new Integer(“1046”)).toString();
File file = new File(MAIN_PATH+fileName);
System.out.println(“Downloading “+fileName+” from “+change.getName());
InputStream stream = ((IAttachmentFile) row).getFile();
try (FileOutputStream outputStream = new FileOutputStream(file, false)) {
int read;
byte[] bytes = new byte[8192];
while ((read = stream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
}
}