return true;
}
private void execPublishItem(AgpItem sourceItem,AgpItem destItem) throws Exception {
AgpDestination dest = this.destination;
String sDestId = destItem!=null? destItem.getProperties().getValue("id"): null;
String sTitle = sourceItem.getProperties().getValue("title");
LOGGER.finer("Publishing item: "+sTitle);
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest(sourceItem.getProperties().toString());
}
// make the URL
boolean bInsert = true;
String sUrl = dest.getConnection().makeSharingUrl();
sUrl += "/content/users";
sUrl += "/"+AgpUtil.encodeURIComponent(dest.getDestinationOwner());
sUrl += "/"+AgpUtil.encodeURIComponent(dest.getDestinationFolderID());
if (sDestId == null) {
sUrl += "/addItem";
} else {
bInsert = false;
sUrl += "/items";
sUrl += "/"+AgpUtil.encodeURIComponent(sDestId);
sUrl += "/update";
}
// make the content provider, add thumb-nail and data parts
MultipartProvider provider = new MultipartProvider();
provider.add("f","json");
provider.add("token",destination.getConnection().getToken().getTokenString());
provider.add("overwrite","true");
for (AgpProperty destProp: sourceItem.getProperties().values()) {
provider.add(destProp.getName(),destProp.getValue());
}
//this.partHelper.addThumbnailPart(provider,src,sourceItem,dest,destItem);
//this.partHelper.addDataPart(provider,src,sourceItem,dest,destItem);
// execute
AgpProperties hdr = dest.getConnection().makeRequestHeaderProperties();
AgpClient client = dest.getConnection().ensureClient();
JSONObject jso = client.executeJsonRequest(sUrl,hdr,provider);
if (jso.has("id") && jso.has("success") && jso.getString("success").equals("true")) {
if (sDestId == null) {
sDestId = jso.getString("id");