int maxrows = 100;
req.setMaxRows(maxrows);
req.setListHead(offset);
BusinessList findTModel = null;
SaveBusiness sb = new SaveBusiness();
do {
findTModel = inquiry.findBusiness(req);
if (findTModel.getBusinessInfos() != null) {
for (int i = 0; i < findTModel.getBusinessInfos().getBusinessInfo().size(); i++) {
boolean go = true;
String owner = Common.GetOwner(findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey(), token, inquiry);
if (owner!=null && !usernames.contains(owner)) {
usernames.add(owner);
}
if (myitemsonly) {
if (owner == null || !owner.equalsIgnoreCase(username)) {
go = false;
System.out.println("skipping " + findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey() + " owned by " + owner);
}
}
if (go) {
if (owner!=null)
mapping.setProperty(findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey(), owner);
System.out.println("Exporting " + findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey() + " owner " + owner);
sb.getBusinessEntity().add(GetBusiness(findTModel.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey(), token));
}
}
}
//do stuff
offset = offset + maxrows;
req.setListHead(offset);
} while (false);//findTModel.getListDescription().getIncludeCount() > 0 );
if (stripSig) {
int x=0;
for (int i = 0; i < sb.getBusinessEntity().size(); i++) {
x+=sb.getBusinessEntity().get(i).getSignature().size();
sb.getBusinessEntity().get(i).getSignature().clear();
if (sb.getBusinessEntity().get(i).getBusinessServices() != null) {
for (int i2 = 0; i2 < sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().size(); i2++) {
x+=sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().get(i2).getSignature().size();
sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().get(i2).getSignature().clear();
if (sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().get(i2).getBindingTemplates() != null) {
for (int i3 = 0; i3 < sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().get(i2).getBindingTemplates().getBindingTemplate().size(); i3++) {
x+=sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().get(i2).getBindingTemplates().getBindingTemplate().get(i3).getSignature().size();
sb.getBusinessEntity().get(i).getBusinessServices().getBusinessService().get(i2).getBindingTemplates().getBindingTemplate().get(i3).getSignature().clear();
}
}
}
}
}
System.out.println(x + " signatures stripped");
}
System.out.println("Saving to disk");
JAXB.marshal(sb, fos);
fos.close();
System.out.println("Done with businesses. Export count: " + sb.getBusinessEntity().size());
}