Revision 9e8e14e4 web_client/src/gr/grnet/pithos/web/client/commands/PasteCommand.java

b/web_client/src/gr/grnet/pithos/web/client/commands/PasteCommand.java
34 34
	public void execute() {
35 35
		containerPanel.hide();
36 36
		Object selection = GSS.get().getCurrentSelection();
37
		if(selection != null && selection instanceof GroupResource){
38
			final ClipboardItem citem = GSS.get().getClipboard().getItem();
39
			GroupResource group = (GroupResource) GSS.get().getCurrentSelection();
40
			if(citem.getUser() != null){
41
				PostCommand cg = new PostCommand(group.getUri()+"?name="+citem.getUser().getUsername(), "", 201){
42

  
43
					@Override
44
					public void onComplete() {
45
						GSS.get().getGroups().updateGroups();
46
						GSS.get().showUserList();
47
						GSS.get().getClipboard().setItem(null);
48
					}
49

  
50
					@Override
51
					public void onError(Throwable t) {
52
						GWT.log("", t);
53
						if(t instanceof RestException){
54
							int statusCode = ((RestException)t).getHttpStatusCode();
55
							if(statusCode == 405)
56
								GSS.get().displayError("You don't have the necessary permissions");
57
							else if(statusCode == 404)
58
								GSS.get().displayError("User does not exist");
59
							else if(statusCode == 409)
60
								GSS.get().displayError("A user with the same name already exists");
61
							else if(statusCode == 413)
62
								GSS.get().displayError("Your quota has been exceeded");
63
							else
64
								GSS.get().displayError("Unable to add user:"+((RestException)t).getHttpStatusText());
65
						}
66
						else
67
							GSS.get().displayError("System error adding user:"+t.getMessage());
68
					}
69
				};
70
				DeferredCommand.addCommand(cg);
71
				return;
72
			}
73
		}
74 37
		FolderResource selectedFolder = null;
75 38
		if(selection != null && selection instanceof RestResourceWrapper)
76 39
			selectedFolder = ((RestResourceWrapper)selection).getResource();

Also available in: Unified diff