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