* @throws Exception if an exception occurs
*/
private AgpItem queryDestinationItem(AgpDestination destination,
AgpItem sourceItem) throws Exception {
final AgpItem destinationItem = new AgpItem();
destinationItem.setProperties(null);
String sSyncKey = this.makeSyncKey(sourceItem);
String sQuery = "typekeywords:"+sSyncKey;
AgpSearchRequest request = new AgpSearchRequest();
AgpSearchCriteria criteria = new AgpSearchCriteria();
criteria.setQ(sQuery);
criteria.setNum(1);
request.search(destination.getConnection(),criteria,
new AgpItemListener() {
@Override
public void onItemLoaded(AgpConnection connection, AgpItem item)
throws Exception {
destinationItem.setProperties(item.getProperties());
//System.err.println("idgggggggggggg="+item.getProperties().get("id").getValue());
}
}
);
if (destinationItem.getProperties() != null) {
//System.err.println("idzzzzzzzzzzz="+destinationItem.getProperties().get("id").getValue());
return destinationItem;
}
return null;
}