Its actually a lot simpler than that. getByteArray is a standard method it just converts a xstring to a Byte Array the below code is something I have been playing around in Work Manager . It adds documents underneath a Order Object. Its pretty rough was doing it as a proof of concept. SAP does their attachements in a similar way.
All I have is a ExternalData field called FileData in a Object (Doclink) added as a collection underneath a Work Order object. FileData in the Doclink class(JAVA) is a String it maps to the FileData field.The mapping is the same as any field.
Example of the filling code
Table filedatatbl = _imports.getTable("ET_FILEDATA");
int numRows = filedatatbl.getNumRows();
for (int x = 0; x < numRows; x++)
{
filedatatbl.setRow(x);
if ( filedatatbl.getString("ZFILENAME") == tbl.getString("AUFNR"))
{
String s = encodeBase64(filedatatbl.getByteArray("ZFILEDATA"));
DocLink.setID(tbl.getString("AUFNR") );
DocLink.setFileType("pdf");
DocLink.setFileName(tbl.getString("AUFNR") + ".pdf");
DocLink.setFileData(s);
docObjects.add(DocLink);
}
}
Encoding - Sap uses a different one but I prefer this library
public String encodeBase64(byte abyte0[])
{
return org.apache.commons.codec.binary.Base64.encodeBase64String(abyte0);
}
O yes use Itunes to check if the files have downloaded. You can see it under Apps scroll to the bottom and select Agentry you should be able to see the files. Sync Itunes to refesh after download.
You will also have to deploy Work Manager to the newest Agentry server version available. It does not work on older versions before 6.032.0 I believe.