Revision 16b54aa8

b/src/gr/ebs/gss/admin/client/AdminService.java
55 55
	void removeUserClass(UserClassDTO userClass) throws RpcException,ObjectNotFoundException;
56 56

  
57 57
	void removeUser(Long userId) throws RpcException,ObjectNotFoundException,InsufficientPermissionsException;
58
	
59
	void fixSharedFlagForAllFoldersAndFiles() throws RpcException;
58 60
}
b/src/gr/ebs/gss/admin/client/AdminServiceAsync.java
50 50
	void removeUserClass(UserClassDTO userClass, AsyncCallback<Void> callback);
51 51

  
52 52
	void removeUser(Long userId, AsyncCallback<Void> callback);
53
	
54
	void fixSharedFlagForAllFoldersAndFiles( AsyncCallback<Void> callback);
53 55
}
b/src/gr/ebs/gss/admin/client/TwoAdmin.ui.xml
42 42
					</g:ScrollPanel>
43 43

  
44 44
				</g:tab>
45
				
46
				<g:tab>
47
					<g:header>Operations</g:header>
48
					<g:ScrollPanel>
49
					<adminui:OperationsPanel></adminui:OperationsPanel>
50
					</g:ScrollPanel>
51

  
52
				</g:tab>
45 53

  
46 54

  
47 55
			</g:TabLayoutPanel>
b/src/gr/ebs/gss/admin/client/ui/OperationsPanel.java
1
/*
2
 * Copyright 2010 Electronic Business Systems Ltd.
3
 *
4
 * This file is part of GSS.
5
 *
6
 * GSS is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * GSS is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
package gr.ebs.gss.admin.client.ui;
20

  
21
import gr.ebs.gss.admin.client.TwoAdmin;
22
import gr.ebs.gss.admin.client.ui.FilesPanel.UserPanelUiBinder;
23
import gr.ebs.gss.server.domain.dto.FileBodyDTO;
24
import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
25
import gr.ebs.gss.server.domain.dto.PermissionDTO;
26

  
27
import java.util.ArrayList;
28
import java.util.HashSet;
29
import java.util.List;
30

  
31
import com.google.gwt.core.client.GWT;
32
import com.google.gwt.event.dom.client.ClickEvent;
33
import com.google.gwt.event.dom.client.ClickHandler;
34
import com.google.gwt.event.dom.client.KeyPressEvent;
35
import com.google.gwt.event.dom.client.KeyPressHandler;
36
import com.google.gwt.gen2.table.event.client.RowSelectionEvent;
37
import com.google.gwt.gen2.table.event.client.RowSelectionHandler;
38
import com.google.gwt.uibinder.client.UiBinder;
39
import com.google.gwt.uibinder.client.UiField;
40
import com.google.gwt.uibinder.client.UiHandler;
41
import com.google.gwt.user.client.Command;
42
import com.google.gwt.user.client.DeferredCommand;
43
import com.google.gwt.user.client.rpc.AsyncCallback;
44
import com.google.gwt.user.client.ui.Button;
45
import com.google.gwt.user.client.ui.Composite;
46
import com.google.gwt.user.client.ui.Grid;
47
import com.google.gwt.user.client.ui.HTML;
48
import com.google.gwt.user.client.ui.TextBox;
49
import com.google.gwt.user.client.ui.Widget;
50

  
51

  
52
/**
53
 * @author kman
54
 *
55
 */
56
public class OperationsPanel extends Composite {
57

  
58
	private static UserPanelUiBinder uiBinder = GWT
59
			.create(UserPanelUiBinder.class);
60

  
61
	interface UserPanelUiBinder extends UiBinder<Widget, OperationsPanel> {
62
	}
63

  
64

  
65

  
66
	
67
	@UiField Button fixButton;
68
	
69
	public OperationsPanel() {
70
		
71

  
72
		initWidget(uiBinder.createAndBindUi(this));
73
		
74

  
75
	}
76

  
77
	@UiHandler("fixButton")
78
	void handleClick(@SuppressWarnings("unused") ClickEvent e){
79
		DeferredCommand.addCommand(new Command() {
80

  
81
			@Override
82
			public void execute() {
83
				TwoAdmin.get().showLoadingBox();
84
				TwoAdmin.get().getAdminService().fixSharedFlagForAllFoldersAndFiles( new AsyncCallback<Void>() {
85
					
86
					@Override
87
					public void onSuccess(Void result) {
88
								TwoAdmin.get().hideLoadingBox();
89
					}
90

  
91
					@Override
92
					public void onFailure(Throwable caught) {
93
						GWT.log("Error Fixing Permissions", caught);
94
						TwoAdmin.get().hideLoadingBox();
95
						TwoAdmin.get().showErrorBox("Error Fixing Permissions");
96

  
97
					}
98
				});
99

  
100
			}
101
		});
102
	}
103

  
104

  
105

  
106
	
107

  
108
}
b/src/gr/ebs/gss/admin/client/ui/OperationsPanel.ui.xml
1
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
2
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
3
	xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:adminui='urn:import:gr.ebs.gss.admin.client.ui' 
4
	 xmlns:dp="urn:import:com.google.gwt.user.datepicker.client"
5
	>
6
	<ui:style>
7
		
8
	</ui:style>
9
	
10
	<g:VerticalPanel addStyleNames="Gmnuri3D" width="100%">
11
		<g:HTMLPanel>
12
			<div>
13
				<h3>Administrative Operations</h3>
14
			</div>
15
		</g:HTMLPanel>
16
		<g:HorizontalPanel spacing="3">
17
			<g:cell horizontalAlignment="ALIGN_CENTER" verticalAlignment="ALIGN_MIDDLE">
18
				<g:HTML>Fix Sharing flag:</g:HTML>
19
			</g:cell>
20
			
21
			<g:cell horizontalAlignment="ALIGN_CENTER" verticalAlignment="ALIGN_MIDDLE">
22
				<g:Button ui:field="fixButton">Search</g:Button>
23
			</g:cell>
24
			
25
		</g:HorizontalPanel>
26

  
27

  
28
		
29
	</g:VerticalPanel>
30

  
31
</ui:UiBinder> 
b/src/gr/ebs/gss/client/FileList.java
670 670
				table.setHTML(i, 1, file.getName() + " <a href='" +
671 671
						GSS.get().getTopPanel().getFileMenu().getDownloadURL(file) +
672 672
						"' title='" + file.getName() + "' rel='lytebox[p]' " +
673
						"onclick='myLytebox.start(this, false, false)'>" +
673
						"onclick='myLytebox.start(this, false, false);return false;'>" +
674 674
						"(view)" + "</a>");
675 675
			else
676 676
				table.setHTML(i, 1, file.getName());
......
741 741
				if(uname==null)
742 742
					uname = ((DnDTreeItem)folders.getSharesItem()).getOthersResource().getUsernameOfUri(otherUser.getOtherUserResource().getUri());
743 743
				if(uname != null)
744
					shared = file.isShared();
744
					shared = file.getShared();
745 745
			}
746 746
		}
747 747
		else
748
			shared = file.isShared();
748
			shared = file.getShared();
749 749
		if (mimetype == null)
750 750
			return shared ? AbstractImagePrototype.create(images.documentShared()) : AbstractImagePrototype.create(images.document());
751 751
		mimetype = mimetype.toLowerCase();
......
821 821
							public void onComplete() {
822 822
								folderItem.setUserObject(getResult());
823 823
								if(GSS.get().getFolders().isFileItem(folderItem)){
824
									String[] filePaths = new String[folderItem.getFolderResource().getFilePaths().size()];
825
									int c=0;
826
									for(String fpath : folderItem.getFolderResource().getFilePaths()){
827
										filePaths[c] = fpath + "?" + Math.random();
828
										c++;
824
									
825
									//remove random from path
826
									for(FileResource r : folderItem.getFolderResource().getFiles()){
827
										String p = r.getUri();
828
										int indexOfQuestionMark = p.lastIndexOf('?');
829
										if(indexOfQuestionMark>0)
830
											r.setUri(p.substring(0, indexOfQuestionMark));
831
										GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
829 832
									}
830
									MultipleHeadCommand<FileResource> getFiles = new MultipleHeadCommand<FileResource>(FileResource.class, filePaths, folderItem.getFolderResource().getFileCache()){
831

  
832
										@Override
833
										public void onComplete(){
834
											List<FileResource> result = getResult();
835
											//remove random from path
836
											for(FileResource r : result){
837
												String p = r.getUri();
838
												int indexOfQuestionMark = p.lastIndexOf('?');
839
												if(indexOfQuestionMark>0)
840
													r.setUri(p.substring(0, indexOfQuestionMark));
841
												GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
842
											}
843
											folderItem.getFolderResource().setFiles(result);
844
											folderItem.getFolderResource().setFilesExpanded(true);
845
											updateFileCache(clearSelection, newFilename);
846
										}
847

  
848
										@Override
849
										public void onError(String p, Throwable throwable) {
850
											if(throwable instanceof RestException)
851
												GSS.get().displayError("Unable to retrieve file details:"+((RestException)throwable).getHttpStatusText());
852
										}
853

  
854
										@Override
855
										public void onError(Throwable t) {
856
											GWT.log("", t);
857
											GSS.get().displayError("Unable to fetch files for folder " + folderItem.getFolderResource().getName());
858
										}
859

  
860
									};
861
									DeferredCommand.addCommand(getFiles);
833
									folderItem.getFolderResource().setFilesExpanded(true);
834
									updateFileCache(clearSelection, newFilename);
862 835
								}
863 836
								else
864 837
									updateFileCache(clearSelection, newFilename);
......
900 873
					@Override
901 874
					public void onComplete() {
902 875
						folderItem.setUserObject(getResult());
903
						updateFileCache(clearSelection, newFilename);
904
						String[] filePaths = new String[folderItem.getSharedResource().getFilePaths().size()];
905
						int c=0;
906
						for(String fpath : folderItem.getSharedResource().getFilePaths()){
907
							filePaths[c] = fpath + "?" + Math.random();
908
							c++;
876
						for(FileResource r : folderItem.getSharedResource().getFiles()){
877
							String p = r.getUri();
878
							int indexOfQuestionMark = p.lastIndexOf('?');
879
							if(indexOfQuestionMark>0)
880
								r.setUri(p.substring(0, indexOfQuestionMark));
881
							GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
909 882
						}
910
						MultipleHeadCommand<FileResource> getFiles = new MultipleHeadCommand<FileResource>(FileResource.class, filePaths, folderItem.getSharedResource().getFileCache()){
911

  
912
							@Override
913
							public void onComplete(){
914
								List<FileResource> result = getResult();
915
								//remove random from path
916
								for(FileResource r : result){
917
									String p = r.getUri();
918
									int indexOfQuestionMark = p.lastIndexOf('?');
919
									if(indexOfQuestionMark>0)
920
										r.setUri(p.substring(0, indexOfQuestionMark));
921
									GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
922
								}
923
								folderItem.getSharedResource().setFiles(result);
924
								folderItem.getSharedResource().setFilesExpanded(true);
925
								updateFileCache(clearSelection, newFilename);
926
							}
927

  
928
							@Override
929
							public void onError(String p, Throwable throwable) {
930
								if(throwable instanceof RestException)
931
									GSS.get().displayError("Unable to retrieve file details:"+((RestException)throwable).getHttpStatusText());
932
							}
933

  
934
							@Override
935
							public void onError(Throwable t) {
936
								GWT.log("", t);
937
								GSS.get().displayError("Unable to fetch files for folder " + folderItem.getFolderResource().getName());
938
							}
939

  
940
						};
941
						DeferredCommand.addCommand(getFiles);
883
						folderItem.getSharedResource().setFilesExpanded(true);
884
						updateFileCache(clearSelection, newFilename);
885
						
942 886
					}
943 887

  
944 888
					@Override
......
954 898
					@Override
955 899
					public void onComplete() {
956 900
						folderItem.setUserObject(getResult());
957
						updateFileCache(clearSelection, newFilename);
958
						String[] filePaths = new String[folderItem.getOtherUserResource().getFilePaths().size()];
959
						int c=0;
960
						for(String fpath : folderItem.getOtherUserResource().getFilePaths()){
961
							filePaths[c] = fpath + "?" + Math.random();
962
							c++;
901
						//updateFileCache(clearSelection, newFilename);
902
						for(FileResource r : folderItem.getOtherUserResource().getFiles()){
903
							String p = r.getUri();
904
							int indexOfQuestionMark = p.lastIndexOf('?');
905
							if(indexOfQuestionMark>0)
906
								r.setUri(p.substring(0, indexOfQuestionMark));
907
							GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
963 908
						}
964
						MultipleHeadCommand<FileResource> getFiles = new MultipleHeadCommand<FileResource>(FileResource.class, filePaths, folderItem.getOtherUserResource().getFileCache()){
965

  
966
							@Override
967
							public void onComplete(){
968
								List<FileResource> result = getResult();
969
								//remove random from path
970
								for(FileResource r : result){
971
									String p = r.getUri();
972
									int indexOfQuestionMark = p.lastIndexOf('?');
973
									if(indexOfQuestionMark>0)
974
										r.setUri(p.substring(0, indexOfQuestionMark));
975
									GWT.log("FETCHED:"+r.getLastModifiedSince(), null);
976
								}
977
								folderItem.getOtherUserResource().setFiles(result);
978
								folderItem.getOtherUserResource().setFilesExpanded(true);
979
								updateFileCache(clearSelection, newFilename);
980
							}
981

  
982
							@Override
983
							public void onError(String p, Throwable throwable) {
984
								if(throwable instanceof RestException)
985
									GSS.get().displayError("Unable to retrieve file details:"+((RestException)throwable).getHttpStatusText());
986
							}
987

  
988
							@Override
989
							public void onError(Throwable t) {
990
								GWT.log("", t);
991
								GSS.get().displayError("Unable to fetch files for folder " + folderItem.getFolderResource().getName());
992
							}
993

  
994
						};
995
						DeferredCommand.addCommand(getFiles);
909
						folderItem.getOtherUserResource().setFilesExpanded(true);
910
						updateFileCache(clearSelection, newFilename);
911
						
996 912
					}
997 913

  
998 914
					@Override
b/src/gr/ebs/gss/client/rest/resource/FileResource.java
76 76
	String path;
77 77

  
78 78
	String folderName;
79

  
79
	Boolean shared;
80
	
81
	
82
	/**
83
	 * Retrieve the shared.
84
	 *
85
	 * @return the shared
86
	 */
87
	public Boolean getShared() {
88
		return shared;
89
	}
90
	
91
	
92
	/**
93
	 * Modify the shared.
94
	 *
95
	 * @param shared the shared to set
96
	 */
97
	public void setShared(Boolean shared) {
98
		this.shared = shared;
99
	}
100
	
80 101
	/**
81 102
	 * Retrieve the folderName.
82 103
	 *
......
415 436
		versioned = unmarshallBoolean(metadata, "versioned");
416 437
		createdBy = unmarshallString(metadata, "createdBy");
417 438
		modifiedBy = unmarshallString(metadata, "modifiedBy");
418

  
439
		setShared(unmarshallBoolean(metadata, "shared"));
419 440
		if (metadata.get("version") != null)
420 441
			version = new Integer(metadata.get("version").toString());
421 442

  
b/src/gr/ebs/gss/client/rest/resource/FolderResource.java
80 80
	private boolean filesExpanded=false;
81 81

  
82 82
	boolean readForAll;
83
	
84
	Boolean shared;
85
	
86
	
87
	/**
88
	 * Retrieve the shared.
89
	 *
90
	 * @return the shared
91
	 */
92
	public Boolean getShared() {
93
		return shared;
94
	}
95
	
96
	
97
	/**
98
	 * Modify the shared.
99
	 *
100
	 * @param shared the shared to set
101
	 */
102
	public void setShared(Boolean shared) {
103
		this.shared = shared;
104
	}
83 105

  
84 106
	/**
85 107
	 * Modify the parentName.
......
342 364
		createdBy = unmarshallString(json, "createdBy");
343 365
		modifiedBy = unmarshallString(json, "modifiedBy");
344 366
		deleted = unmarshallBoolean(json, "deleted");
367
		shared = unmarshallBoolean(json, "shared");
345 368
		readForAll = unmarshallBoolean(json, "readForAll");
346 369
		if (deleted)
347 370
			GWT.log("FOUND A DELETED FOLDER:" + name, null);
......
402 425
						String fowner = unmarshallString(fo, "owner");
403 426
						String fcontent = unmarshallString(fo, "content");
404 427
						String fpath = unmarshallString(fo, "path");
428
						Boolean fshared = unmarshallBoolean(fo, "shared");
405 429
						fpath = URL.decodeComponent(fpath);
406 430
						Integer fversion = null;
407 431
						if (fo.get("version") != null)
......
425 449
						fs.setVersion(fversion);
426 450
						fs.setContentLength(fsize);
427 451
						fs.setDeleted(fdeleted);
452
						fs.setShared(fshared);
428 453
						fs.setCreationDate(fcreationDate);
429 454
						fs.setModificationDate(fmodificationDate);
430 455
						fs.setContentType(fcontent);
b/src/gr/ebs/gss/client/rest/resource/OtherUserResource.java
198 198
						fs.setDeleted(fdeleted);
199 199
						fs.setCreationDate(fcreationDate);
200 200
						fs.setModificationDate(fmodificationDate);
201
						fs.setShared(unmarshallBoolean(fo,"shared"));
201 202
						fs.setContentType(fcontent);
202 203
						files.add(fs);
203 204
					}
b/src/gr/ebs/gss/client/rest/resource/SharedResource.java
180 180
						fs.setVersion(fversion);
181 181
						fs.setContentLength(fsize);
182 182
						fs.setDeleted(fdeleted);
183
						fs.setShared(unmarshallBoolean(fo,"shared"));
183 184
						fs.setCreationDate(fcreationDate);
184 185
						fs.setModificationDate(fmodificationDate);
185 186
						fs.setContentType(fcontent);
b/src/gr/ebs/gss/server/admin/AdminServiceImpl.java
172 172
		getService().removeUser(userId);
173 173

  
174 174
	}
175

  
176
	@Override
177
	public void fixSharedFlagForAllFoldersAndFiles() throws RpcException {
178
		getService().fixSharedFlagForAllFoldersAndFiles();		
179
	}
175 180
}
b/src/gr/ebs/gss/server/domain/FileHeader.java
38 38
import javax.persistence.ManyToOne;
39 39
import javax.persistence.OneToMany;
40 40
import javax.persistence.OrderBy;
41
import javax.persistence.PrePersist;
42
import javax.persistence.PreUpdate;
41 43
import javax.persistence.Table;
42 44
import javax.persistence.UniqueConstraint;
43 45
import javax.persistence.Version;
......
144 146
	 */
145 147
	@OneToMany(cascade = CascadeType.ALL)
146 148
	private Set<Permission> permissions = new HashSet<Permission>();
147

  
149
	
150
	@Column(columnDefinition=" boolean DEFAULT false")
151
	private Boolean shared;
148 152
	/**
149 153
	 * Retrieve the ID.
150 154
	 *
......
444 448
		f.setMimeType(currentBody.getMimeType());
445 449
		f.setDeleted(deleted);
446 450
		f.setReadForAll(readForAll);
451
		f.setShared(getShared());
447 452
		List<String> tags = new ArrayList<String>();
448 453
		for (FileTag tag : fileTags)
449 454
			tags.add(tag.getTag());
......
544 549
			total += body.getFileSize();
545 550
		return total;
546 551
	}
552
	
553
	/**
554
	 * Retrieve the shared.
555
	 *
556
	 * @return the shared
557
	 */
558
	public Boolean getShared() {
559
		if(shared==null)
560
			return false;
561
		return shared;
562
	}
563
	
564
	
565
	/**
566
	 * Modify the shared.
567
	 *
568
	 * @param shared the shared to set
569
	 */
570
	public void setShared(Boolean shared) {
571
		this.shared = shared;
572
	}
573
	
574
	@PrePersist
575
	@PreUpdate
576
	private void fixSharedFlag(){
577
		if(isReadForAll()||getPermissions().size()>1)
578
			shared=true;
579
		else
580
			shared=false;
581
	}
547 582
}
548 583

  
b/src/gr/ebs/gss/server/domain/Folder.java
38 38
import javax.persistence.ManyToOne;
39 39
import javax.persistence.OneToMany;
40 40
import javax.persistence.OrderBy;
41
import javax.persistence.PrePersist;
42
import javax.persistence.PreUpdate;
41 43
import javax.persistence.Version;
42 44

  
43 45
import org.hibernate.annotations.Cache;
......
127 129
	 */
128 130
	@Column(columnDefinition=" boolean DEFAULT false")
129 131
	private boolean readForAll=false;
132
	
133
	@Column(columnDefinition=" boolean DEFAULT false")
134
	private Boolean shared;
130 135

  
131 136
	/**
132 137
	 * Retrieve the ID.
......
383 388
		f.setAuditInfo(auditInfo.getDTO());
384 389
		f.setDeleted(deleted);
385 390
		f.setReadForAll(readForAll);
391
		f.setShared(getShared());
386 392
		if (parent != null)
387 393
			f.setParent(parent.getDTO(0));
388 394
		for (Folder subfolder : subfolders)
......
536 542
	public boolean isReadForAll() {
537 543
		return readForAll;
538 544
	}
545
	
546
	/**
547
	 * Retrieve the shared.
548
	 *
549
	 * @return the shared
550
	 */
551
	public Boolean getShared() {
552
		if(shared==null)
553
			return false;
554
		return shared;
555
	}
556
	
557
	
558
	/**
559
	 * Modify the shared.
560
	 *
561
	 * @param shared the shared to set
562
	 */
563
	public void setShared(Boolean shared) {
564
		this.shared = shared;
565
	}
566
	
567
	@PrePersist
568
	@PreUpdate
569
	private void fixSharedFlag(){
570
		if(isReadForAll()||getPermissions().size()>1)
571
			shared=true;
572
		else
573
			shared=false;
574
	}
539 575

  
540 576
}
b/src/gr/ebs/gss/server/domain/dto/FileHeaderDTO.java
22 22
import java.util.List;
23 23
import java.util.Set;
24 24

  
25
import javax.persistence.Column;
26

  
25 27
import com.google.gwt.i18n.client.NumberFormat;
26 28

  
27 29
/**
......
115 117
	 * Anyone can read this file?
116 118
	 */
117 119
	private boolean readForAll=false;
120
	
121
	
122
	private Boolean shared=false;
118 123
	/**
119 124
	 * @return the id
120 125
	 */
......
411 416
	public Set<PermissionDTO> getPermissions() {
412 417
		return permissions;
413 418
	}
419
	
420
	/**
421
	 * Retrieve the shared.
422
	 *
423
	 * @return the shared
424
	 */
425
	public Boolean getShared() {
426
		return shared;
427
	}
428
	
429
	
430
	/**
431
	 * Modify the shared.
432
	 *
433
	 * @param shared the shared to set
434
	 */
435
	public void setShared(Boolean shared) {
436
		this.shared = shared;
437
	}
414 438
}
b/src/gr/ebs/gss/server/domain/dto/FolderDTO.java
77 77
	 * Anyone can read this folder?
78 78
	 */
79 79
	private boolean readForAll=false;
80
	
81
	private Boolean shared=false;
80 82

  
81 83
	/**
82 84
	 * @return the id
......
238 240
	public boolean isReadForAll() {
239 241
		return readForAll;
240 242
	}
241

  
243
	
244
	
245
	/**
246
	 * Retrieve the shared.
247
	 *
248
	 * @return the shared
249
	 */
250
	public Boolean getShared() {
251
		return shared;
252
	}
253
	
254
	
255
	/**
256
	 * Modify the shared.
257
	 *
258
	 * @param shared the shared to set
259
	 */
260
	public void setShared(Boolean shared) {
261
		this.shared = shared;
262
	}
242 263
}
b/src/gr/ebs/gss/server/ejb/AdminAPI.java
80 80

  
81 81
	public void removeUser(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
82 82

  
83
	/**
84
	 * 
85
	 */
86
	void fixSharedFlagForAllFoldersAndFiles();
87

  
83 88
}
b/src/gr/ebs/gss/server/ejb/AdminAPIBean.java
539 539
			}
540 540
		}
541 541
	}
542
	@Override
543
	public void fixSharedFlagForAllFoldersAndFiles(){
544
		dao.fixSharedFlagForAllFoldersAndFiles();
545
	}
542 546
}
b/src/gr/ebs/gss/server/ejb/GSSDAO.java
503 503
	 */
504 504
	int deletePermissionsNotCorrespondingToFilesAndFolders(Long userId);
505 505

  
506
	/**
507
	 * 
508
	 */
509
	void fixSharedFlagForAllFoldersAndFiles();
510

  
506 511
}
b/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
741 741
	public int deletePermissionsNotCorrespondingToFilesAndFolders(Long userId){
742 742
		return manager.createNativeQuery("delete from permission where user_id=:userId and id not in(select permissions_id from fileheader_permission) and id not in(select permissions_id from folder_permission)").setParameter("userId", userId).executeUpdate();
743 743
	}
744
	@Override
745
	public void fixSharedFlagForAllFoldersAndFiles(){
746
		List<Folder> folders = manager.createQuery("select f from Folder f").getResultList();
747
		for(Folder f : folders){
748
			if(f.isReadForAll()||f.getPermissions().size()>1){
749
				f.setShared(true);
750
				update(f);
751
			}
752
		}
753
		List<FileHeader> files = manager.createQuery("select f from FileHeader f").getResultList();
754
		for(FileHeader f : files){
755
			if(f.isReadForAll()||f.getPermissions().size()>1){
756
				f.setShared(true);
757
				update(f);
758
			}
759
		}
760
	}
744 761
}
b/src/gr/ebs/gss/server/rest/FilesHandler.java
1916 1916
					put("createdBy", folder.getAuditInfo().getCreatedBy().getUsername()).
1917 1917
					put("creationDate", folder.getAuditInfo().getCreationDate().getTime()).
1918 1918
					put("deleted", folder.isDeleted()).
1919
					put("shared", folder.getShared()).
1919 1920
					put("readForAll", folder.isReadForAll());
1920 1921

  
1921 1922
			if (folder.getAuditInfo().getModifiedBy() != null)
......
1946 1947
					put("version", f.getVersion()).
1947 1948
					put("content", f.getMimeType()).
1948 1949
					put("size", f.getFileSize()).
1950
					put("shared", f.getShared()).
1951
					put("versioned",f.isVersioned()).
1949 1952
					put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
1950 1953
					put("path", f.getFolder().getPath()).
1951 1954
					put("uri", getApiRoot() + f.getURI());
......
2036 2039
					put("versioned", file.isVersioned()).
2037 2040
					put("version", oldBody != null ? oldBody.getVersion() : file.getVersion()).
2038 2041
					put("readForAll", file.isReadForAll()).
2042
					put("shared", file.getShared()).
2039 2043
					put("tags", renderJson(file.getTags())).
2040 2044
					put("path", file.getFolder().getPath()).
2041 2045
    				put("uri", getApiRoot() + file.getURI()).
......
2174 2178
			int percent = new Long(bytesTransferred * 100 / fileSize).intValue();
2175 2179
			System.out.println("-->"+percent+ " "+(percent % TRACK_PROGRESS_PERCENT));
2176 2180
			if (percent < 5 || percent % TRACK_PROGRESS_PERCENT == 0 )
2177
				//if (percent != percentLogged){
2178
					//percentLogged = percent;
2181
				if (percent != percentLogged){
2182
					percentLogged = percent;
2179 2183
					try {
2180 2184
						if (userId != null && filename != null)
2181 2185
							service.createFileUploadProgress(userId, filename, bytesTransferred, fileSize);
......
2183 2187
						// Swallow the exception since it is going to be caught
2184 2188
						// by previously called methods
2185 2189
					}
2186
				//}
2190
				}
2187 2191
		}
2188 2192
	}
2189 2193

  
b/src/gr/ebs/gss/server/rest/OthersHandler.java
130 130
    					put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
131 131
    					put("modificationDate", f.getAuditInfo().getModificationDate().getTime()).
132 132
    					put("path", f.getFolder().getPath()).
133
    					put("shared", f.getShared()).
134
    					put("versioned",f.isVersioned()).
133 135
        				put("uri", getApiRoot() + f.getURI());
134 136
        			files.add(j);
135 137
    	    	}
b/src/gr/ebs/gss/server/rest/SharedHandler.java
95 95
    					put("size", f.getFileSize()).
96 96
    					put("content", f.getMimeType()).
97 97
    					put("path", f.getFolder().getPath()).
98
    					put("shared", f.getShared()).
99
    					put("versioned",f.isVersioned()).
98 100
    					put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
99 101
    					put("modificationDate", f.getAuditInfo().getModificationDate().getTime()).
100 102
        				put("uri", getApiRoot() + f.getURI());

Also available in: Unified diff