Revision cde22209

b/src/gr/grnet/pithos/web/client/DeleteFileDialog.java
135 135
        if (iter.hasNext()) {
136 136
            File f = iter.next();
137 137
            String path = f.getUri();
138
            DeleteRequest deleteFile = new DeleteRequest(app.getApiPath(), f.getOwner(), URL.encode(path)) {
138
            DeleteRequest deleteFile = new DeleteRequest(app.getApiPath(), f.getOwnerID(), URL.encode(path)) {
139 139
                @Override
140 140
                public void onSuccess(Resource result) {
141 141
                    deleteFile(iter);
b/src/gr/grnet/pithos/web/client/FileContextMenu.java
198 198
        else {
199 199
        	for (File f : selectedFiles) {
200 200
        		permissions = f.getPermissions().get(app.getUserID());
201
        		canWrite &= (f.getOwner().equals(app.getUserID()) || (permissions!= null && permissions[1] != null && permissions[1]));
201
        		canWrite &= (f.getOwnerID().equals(app.getUserID()) || (permissions!= null && permissions[1] != null && permissions[1]));
202 202
        	}
203 203
        }
204 204
        boolean isFolderTreeSelected = selectedTree.equals(app.getFolderTreeView());
......
252 252
			@Override
253 253
			public void execute() {
254 254
				for (File f : selectedFiles)
255
					Window.open(app.getApiPath() + f.getOwner() + f.getUri(), "_blank", "");
255
					Window.open(app.getApiPath() + f.getOwnerID() + f.getUri(), "_blank", "");
256 256
			}
257 257
		}));
258 258

  
b/src/gr/grnet/pithos/web/client/FileList.java
54 54
import com.google.gwt.core.client.GWT;
55 55
import com.google.gwt.event.dom.client.ContextMenuEvent;
56 56
import com.google.gwt.event.dom.client.ContextMenuHandler;
57
import com.google.gwt.http.client.URL;
58 57
import com.google.gwt.i18n.client.DateTimeFormat;
59 58
import com.google.gwt.resources.client.ImageResource;
60
import com.google.gwt.resources.client.ClientBundle.Source;
61 59
import com.google.gwt.resources.client.ImageResource.ImageOptions;
62 60
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
63 61
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
......
290 288
				sb.append(Templates.INSTANCE.filenameSpan(object.getName()));
291 289
				if (object.getContentType() != null && (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg"))) {
292 290
        			sb.appendHtmlConstant(" ")
293
                      .append(Templates.INSTANCE.viewLink(app.getApiPath() + object.getOwner() + object.getUri(), object.getName()));
291
                      .append(Templates.INSTANCE.viewLink(app.getApiPath() + object.getOwnerID() + object.getUri(), object.getName()));
294 292
				}
295 293
				
296 294
				return sb.toSafeHtml();
......
417 415
		if (DOM.eventGetType(event) == Event.ONDBLCLICK)
418 416
			if (getSelectedFiles().size() == 1) {
419 417
				File file = getSelectedFiles().get(0);
420
				Window.open(app.getApiPath() + file.getOwner() + file.getUri(), "_blank", "");
418
				Window.open(app.getApiPath() + file.getOwnerID() + file.getUri(), "_blank", "");
421 419
				event.preventDefault();
422 420
				return;
423 421
			}
......
547 545
                            if (sortingProperty.equals("version")) {
548 546
                                    return arg0.getVersion() - arg1.getVersion();
549 547
                            } else if (sortingProperty.equals("owner")) {
550
                                    return arg0.getOwner().compareTo(arg1.getOwner());
548
                                    return arg0.getOwnerID().compareTo(arg1.getOwnerID());
551 549
                            } else if (sortingProperty.equals("date")) {
552 550
                            		if (arg0.getLastModified() != null && arg1.getLastModified() != null)
553 551
                            			return arg0.getLastModified().compareTo(arg1.getLastModified());
......
567 565
                            return arg1.getVersion() - arg0.getVersion();
568 566
                    } else if (sortingProperty.equals("owner")) {
569 567
                            
570
                            return arg1.getOwner().compareTo(arg0.getOwner());
568
                            return arg1.getOwnerID().compareTo(arg0.getOwnerID());
571 569
                    } else if (sortingProperty.equals("date")) {
572 570
                            
573 571
                            return arg1.getLastModified().compareTo(arg0.getLastModified());
......
649 647
		int i = 0;
650 648
		boolean scrolled = false;
651 649
		for (File f : files) {
652
			if (selectedUrls.contains(app.getApiPath() + f.getOwner() + f.getUri())) {
650
			if (selectedUrls.contains(app.getApiPath() + f.getOwnerID() + f.getUri())) {
653 651
				selectionModel.setSelected(f, true);
654 652
				if (!scrolled) {
655 653
					celltable.getRowElement(i).getCells().getItem(0).scrollIntoView();
b/src/gr/grnet/pithos/web/client/FilePermissionsDialog.java
144 144
    private VerticalPanel createSharingPanel() {
145 145
        VerticalPanel permPanel = new VerticalPanel();
146 146

  
147
        permList = new PermissionsList(images, file.getPermissions(), file.getOwner(), false, new Command() {
147
        permList = new PermissionsList(images, file.getPermissions(), file.getOwnerID(), false, new Command() {
148 148
			
149 149
			@Override
150 150
			public void execute() {
......
240 240
    void showLinkIfShared() {
241 241
		if (file.isShared()) {
242 242
			UrlBuilder b = Window.Location.createUrlBuilder();
243
			b.setPath(app.getApiPath() + file.getOwner() + file.getUri());
243
			b.setPath(app.getApiPath() + file.getOwnerID() + file.getUri());
244 244
			String href = Window.Location.getHref();
245 245
			boolean hasParameters = href.contains("?");
246 246
			path.setText(href + (hasParameters ? "&" : "?") + "goto=" + b.buildString());
......
265 265
            PostRequest updateFile = new PostRequest(api, owner, path) {
266 266
                @Override
267 267
                public void onSuccess(Resource result) {
268
                	HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwner(), path, file) {
268
                	HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {
269 269

  
270 270
						@Override
271 271
						public void onSuccess(File _result) {
b/src/gr/grnet/pithos/web/client/FilePropertiesDialog.java
133 133
        name.setWidth("100%");
134 134
        name.setText(file.getName());
135 135
        generalTable.setWidget(0, 1, name);
136
        if(file.getParent() != null)
136
        if(file.getParent() != null) {
137 137
            generalTable.setText(1, 1, file.getParent().getName());
138
        else
138
        }
139
        else {
139 140
            generalTable.setText(1, 1, "-");
140
        generalTable.setText(2, 1, file.getOwner());
141
        }
142

  
143
        final String ownerID = file.getOwnerID();
144
        final String displayName = app.getUserDisplayNameByID(ownerID);
145
        final String ownerDisplayName;
146
        if(displayName == null) {
147
            // FIXME: Get the actual display name and do not use the id
148
            ownerDisplayName = ownerID;
149
        }
150
        else {
151
            ownerDisplayName = displayName;
152
        }
153
        generalTable.setText(2, 1, ownerDisplayName);
141 154

  
142 155
        final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");
143 156
        generalTable.setText(3, 1, file.getLastModified() != null ? formatter.format(file.getLastModified()) : "");
......
251 264
            PutRequest updateFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {
252 265
                @Override
253 266
                public void onSuccess(Resource result) {
254
                    updateMetaData(app.getApiPath(), file.getOwner(), path, newMeta);
267
                    updateMetaData(app.getApiPath(), file.getOwnerID(), path, newMeta);
255 268
                }
256 269

  
257 270
                @Override
b/src/gr/grnet/pithos/web/client/FilePublishDialog.java
157 157
        });
158 158

  
159 159
        // Only show the read for all permission if the user is the owner.
160
        if (file.getOwner().equals(app.getUserID())) {
160
        if (file.getOwnerID().equals(app.getUserID())) {
161 161
            final HorizontalPanel permForAll = new HorizontalPanel();
162 162
            permForAll.add(new Label("Public"));
163 163
            permForAll.add(readForAll);
......
222 222
	protected boolean accept() {
223 223
        Boolean published = null;
224 224
		if (readForAll.getValue() != file.isPublished())
225
			if (file.getOwner().equals(app.getUserID()))
225
			if (file.getOwnerID().equals(app.getUserID()))
226 226
                published = readForAll.getValue();
227 227
        updateMetaData(app.getApiPath(), app.getUserID(), file.getUri() + "?update=", published);
228 228
        return true;
......
233 233
            PostRequest updateFile = new PostRequest(api, owner, path) {
234 234
                @Override
235 235
                public void onSuccess(Resource result) {
236
                	HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwner(), path, file) {
236
                	HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {
237 237

  
238 238
						@Override
239 239
						public void onSuccess(File _result) {
b/src/gr/grnet/pithos/web/client/FileVersionsDialog.java
146 146

  
147 147
    protected void fetchVersions() {
148 148
    	String path = file.getUri() + "?format=json&version=list";
149
    	GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(FileVersions.class, app.getApiPath(), file.getOwner(), path) {
149
    	GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(FileVersions.class, app.getApiPath(), file.getOwnerID(), path) {
150 150

  
151 151
			@Override
152 152
			public void onSuccess(FileVersions _result) {
b/src/gr/grnet/pithos/web/client/FolderPropertiesDialog.java
141 141
        else
142 142
            generalTable.setText(1, 1, folder.getParent().getName());
143 143
        if (create)
144
        	generalTable.setText(2, 1, app.getUserDisplayName());
144
        	generalTable.setText(2, 1, app.getCurrentUserDisplayNameOrID());
145 145
        else
146 146
        	generalTable.setText(2, 1, folder.getOwner());
147 147
        DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");
b/src/gr/grnet/pithos/web/client/Pithos.java
126 126
        return userID;
127 127
    }
128 128

  
129
    public String getUserDisplayName() {
129
    public String getCurrentUserDisplayNameOrID() {
130 130
        final String displayName = userCatalogs.getDisplayName(getUserID());
131 131
        return displayName == null ? getUserID() : displayName;
132 132
    }
133 133

  
134
    public boolean hasUserDisplayNameForID(String id) {
135
        return userCatalogs.getDisplayName(id) != null;
136
    }
137

  
138
    public String getUserDisplayNameByID(String id) {
139
        return userCatalogs.getDisplayName(id);
140
    }
141

  
134 142
    public void setAccount(AccountResource acct) {
135 143
        account = acct;
136 144
    }
......
1025 1033
            };
1026 1034
            copyFile.setHeader("X-Auth-Token", getUserToken());
1027 1035
            copyFile.setHeader("X-Copy-From", URL.encodePathSegment(file.getUri()));
1028
            if(!file.getOwner().equals(targetUsername)) {
1029
                copyFile.setHeader("X-Source-Account", URL.encodePathSegment(file.getOwner()));
1036
            if(!file.getOwnerID().equals(targetUsername)) {
1037
                copyFile.setHeader("X-Source-Account", URL.encodePathSegment(file.getOwnerID()));
1030 1038
            }
1031 1039
            copyFile.setHeader("Content-Type", file.getContentType());
1032 1040
            Scheduler.get().scheduleDeferred(copyFile);
......
1321 1329
    }
1322 1330

  
1323 1331
    public void scheduleFileHeadCommand(File f, final Command callback) {
1324
        HeadRequest<File> headFile = new HeadRequest<File>(File.class, getApiPath(), f.getOwner(), f.getUri(), f) {
1332
        HeadRequest<File> headFile = new HeadRequest<File>(File.class, getApiPath(), f.getOwnerID(), f.getUri(), f) {
1325 1333

  
1326 1334
            @Override
1327 1335
            public void onSuccess(File _result) {
b/src/gr/grnet/pithos/web/client/ToolsMenu.java
135 135
			        	if (item instanceof List) {
136 136
			        		@SuppressWarnings("unchecked")
137 137
							List<File> _files = (List<File>) item;
138
			        		if (_files.get(0).getOwner().equals(folder.getOwner()))
138
			        		if (_files.get(0).getOwnerID().equals(folder.getOwner()))
139 139
			        			showPaste = true;
140 140
			        	}
141 141
			        	else {
......
194 194
							@Override
195 195
							public void execute() {
196 196
					        	for (File f: files)
197
					        		Window.open(app.getApiPath() + f.getOwner() + f.getUri(), "_blank", "");
197
					        		Window.open(app.getApiPath() + f.getOwnerID() + f.getUri(), "_blank", "");
198 198
							}
199 199
						}));
200 200
			        	empty = false;
b/src/gr/grnet/pithos/web/client/VersionsList.java
116 116
			downloadHtml.addClickHandler(new ClickHandler() {
117 117
				@Override
118 118
				public void onClick(ClickEvent event) {
119
					String fileUrl = app.getApiPath() + file.getOwner() + file.getUri() + "?version=" + v.getVersion();
119
					String fileUrl = app.getApiPath() + file.getOwnerID() + file.getUri() + "?version=" + v.getVersion();
120 120
					Window.open(fileUrl, "_BLANK", "");
121 121
				}
122 122
			});
......
132 132

  
133 133
	void restoreVersion(int version) {
134 134
		String path = file.getUri() + "?update=";
135
		PostRequest restoreVersion = new PostRequest(app.getApiPath(), file.getOwner(), path) {
135
		PostRequest restoreVersion = new PostRequest(app.getApiPath(), file.getOwnerID(), path) {
136 136
			
137 137
			@Override
138 138
			public void onSuccess(Resource result) {
b/src/gr/grnet/pithos/web/client/foldertree/File.java
66 66

  
67 67
    private String path;
68 68

  
69
    private String owner;
69
    private String ownerID;
70 70

  
71 71
    private String container;
72 72

  
......
111 111
        return "/" + container + "/" + path;
112 112
    }
113 113

  
114
    public String getOwner() {
115
        return owner;
114
    public String getOwnerID() {
115
        return ownerID;
116 116
    }
117 117

  
118 118
    public String getPath() {
......
149 149
        	name = path.substring(parent.getPrefix().length() + 1);
150 150
        else
151 151
            name = path;
152
        this.owner = _owner;
152
        this.ownerID = _owner;
153 153
        hash = unmarshallString(o, "hash");
154 154
        bytes = unmarshallLong(o, "bytes");
155 155
        version = unmarshallInt(o, "x_object_version");
......
223 223
    }
224 224

  
225 225
    private void populate(String _owner, Response response) {
226
        this.owner = _owner;
226
        this.ownerID = _owner;
227 227
        published = false;
228 228
        publicUri = null;
229 229
        permissions.clear();

Also available in: Unified diff