Revision 378fe36a src/com/rackspace/cloud/android/ContainerObjectDetails.java

b/src/com/rackspace/cloud/android/ContainerObjectDetails.java
51 51
import com.rackspace.cloud.files.api.client.GroupResource;
52 52
import com.rackspace.cloud.files.api.client.ObjectVersion;
53 53
import com.rackspace.cloud.files.api.client.Permission;
54
import com.rackspace.cloud.servers.api.client.Account;
54 55
import com.rackspace.cloud.servers.api.client.CloudServersException;
55 56
import com.rackspace.cloud.servers.api.client.http.HttpBundle;
57
import com.rackspace.cloud.utils.Utils;
56 58

  
57 59
/**
58 60
 * 
......
96 98
		objects = (ContainerObjects) this.getIntent().getExtras()
97 99
				.get("container");
98 100
		otherUser = (String) this.getIntent().getExtras().get("otherUser");
99
		Log.i(LOG, "OTHERUSER:" + otherUser);
101
		Log.d(LOG, "OTHERUSER:" + otherUser);
100 102
		containerNames = (String) this.getIntent().getExtras()
101 103
				.get("containerNames");
102 104
		cdnURL = (String) this.getIntent().getExtras().get("cdnUrl");
......
281 283
					}
282 284
				}
283 285

  
284
			};
286
			}.execute();
285 287
		} catch (Exception e) {
286 288
			Log.e("ERROR THERE", "", e);
287 289
		}
......
415 417
		Iterator<Permission> it = null;
416 418
		if (objects.getPermissions() != null) {
417 419
			it = objects.getPermissions().iterator();
420
			List<String> uuids = new ArrayList<String>();
421
			while (it.hasNext()) {
422
				Permission p = it.next();
423
				if(p.getUser()!=null)
424
					uuids.add(p.getUser());
425
			}
426
			if(uuids.size()>0){
427
				Account.expandUUIDSOrDisplayNames(this, new ArrayList<String>(), uuids);
428
			}
429
			it = objects.getPermissions().iterator();
418 430
			int i = 0;
419 431
			while (it.hasNext()) {
420 432
				final Permission perm = it.next();
433
				if(perm.getUser()!=null){
434
					perm.setDisplayName(Account.getAccount().getDisplayNameForUUID(perm.getUser(), this));
435
				}
421 436
				final View v = layoutInflater.inflate(R.layout.propertiesrow,
422 437
						null);
423 438
				populatePermissionList(perm, v, properties, i);
......
438 453

  
439 454
		((TextView) v.findViewById(R.id.ownerName))
440 455
				.setText(perm.getUser() == null ? perm.getGroup() + ":" : perm
441
						.getUser());
456
						.getDisplayName() + ":");
442 457
		((CheckBox) v.findViewById(R.id.read)).setChecked(perm.isRead());
443 458
		((CheckBox) v.findViewById(R.id.write)).setChecked(perm.isWrite());
444 459

  
......
480 495
		Permission np = new Permission();
481 496
		if (group)
482 497
			np.setGroup(userOrGroup);
483
		else
484
			np.setUser(userOrGroup);
498
		else{
499
			np.setDisplayName(userOrGroup);
500
			String uuid = Account.getAccount().getUUIDForDisplayName(userOrGroup, this);
501
			if(uuid==null){
502
				showAlert("User does not exit", "The username you specified is invalid");
503
				return;
504
			}
505
			np.setUser(uuid);
506
		}
485 507
		objects.getPermissions().add(np);
486 508
		rebuildPermissionList();
487 509
	}
......
885 907
			showDialog();
886 908
			app.setDeleteingObject(true);
887 909
			deleteObjTask = new DeleteObjectListenerTask();
888
			deleteObjTask.execute();
910
			Utils.execute(deleteObjTask);
889 911
		}
890 912

  
891 913
		@Override
......
937 959
		protected void onPreExecute() {
938 960
			showDialog();
939 961
			app.setDownloadingObject(true);
962
			downloadObjTask = new DownloadObjectListenerTask();
963
			Utils.execute(downloadObjTask);
940 964
			
941 965
		}
942 966

  
......
953 977
							.getObject(containerNames, objects.getCName(),
954 978
									otherUser);
955 979
			} catch (CloudServersException e) {
956
				e.printStackTrace();
957 980
				exception = e;
958 981
			} catch (Exception exx) {
959 982
				exx.printStackTrace();
......
971 994
					setResult(Activity.RESULT_OK);
972 995
					HttpEntity entity = response.getEntity();
973 996
					app.setDownloadedEntity(entity);
974
					downloadObjTask = new DownloadObjectListenerTask();
975
					downloadObjTask.execute();
976 997
				} else {
977 998
					CloudServersException cse = parseCloudServersException(response);
978 999
					if ("".equals(cse.getMessage())) {
......
1080 1101
		String directoryName = Environment.getExternalStorageDirectory()
1081 1102
				.getPath();
1082 1103
		File f = new File(directoryName, DOWNLOAD_DIRECTORY);
1083
		Log.i(LOG, directoryName);
1104
		Log.d(LOG, directoryName);
1084 1105
		if (!f.isDirectory()) {
1085 1106
			if (!f.mkdir()) {
1086 1107
				return false;
1087 1108
			}
1088 1109
		}
1089
		Log.i(LOG, objects.toString());
1110
		Log.d(LOG, objects.toString());
1090 1111
		// String filename = directoryName + "/" + objects.getName();
1091 1112
		StringTokenizer str = new StringTokenizer(objects.getCName(), "/");
1092 1113
		String path = "";
1093 1114
		String fname = "";
1094 1115
		int count = str.countTokens();
1095
		Log.i(LOG, "object is: " + objects.getCName() + " " + count);
1116
		Log.d(LOG, "object is: " + objects.getCName() + " " + count);
1096 1117
		for (int i = 0; i < count; i++) {
1097 1118
			if (i < (count - 1)) {
1098 1119
				path = path + str.nextToken() + "/";
1099 1120
			} else
1100 1121
				fname = str.nextToken();
1101 1122
		}
1102
		Log.i(LOG, "Path is:" + path);
1103
		Log.i(LOG, "Fname is:" + fname);
1123
		Log.d(LOG, "Path is:" + path);
1124
		Log.d(LOG, "Fname is:" + fname);
1104 1125
		File object;
1105 1126
		if ("".equals(path)) {
1106 1127
			object = new File(f, fname);
......
1152 1173

  
1153 1174
	@Override
1154 1175
	public void onBackPressed() {
1155

  
1156
		// TODO: perform update
1176
		
1157 1177
		super.onBackPressed();
1158 1178
	}
1159 1179

  
......
1304 1324
		HttpBundle b = new ContainerObjectManager(getApplicationContext())
1305 1325
				.updateObject(objects.getContainerName(), objects.getCName(),
1306 1326
						"", null, headers, otherUser);
1307
		Log.i(LOG, "response:"
1327
		Log.d(LOG, "response:"
1308 1328
				+ b.getResponse().getStatusLine().getStatusCode());
1309 1329
		return b;
1310 1330
	}
1311 1331

  
1312 1332
	public HttpBundle restoreVersion(String version)
1313 1333
			throws CloudServersException {
1314
		Log.i(LOG, "Update version:" + version);
1334
		Log.d(LOG, "Update version:" + version);
1315 1335
		Map<String, String> headers = new HashMap<String, String>();
1316 1336

  
1317 1337
		headers.put("X-Source-Object", "/" + objects.getContainerName() + "/"
......
1321 1341
		HttpBundle b = new ContainerObjectManager(getApplicationContext())
1322 1342
				.updateObject(objects.getContainerName(), objects.getCName(),
1323 1343
						"", "text/plain; charset=UTF-8", headers, otherUser);
1324
		Log.i(LOG, "response:"
1344
		Log.d(LOG, "response:"
1325 1345
				+ b.getResponse().getStatusLine().getStatusCode());
1326 1346
		return b;
1327 1347
	}

Also available in: Unified diff