}
@Override
public boolean checkConnection(IMessageCollector mb) {
try {
AgpSource source = protocol.getSource();
boolean stop = false;
if (source.getConnection().getHost().isEmpty()) {
mb.addErrorMessage("catalog.harvest.manage.test.err.agp2agp.src.nohost");
stop = true;
}
if (source.getConnection().getTokenCriteria().getCredentials().getUsername().isEmpty() || source.getConnection().getTokenCriteria().getCredentials().getPassword().isEmpty()) {
mb.addErrorMessage("catalog.harvest.manage.test.err.agp2agp.src.nocredentials");
stop = true;
}
if (source.getSearchCriteria().getQ().isEmpty()) {
mb.addErrorMessage("catalog.harvest.manage.test.err.agp2agp.src.noquery");
stop = true;
}
if (!stop) {
source.getConnection().generateToken();
AgpCountRequest sourceRequest = new AgpCountRequest();
long count = sourceRequest.count(source.getConnection(), source.getSearchCriteria());
String srcM = protocol.getAttributeMap().getValue("src-m");
long max = Val.chkLong(srcM, 0);
long apx = Math.min(count, max);
mb.addSuccessMessage("catalog.harvest.manage.test.msg.agp2agp.success", new Object[]{apx});