root / web_client / src / gr / grnet / pithos / web / client / clipboard / ClipboardItem.java @ 58777026
History | View | Annotate | Download (4 kB)
1 |
/*
|
---|---|
2 |
* Copyright 2011 GRNET S.A. All rights reserved.
|
3 |
*
|
4 |
* Redistribution and use in source and binary forms, with or
|
5 |
* without modification, are permitted provided that the following
|
6 |
* conditions are met:
|
7 |
*
|
8 |
* 1. Redistributions of source code must retain the above
|
9 |
* copyright notice, this list of conditions and the following
|
10 |
* disclaimer.
|
11 |
*
|
12 |
* 2. Redistributions in binary form must reproduce the above
|
13 |
* copyright notice, this list of conditions and the following
|
14 |
* disclaimer in the documentation and/or other materials
|
15 |
* provided with the distribution.
|
16 |
*
|
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
* POSSIBILITY OF SUCH DAMAGE.
|
29 |
*
|
30 |
* The views and conclusions contained in the software and
|
31 |
* documentation are those of the authors and should not be
|
32 |
* interpreted as representing official policies, either expressed
|
33 |
* or implied, of GRNET S.A.
|
34 |
*/
|
35 |
package gr.grnet.pithos.web.client.clipboard; |
36 |
|
37 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
38 |
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper; |
39 |
import gr.grnet.pithos.web.client.rest.resource.GroupUserResource; |
40 |
|
41 |
import java.io.Serializable; |
42 |
import java.util.List; |
43 |
|
44 |
|
45 |
public class ClipboardItem implements Serializable{ |
46 |
private int operation; |
47 |
private FileResource file;
|
48 |
private List<FileResource> files; |
49 |
private RestResourceWrapper folderResource;
|
50 |
private GroupUserResource user;
|
51 |
|
52 |
public ClipboardItem(int anOperation, List<FileResource> theFiles){ |
53 |
operation = anOperation; |
54 |
files = theFiles; |
55 |
} |
56 |
|
57 |
public ClipboardItem(int anOperation, FileResource aFile){ |
58 |
operation = anOperation; |
59 |
file = aFile; |
60 |
} |
61 |
|
62 |
public ClipboardItem(int anOperation, RestResourceWrapper folder){ |
63 |
operation = anOperation; |
64 |
folderResource = folder; |
65 |
} |
66 |
public ClipboardItem(int anOperation, GroupUserResource aUser){ |
67 |
operation = anOperation; |
68 |
user = aUser; |
69 |
} |
70 |
|
71 |
public ClipboardItem(GroupUserResource aUser){
|
72 |
operation = Clipboard.COPY;
|
73 |
user = aUser; |
74 |
} |
75 |
|
76 |
public ClipboardItem(List<FileResource> theFiles){ |
77 |
operation = Clipboard.COPY;
|
78 |
files = theFiles; |
79 |
} |
80 |
|
81 |
public ClipboardItem(FileResource aFile){
|
82 |
operation = Clipboard.COPY;
|
83 |
file = aFile; |
84 |
} |
85 |
|
86 |
public ClipboardItem(RestResourceWrapper folder){
|
87 |
operation = Clipboard.COPY;
|
88 |
folderResource = folder; |
89 |
} |
90 |
|
91 |
/**
|
92 |
* Retrieve the user.
|
93 |
*
|
94 |
* @return the user
|
95 |
*/
|
96 |
public GroupUserResource getUser() {
|
97 |
return user;
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* Retrieve the operation.
|
102 |
*
|
103 |
* @return the operation
|
104 |
*/
|
105 |
public int getOperation() { |
106 |
return operation;
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* Retrieve the file.
|
111 |
*
|
112 |
* @return the file
|
113 |
*/
|
114 |
public FileResource getFile() {
|
115 |
return file;
|
116 |
} |
117 |
|
118 |
/**
|
119 |
* Retrieve the files.
|
120 |
*
|
121 |
* @return the files
|
122 |
*/
|
123 |
public List<FileResource> getFiles() { |
124 |
return files;
|
125 |
} |
126 |
|
127 |
/**
|
128 |
* checks whether the clipboard item is a file or folder
|
129 |
*/
|
130 |
public boolean isFileOrFolder(){ |
131 |
if(file !=null || files != null || folderResource != null) |
132 |
return true; |
133 |
return false; |
134 |
} |
135 |
|
136 |
/**
|
137 |
* checks whether the clipboard item is a file (or files)
|
138 |
*/
|
139 |
public boolean isFile() { |
140 |
if(file !=null || files != null) |
141 |
return true; |
142 |
return false; |
143 |
} |
144 |
|
145 |
public boolean isUser(){ |
146 |
if( user!=null ) |
147 |
return true; |
148 |
return false; |
149 |
} |
150 |
|
151 |
/**
|
152 |
* Retrieve the folderResource.
|
153 |
*
|
154 |
* @return the folderResource
|
155 |
*/
|
156 |
public RestResourceWrapper getRestResourceWrapper() {
|
157 |
return folderResource;
|
158 |
} |
159 |
} |