Revision ee77dbf1 src/gr/grnet/pithos/web/client/Pithos.java
b/src/gr/grnet/pithos/web/client/Pithos.java | ||
---|---|---|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
public String getCurrentUserDisplayNameOrID() { |
128 |
final String displayName = userCatalogs.getDisplayName(getUserID()); |
|
128 |
final String displayName = userCatalogs.getUserDisplayName(getUserID());
|
|
129 | 129 |
return displayName == null ? getUserID() : displayName; |
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
public boolean hasUserDisplayNameForID(String userID) { |
133 |
return userCatalogs.getDisplayName(userID) != null; |
|
133 |
return userCatalogs.getUserDisplayName(userID) != null; |
|
134 |
} |
|
135 |
|
|
136 |
public boolean hasUserIDForDisplayName(String displayName) { |
|
137 |
return userCatalogs.getUserID(displayName) != null; |
|
134 | 138 |
} |
135 | 139 |
|
136 | 140 |
public String getUserDisplayNameForID(String userID) { |
137 |
return userCatalogs.getDisplayName(userID); |
|
141 |
return userCatalogs.getUserDisplayName(userID);
|
|
138 | 142 |
} |
139 | 143 |
|
140 | 144 |
public String getUserIDForDisplayName(String displayName) { |
... | ... | |
160 | 164 |
} |
161 | 165 |
final List<String> filtered = new ArrayList<String>(); |
162 | 166 |
for(String userID : userIDs) { |
163 |
if(!this.userCatalogs.hasID(userID)) { |
|
167 |
if(!this.userCatalogs.hasUserID(userID)) {
|
|
164 | 168 |
filtered.add(userID); |
165 | 169 |
} |
166 | 170 |
} |
... | ... | |
332 | 336 |
} |
333 | 337 |
}-*/; |
334 | 338 |
|
335 |
public static void LOG(String ...args) {
|
|
339 |
public static void LOG(Object ...args) {
|
|
336 | 340 |
final StringBuilder sb = new StringBuilder(); |
337 |
for(String arg : args) {
|
|
341 |
for(Object arg : args) {
|
|
338 | 342 |
sb.append(arg); |
339 | 343 |
} |
340 | 344 |
if(sb.length() > 0) { |
... | ... | |
549 | 553 |
return true; |
550 | 554 |
} |
551 | 555 |
|
552 |
HeadRequest<Folder> head = new HeadRequest<Folder>(Folder.class, getApiPath(), f.getOwnerID(), "/" + f.getContainer()) { |
|
556 |
HeadRequest<Folder> head = new HeadRequest<Folder>(Pithos.this, Folder.class, getApiPath(), f.getOwnerID(), "/" + f.getContainer()) {
|
|
553 | 557 |
|
554 | 558 |
@Override |
555 | 559 |
public void onSuccess(Folder _result) { |
... | ... | |
706 | 710 |
} |
707 | 711 |
|
708 | 712 |
public void fetchAccount(final Command callback) { |
713 |
LOG("Pithos::fetchAccount(), callback = ", callback); |
|
709 | 714 |
String path = "?format=json"; |
710 | 715 |
|
711 |
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, getApiPath(), userID, path) { |
|
716 |
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(this, AccountResource.class, getApiPath(), userID, path) {
|
|
712 | 717 |
@Override |
713 | 718 |
public void onSuccess(AccountResource _result) { |
714 | 719 |
account = _result; |
... | ... | |
741 | 746 |
} |
742 | 747 |
|
743 | 748 |
public void updateStatistics() { |
744 |
HeadRequest<AccountResource> headAccount = new HeadRequest<AccountResource>(AccountResource.class, getApiPath(), userID, "", account) { |
|
749 |
HeadRequest<AccountResource> headAccount = new HeadRequest<AccountResource>(this, AccountResource.class, getApiPath(), userID, "", account) {
|
|
745 | 750 |
|
746 | 751 |
@Override |
747 | 752 |
public void onSuccess(AccountResource _result) { |
... | ... | |
771 | 776 |
|
772 | 777 |
protected void createHomeContainer(final AccountResource _account, final Command callback) { |
773 | 778 |
String path = "/" + Const.HOME_CONTAINER; |
774 |
PutRequest createPithos = new PutRequest(getApiPath(), getUserID(), path) { |
|
779 |
PutRequest createPithos = new PutRequest(this, getApiPath(), getUserID(), path) {
|
|
775 | 780 |
@Override |
776 | 781 |
public void onSuccess(Resource result) { |
777 | 782 |
if(!_account.hasTrashContainer()) { |
... | ... | |
805 | 810 |
|
806 | 811 |
protected void createTrashContainer(final Command callback) { |
807 | 812 |
String path = "/" + Const.TRASH_CONTAINER; |
808 |
PutRequest createPithos = new PutRequest(getApiPath(), getUserID(), path) { |
|
813 |
PutRequest createPithos = new PutRequest(this, getApiPath(), getUserID(), path) {
|
|
809 | 814 |
@Override |
810 | 815 |
public void onSuccess(Resource result) { |
811 | 816 |
fetchAccount(callback); |
... | ... | |
972 | 977 |
final PleaseWaitPopup pwp = new PleaseWaitPopup(); |
973 | 978 |
pwp.center(); |
974 | 979 |
String path = "/" + folder.getContainer() + "/" + folder.getPrefix() + "?delimiter=/" + "&t=" + System.currentTimeMillis(); |
975 |
DeleteRequest deleteFolder = new DeleteRequest(getApiPath(), folder.getOwnerID(), path) { |
|
980 |
DeleteRequest deleteFolder = new DeleteRequest(this, getApiPath(), folder.getOwnerID(), path) {
|
|
976 | 981 |
|
977 | 982 |
@Override |
978 | 983 |
protected void onUnauthorized(Response response) { |
... | ... | |
1026 | 1031 |
if(iter.hasNext()) { |
1027 | 1032 |
File file = iter.next(); |
1028 | 1033 |
String path = targetUri + "/" + file.getName(); |
1029 |
PutRequest copyFile = new PutRequest(getApiPath(), targetUsername, path) { |
|
1034 |
PutRequest copyFile = new PutRequest(this, getApiPath(), targetUsername, path) {
|
|
1030 | 1035 |
@Override |
1031 | 1036 |
public void onSuccess(Resource result) { |
1032 | 1037 |
copyFiles(iter, targetUsername, targetUri, callback); |
... | ... | |
1064 | 1069 |
|
1065 | 1070 |
public void copyFolder(final Folder f, final String targetUsername, final String targetUri, boolean move, final Command callback) { |
1066 | 1071 |
String path = targetUri + "?delimiter=/"; |
1067 |
PutRequest copyFolder = new PutRequest(getApiPath(), targetUsername, path) { |
|
1072 |
PutRequest copyFolder = new PutRequest(this, getApiPath(), targetUsername, path) {
|
|
1068 | 1073 |
@Override |
1069 | 1074 |
public void onSuccess(Resource result) { |
1070 | 1075 |
if(callback != null) { |
... | ... | |
1121 | 1126 |
groupTreeView.updateGroupNode(null); |
1122 | 1127 |
} |
1123 | 1128 |
|
1124 |
public Group addGroup(String groupname) {
|
|
1125 |
Group newGroup = new Group(groupname);
|
|
1126 |
account.addGroup(newGroup);
|
|
1129 |
public Group addGroup(String groupName) {
|
|
1130 |
final Group group = new Group(groupName);
|
|
1131 |
account.addGroup(group);
|
|
1127 | 1132 |
groupTreeView.updateGroupNode(null); |
1128 |
return newGroup;
|
|
1133 |
return group;
|
|
1129 | 1134 |
} |
1130 | 1135 |
|
1131 | 1136 |
public void removeGroup(Group group) { |
... | ... | |
1278 | 1283 |
} |
1279 | 1284 |
} |
1280 | 1285 |
else { |
1281 |
HeadRequest<Folder> headFolder = new HeadRequest<Folder>(Folder.class, getApiPath(), folder.getOwnerID(), folder.getUri(), folder) { |
|
1286 |
HeadRequest<Folder> headFolder = new HeadRequest<Folder>(this, Folder.class, getApiPath(), folder.getOwnerID(), folder.getUri(), folder) {
|
|
1282 | 1287 |
|
1283 | 1288 |
@Override |
1284 | 1289 |
public void onSuccess(Folder _result) { |
... | ... | |
1292 | 1297 |
if(t instanceof RestException) { |
1293 | 1298 |
if(((RestException) t).getHttpStatusCode() == Response.SC_NOT_FOUND) { |
1294 | 1299 |
final String path = folder.getUri(); |
1295 |
PutRequest newFolder = new PutRequest(getApiPath(), folder.getOwnerID(), path) { |
|
1300 |
PutRequest newFolder = new PutRequest(Pithos.this, getApiPath(), folder.getOwnerID(), path) {
|
|
1296 | 1301 |
@Override |
1297 | 1302 |
public void onSuccess(Resource _result) { |
1298 | 1303 |
scheduleFolderHeadCommand(folder, callback); |
... | ... | |
1347 | 1352 |
} |
1348 | 1353 |
|
1349 | 1354 |
public void scheduleFileHeadCommand(File f, final Command callback) { |
1350 |
HeadRequest<File> headFile = new HeadRequest<File>(File.class, getApiPath(), f.getOwnerID(), f.getUri(), f) { |
|
1355 |
HeadRequest<File> headFile = new HeadRequest<File>(this, File.class, getApiPath(), f.getOwnerID(), f.getUri(), f) {
|
|
1351 | 1356 |
|
1352 | 1357 |
@Override |
1353 | 1358 |
public void onSuccess(File _result) { |
... | ... | |
1461 | 1466 |
|
1462 | 1467 |
public void emptyContainer(final Folder container) { |
1463 | 1468 |
String path = "/" + container.getName() + "?delimiter=/"; |
1464 |
DeleteRequest delete = new DeleteRequest(getApiPath(), getUserID(), path) { |
|
1469 |
DeleteRequest delete = new DeleteRequest(this, getApiPath(), getUserID(), path) {
|
|
1465 | 1470 |
|
1466 | 1471 |
@Override |
1467 | 1472 |
protected void onUnauthorized(Response response) { |
Also available in: Unified diff