//把文件当附件上传
AttachementClientManager attchmentClientManager=AttachmentManagerFactory.getClientManager();
AttachmentUIContextInfo info=new AttachmentUIContextInfo();
if(editData.getId()!=null){
info.setBOId(editData.getId().toString());
}else{
BOSUuid id=BOSUuid.create(editData.getBOSType());
info.setBOId(id.toString());
editData.setId(id);
}
info.setCode("");
info.setEdit(true);
attachmentClientManager.aploadFile(new File[]{file},new AttchmentByBoListUI(),info);
if(attachmentClientmanager.attachmentID!=null&&attachmentClientmanager.attachmentID.length>0){
System.out.println("上传成功");
}else{
System.out.println("上传失败");
}
attachmentClientManager.attachmentID[0];//附件id
//下载附件: 根据附件的id下载附件
SelectorItemCollection sic=new SelectorItemCollectio();
sic.add(new SelectorItemInfo("name"));
sic.add(new SelectorItemInfo("simplename"));
sic.add(new SelectorItemInfo("sizeInByte"));
try{
AttachmentInfo ainfo=(AttachmentInfo)AttachmentFactory.getRemote().getValue(new ObjectUuidPK(boid),sic);
type=ainfo.getSimpleName;
}cahtch(Exception e){
e.printStateTrace();
System.out.println("下载失败");
}
File file=new File("d://test");
FileOutPutStream fos=new FileOutPutStream();
sic.clear();
sic.add(new SelectorItemInfo("file"));
AttachmentInfo aif=(AttachmentInfo)AttachmentFactory.getRemote().getValue(new ObjectUuidPK(boid),sic);
fos.write(sic.getFile());