Map<String,Object> providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class);
String destQueueName = (String) providedObject.get("destinationQueue");
Boolean move = (Boolean) providedObject.get("move");
final VirtualHost vhost = sourceQueue.getParent(VirtualHost.class);
boolean isMoveTransaction = move != null && Boolean.valueOf(move);
// FIXME: added temporary authorization check until we introduce management layer
// and review current ACL rules to have common rules for all management interfaces
String methodName = isMoveTransaction? "moveMessages":"copyMessages";
if (isQueueUpdateMethodAuthorized(methodName, vhost))
{
final Queue destinationQueue = getQueueFromVirtualHost(destQueueName, vhost);
final List messageIds = new ArrayList((List) providedObject.get("messages"));
QueueEntryTransaction txn =
isMoveTransaction
? new MoveTransaction(sourceQueue, messageIds, destinationQueue)
: new CopyTransaction(sourceQueue, messageIds, destinationQueue);
vhost.executeTransaction(txn);
response.setStatus(HttpServletResponse.SC_OK);
}
else
{
response.setStatus(HttpServletResponse.SC_FORBIDDEN);