Revision 757813cf

b/src/gr/ebs/gss/client/FileList.java
891 891
					public void onComplete() {
892 892
						folderItem.setUserObject(getResult());
893 893
						updateFileCache(clearSelection, newFilename);
894
						String[] filePaths = new String[folderItem.getSharedResource().getFilePaths().size()];
895
						int c=0;
896
						for(String fpath : folderItem.getSharedResource().getFilePaths()){
897
							filePaths[c] = fpath + "?" + Math.random();
898
							c++;
899
						}
900
						MultipleHeadCommand<FileResource> getFiles = new MultipleHeadCommand<FileResource>(FileResource.class, filePaths, folderItem.getSharedResource().getFileCache()){
901

  
902
							@Override
903
							public void onComplete(){
904
								List<FileResource> result = getResult();
905
								//remove random from path
906
								for(FileResource r : result){
907
									String p = r.getUri();
908
									int indexOfQuestionMark = p.lastIndexOf('?');
909
									if(indexOfQuestionMark>0)
910
										r.setUri(p.substring(0, indexOfQuestionMark));
911
									GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
912
								}
913
								folderItem.getSharedResource().setFiles(result);
914
								folderItem.getSharedResource().setFilesExpanded(true);
915
								updateFileCache(clearSelection, newFilename);
916
							}
917

  
918
							@Override
919
							public void onError(String p, Throwable throwable) {
920
								if(throwable instanceof RestException)
921
									GSS.get().displayError("Unable to retrieve file details:"+((RestException)throwable).getHttpStatusText());
922
							}
923

  
924
							@Override
925
							public void onError(Throwable t) {
926
								GWT.log("", t);
927
								GSS.get().displayError("Unable to fetch files for folder " + folderItem.getFolderResource().getName());
928
							}
929

  
930
						};
931
						DeferredCommand.addCommand(getFiles);
894 932
					}
895 933

  
896 934
					@Override
......
907 945
					public void onComplete() {
908 946
						folderItem.setUserObject(getResult());
909 947
						updateFileCache(clearSelection, newFilename);
948
						String[] filePaths = new String[folderItem.getOtherUserResource().getFilePaths().size()];
949
						int c=0;
950
						for(String fpath : folderItem.getOtherUserResource().getFilePaths()){
951
							filePaths[c] = fpath + "?" + Math.random();
952
							c++;
953
						}
954
						MultipleHeadCommand<FileResource> getFiles = new MultipleHeadCommand<FileResource>(FileResource.class, filePaths, folderItem.getOtherUserResource().getFileCache()){
955

  
956
							@Override
957
							public void onComplete(){
958
								List<FileResource> result = getResult();
959
								//remove random from path
960
								for(FileResource r : result){
961
									String p = r.getUri();
962
									int indexOfQuestionMark = p.lastIndexOf('?');
963
									if(indexOfQuestionMark>0)
964
										r.setUri(p.substring(0, indexOfQuestionMark));
965
									GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
966
								}
967
								folderItem.getOtherUserResource().setFiles(result);
968
								folderItem.getOtherUserResource().setFilesExpanded(true);
969
								updateFileCache(clearSelection, newFilename);
970
							}
971

  
972
							@Override
973
							public void onError(String p, Throwable throwable) {
974
								if(throwable instanceof RestException)
975
									GSS.get().displayError("Unable to retrieve file details:"+((RestException)throwable).getHttpStatusText());
976
							}
977

  
978
							@Override
979
							public void onError(Throwable t) {
980
								GWT.log("", t);
981
								GSS.get().displayError("Unable to fetch files for folder " + folderItem.getFolderResource().getName());
982
							}
983

  
984
						};
985
						DeferredCommand.addCommand(getFiles);
910 986
					}
911 987

  
912 988
					@Override
b/src/gr/ebs/gss/client/rest/resource/OtherUserResource.java
18 18
 */
19 19
package gr.ebs.gss.client.rest.resource;
20 20

  
21
import gr.ebs.gss.client.rest.MultipleGetCommand;
22
import gr.ebs.gss.client.rest.MultipleGetCommand.Cached;
23

  
21 24
import java.util.ArrayList;
22 25
import java.util.Date;
23 26
import java.util.LinkedList;
24 27
import java.util.List;
25 28

  
29
import com.google.gwt.core.client.GWT;
26 30
import com.google.gwt.http.client.URL;
27 31
import com.google.gwt.json.client.JSONArray;
28 32
import com.google.gwt.json.client.JSONObject;
......
44 48
	List<FolderResource> folders = new ArrayList<FolderResource>();
45 49
	List<FileResource> files = new ArrayList<FileResource>();
46 50

  
51
	private boolean filesExpanded=false;
47 52
	/**
48 53
	 * Retrieve the username.
49 54
	 *
......
208 213
	public String getLastModifiedSince() {
209 214
		return null;
210 215
	}
216

  
217

  
218
	public MultipleGetCommand.Cached[] getFileCache(){
219
		if(getFilePaths().size() != getFiles().size()){
220
			GWT.log("MISMATCH IN PATH AND FILES SIZE", null);
221
			return null;
222
		}
223
		if(!filesExpanded)
224
			return null;
225
		MultipleGetCommand.Cached[] result = new MultipleGetCommand.Cached[getFilePaths().size()];
226
		for(int i=0; i<getFiles().size();i++){
227
			FileResource r = getFiles().get(i);
228
			Cached c = new Cached();
229
			c.cache=r;
230
			c.uri=r.uri;
231
			result[i] = c;
232
		}
233

  
234
		return result;
235
	}
236

  
237

  
238
	public void setFilesExpanded(boolean filesExpanded) {
239
		this.filesExpanded = filesExpanded;
240
	}
211 241
}
b/src/gr/ebs/gss/client/rest/resource/SharedResource.java
18 18
 */
19 19
package gr.ebs.gss.client.rest.resource;
20 20

  
21
import gr.ebs.gss.client.rest.MultipleGetCommand;
22
import gr.ebs.gss.client.rest.MultipleGetCommand.Cached;
23

  
21 24
import java.util.ArrayList;
22 25
import java.util.Date;
23 26
import java.util.LinkedList;
24 27
import java.util.List;
25 28

  
29
import com.google.gwt.core.client.GWT;
26 30
import com.google.gwt.http.client.URL;
27 31
import com.google.gwt.json.client.JSONArray;
28 32
import com.google.gwt.json.client.JSONObject;
......
45 49

  
46 50
	List<FileResource> files = new ArrayList<FileResource>();
47 51

  
52
	private boolean filesExpanded=false;
53

  
48 54
	/**
49 55
	 * Retrieve the files.
50 56
	 *
......
199 205
	public String getLastModifiedSince() {
200 206
		return null;
201 207
	}
208

  
209

  
210
	public MultipleGetCommand.Cached[] getFileCache(){
211
		if(getFilePaths().size() != getFiles().size()){
212
			GWT.log("MISMATCH IN PATH AND FILES SIZE", null);
213
			return null;
214
		}
215
		if(!filesExpanded)
216
			return null;
217
		MultipleGetCommand.Cached[] result = new MultipleGetCommand.Cached[getFilePaths().size()];
218
		for(int i=0; i<getFiles().size();i++){
219
			FileResource r = getFiles().get(i);
220
			Cached c = new Cached();
221
			c.cache=r;
222
			c.uri=r.uri;
223
			result[i] = c;
224
		}
225

  
226
		return result;
227
	}
228

  
229

  
230
	public void setFilesExpanded(boolean filesExpanded) {
231
		this.filesExpanded = filesExpanded;
232
	}
202 233
}

Also available in: Unified diff