import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.MenuBar;
*/
public interface Images extends FileMenu.Images, EditMenu.Images {
- @Resource("gr/ebs/gss/resources/mimetypes/document_menu.png")
+ @Resource("gr/ebs/gss/resources/mimetypes/document.png")
AbstractImagePrototype fileContextMenu();
@Resource("gr/ebs/gss/resources/doc_versions.png")
@Resource("gr/ebs/gss/resources/group.png")
AbstractImagePrototype sharing();
- /**
- * Will bundle the file 'border_remove.png' residing in the package
- * 'gr.ebs.gss.resources'.
- *
- * @return the image prototype
- */
@Resource("gr/ebs/gss/resources/border_remove.png")
AbstractImagePrototype unselectAll();
}
*
* @param newImages the image bundle passed on by the parent object
*/
- public FileContextMenu(final Images newImages, boolean isTrash, boolean isEmpty) {
+ public FileContextMenu(Images newImages, boolean isTrash, boolean isEmpty) {
// The popup's constructor's argument is a boolean specifying that it
// auto-close itself when the user clicks outside of it.
super(true);
setAnimationEnabled(true);
images = newImages;
- // A dummy command that we will execute from unimplemented leaves.
- final Command cmd = new Command() {
-
- public void execute() {
- hide();
- Window.alert("You selected a menu item!");
- }
- };
-
// The command that does some validation before downloading a file.
- final Command downloadCmd = new Command() {
+ Command downloadCmd = new Command() {
public void execute() {
hide();
}
};
- final MenuBar contextMenu = new MenuBar(true);
+ MenuBar contextMenu = new MenuBar(true);
if (isEmpty) {
if (GSS.get().getFolders().getCurrent() != null)
if (GSS.get().getFolders().isFileItem(GSS.get().getFolders().getCurrent()))
contextMenu.addItem(deleteItem);
contextMenu.addItem(sharingItem);
contextMenu.addItem(propItem);
-
}
-
add(contextMenu);
-
}
void onMultipleSelection() {
sharingItem.setVisible(false);
}
- /*
- * (non-Javadoc)
- *
- * @see com.google.gwt.user.client.ui.ClickListener#onClick(com.google.gwt.user.client.ui.Widget)
- */
- public void onClick(final Widget sender) {
-
+ public void onClick(Widget sender) {
if (GSS.get().getCurrentSelection() != null)
if (GSS.get().getCurrentSelection() instanceof FileResource) {
FileResource res = (FileResource) GSS.get().getCurrentSelection();
menu.setPopupPosition(left, top);
menu.show();
} else if (GSS.get().getCurrentSelection() instanceof List) {
- List<FileResource> dto = (List<FileResource>) GSS.get().getCurrentSelection();
FileContextMenu menu;
if (GSS.get().getFolders().isTrashItem(GSS.get().getFolders().getCurrent()))
menu = new FileContextMenu(images, true, false);
}
}
- public void onEvent(final Event event) {
-
+ public void onEvent(Event event) {
if (GSS.get().getCurrentSelection() != null)
if (GSS.get().getCurrentSelection() instanceof FileResource) {
FileResource res = (FileResource) GSS.get().getCurrentSelection();
menu.setPopupPosition(left, top);
menu.show();
} else if (GSS.get().getCurrentSelection() instanceof List) {
- List<FileResource> dto = (List<FileResource>) GSS.get().getCurrentSelection();
FileContextMenu menu;
if (GSS.get().getFolders().isTrashItem(GSS.get().getFolders().getCurrent()))
menu = new FileContextMenu(images, true, false);
\r
@Resource("gr/ebs/gss/resources/desc.png")\r
AbstractImagePrototype desc();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/kcmfontinst.png")\r
+ AbstractImagePrototype wordprocessor();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/log.png")\r
+ AbstractImagePrototype spreadsheet();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/kpresenter_kpr.png")\r
+ AbstractImagePrototype presentation();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/acroread.png")\r
+ AbstractImagePrototype pdf();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/image.png")\r
+ AbstractImagePrototype image();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/video2.png")\r
+ AbstractImagePrototype video();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/knotify.png")\r
+ AbstractImagePrototype audio();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/html.png")\r
+ AbstractImagePrototype html();\r
+\r
+ @Resource("gr/ebs/gss/resources/mimetypes/ark2.png")\r
+ AbstractImagePrototype zip();\r
}\r
\r
/**\r
*\r
* @param _images\r
*/\r
- public FileList(final Images _images) {\r
+ public FileList(Images _images) {\r
images = _images;\r
\r
prevButton.addClickListener(this);\r
table.addTableListener(this);\r
\r
// Create the 'navigation' bar at the upper-right.\r
- final HorizontalPanel innerNavBar = new HorizontalPanel();\r
+ HorizontalPanel innerNavBar = new HorizontalPanel();\r
innerNavBar.setStyleName("gss-ListNavBar");\r
innerNavBar.setSpacing(8);\r
innerNavBar.add(prevButton);\r
}\r
}\r
\r
+ @Override\r
public void onBrowserEvent(Event event) {\r
if (files == null || files.size() == 0) {\r
if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && selectedRows.size() == 0) {\r
FileResource file = getSelectedFiles().get(0);\r
String dateString = AbstractRestCommand.getDate();\r
String resource = file.getPath().substring(GSS.GSS_REST_PATH.length() - 1, file.getPath().length());\r
- String sig = GSS.get().getCurrentUserResource().getUsername() + " " + AbstractRestCommand.calculateSig("GET", dateString, resource, AbstractRestCommand.base64decode(GSS.get()\r
- .getToken()));\r
+ String sig = GSS.get().getCurrentUserResource().getUsername() + " " +\r
+ AbstractRestCommand.calculateSig("GET", dateString, resource,\r
+ AbstractRestCommand.base64decode(GSS.get().getToken()));\r
Window.open(file.getPath() + "?Authorization=" + URL.encodeComponent(sig) + "&Date=" + URL.encodeComponent(dateString), "_blank", "");\r
event.preventDefault();\r
return;\r
event.preventDefault();\r
}\r
}\r
-\r
super.onBrowserEvent(event);\r
}\r
\r
UserResource user = GSS.get().getCurrentUserResource();\r
if (user == null)\r
return !DONE;\r
- updateFileCache(true /*clear selection*/);\r
+ // Update cache and clear selection.\r
+ updateFileCache(true);\r
return DONE;\r
}\r
\r
- /*\r
- * (non-Javadoc)\r
- *\r
- * @see com.google.gwt.user.client.ui.TableListener#onCellClicked(com.google.gwt.user.client.ui.SourcesTableEvents,\r
- * int, int)\r
- */\r
- public void onCellClicked(@SuppressWarnings("unused") SourcesTableEvents sender, int row, @SuppressWarnings("unused") int cell) {\r
+ public void onCellClicked(SourcesTableEvents sender, int row, int cell) {\r
// Select the row that was clicked (-1 to account for header row).\r
if (row > folderFileCount)\r
return;\r
if (clickShift) {\r
- GWT.log("ROW is:" + row + " fs:" + firstShift, null);\r
+ GWT.log("Row is: " + row + " fs: " + firstShift, null);\r
if (firstShift == -1)\r
firstShift = row;\r
else if (row > firstShift) {\r
styleRow(row, true);\r
styleRow(row - 1, true);\r
} else if (row < firstShift) {\r
- GWT.log("ROW is:" + row + " fs:" + firstShift, null);\r
+ GWT.log("Row is:" + row + " fs:" + firstShift, null);\r
clearSelectedRows();\r
\r
for (int i = firstShift; i >= row - 1; i--) {\r
makeRowDraggable(row);\r
contextMenu.setFiles(getSelectedFiles());\r
}\r
-\r
} else if (row > 0)\r
selectRow(row - 1);\r
-\r
}\r
\r
/**\r
* files.\r
*/\r
private void initTable() {\r
-\r
nameLabel = new HTML("Name");\r
nameLabel.addClickListener(new ClickListener() {\r
\r
public void onClick(Widget sender) {\r
sortFiles("name");\r
update();\r
-\r
}\r
\r
});\r
public void onClick(Widget sender) {\r
sortFiles("version");\r
update();\r
-\r
}\r
\r
});\r
public void onClick(Widget sender) {\r
sortFiles("size");\r
update();\r
-\r
}\r
\r
});\r
public void onClick(Widget sender) {\r
sortFiles("date");\r
update();\r
-\r
}\r
\r
});\r
public void onClick(Widget sender) {\r
sortFiles("owner");\r
update();\r
-\r
}\r
\r
});\r
public void onClick(Widget sender) {\r
sortFiles("path");\r
update();\r
-\r
}\r
\r
});\r
}\r
prevButton.setVisible(false);\r
nextButton.setVisible(false);\r
-\r
}\r
\r
/**\r
selectedRows.remove(i);\r
styleRow(row, false);\r
} else {\r
- //for (int r : selectedRows) int prow = r - startIndex;\r
- //table.setWidget(prow + 1, 0, images.document().createImage());\r
selectedRows.add(startIndex + row);\r
styleRow(row, true);\r
-\r
}\r
else if (selectedRows.size() == 1 && selectedRows.contains(row))\r
clearSelectedRows();\r
GSS.get().setCurrentSelection(getSelectedFiles());\r
contextMenu.setFiles(getSelectedFiles());\r
makeRowDraggable(row+1);\r
-\r
}\r
-\r
}\r
\r
public List<FileResource> getSelectedFiles() {\r
break;\r
// Add a new row to the table, then set each of its columns to the\r
// proper values.\r
- table.setWidget(i, 0, images.document().createImage());\r
- FileResource fileHeader = files.get(startIndex + i - 1);\r
+ FileResource file = files.get(startIndex + i - 1);\r
+ table.setWidget(i, 0, getFileIcon(file).createImage());\r
table.getRowFormatter().addStyleName(i, "gss-fileRow");\r
\r
- table.setHTML(i, 1, fileHeader.getName());\r
- table.setText(i, 2, fileHeader.getOwner());\r
- table.setText(i, 3, URL.decodeComponent(fileHeader .getPath()\r
- .substring(GSS.GSS_REST_PATH.length() + fileHeader.getOwner().length() + 6, fileHeader .getPath()\r
- .length() - fileHeader .getName()\r
- .length())));\r
- table.setText(i, 4, String.valueOf(fileHeader.getVersion()));\r
- table.setText(i, 5, String.valueOf(fileHeader.getFileSizeAsString()));\r
+ table.setHTML(i, 1, file.getName());\r
+ table.setText(i, 2, file.getOwner());\r
+ table.setText(i, 3, URL.decodeComponent(file.getPath().substring(\r
+ GSS.GSS_REST_PATH.length() + file.getOwner().length() + 6,\r
+ file.getPath().length() - file.getName().length())));\r
+ table.setText(i, 4, String.valueOf(file.getVersion()));\r
+ table.setText(i, 5, String.valueOf(file.getFileSizeAsString()));\r
final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");\r
- table.setText(i, 6, formatter.format(fileHeader.getCreationDate()));\r
- folderTotalSize += fileHeader.getContentLength();\r
+ table.setText(i, 6, formatter.format(file.getCreationDate()));\r
+ folderTotalSize += file.getContentLength();\r
}\r
\r
// Clear any remaining slots.\r
}\r
\r
/**\r
+ * Return the proper icon based on the MIME type of the file.\r
+ *\r
+ * @param file\r
+ * @return the icon\r
+ */\r
+ private AbstractImagePrototype getFileIcon(FileResource file) {\r
+ String mimetype = file.getContentType();\r
+ if (mimetype == null)\r
+ return images.document();\r
+ else if ("application/pdf".equalsIgnoreCase(mimetype))\r
+ return images.pdf();\r
+ else if ("application/vnd.ms-excel".equalsIgnoreCase(mimetype))\r
+ return images.spreadsheet();\r
+ else if ("application/msword".equalsIgnoreCase(mimetype))\r
+ return images.wordprocessor();\r
+ else if ("application/vnd.ms-powerpoint".equalsIgnoreCase(mimetype))\r
+ return images.presentation();\r
+ else if ("application/zip".equalsIgnoreCase(mimetype))\r
+ return images.zip();\r
+ else if ("text/html".equalsIgnoreCase(mimetype))\r
+ return images.html();\r
+ else if (mimetype.startsWith("image/"))\r
+ return images.image();\r
+ else if (mimetype.startsWith("video/"))\r
+ return images.video();\r
+ else if (mimetype.startsWith("audio/"))\r
+ return images.audio();\r
+ else\r
+ return images.document();\r
+ }\r
+\r
+ /**\r
* update status panel with currently showing file stats\r
*/\r
public void updateCurrentlyShowingStats() {\r
// Fill the rest with empty slots.\r
if (newHeight > table.getOffsetHeight())\r
while (newHeight > table.getOffsetHeight()) {\r
- // table.setHTML(table.getRowCount(), 5, " ");\r
table.resizeRows(table.getRowCount() + 1);\r
GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null);\r
}\r
else\r
while (newHeight < table.getOffsetHeight()) {\r
- // table.setHTML(table.getRowCount(), 5, " ");\r
table.resizeRows(table.getRowCount() - 1);\r
GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null);\r
}\r
\r
ExecuteGet<FolderResource> gf = new ExecuteGet<FolderResource>(FolderResource.class, folderItem.getFolderResource().getPath()) {\r
\r
+ @Override\r
public void onComplete() {\r
folderItem.setUserObject(getResult());\r
updateFileCache(clearSelection);\r
} else if (folderItem.getTrashResource() != null) {\r
ExecuteGet<TrashResource> gt = new ExecuteGet<TrashResource>(TrashResource.class, folderItem.getTrashResource().getPath()) {\r
\r
+ @Override\r
public void onComplete() {\r
folderItem.setUserObject(getResult());\r
updateFileCache(clearSelection);\r
}\r
\r
+ @Override\r
public void onError(Throwable t) {\r
if (t instanceof RestException && (((RestException) t).getHttpStatusCode() == 204 || ((RestException) t).getHttpStatusCode() == 1223)) {\r
folderItem.setUserObject(new TrashResource(folderItem.getTrashResource().getPath()));\r
} else if (folderItem.getSharedResource() != null) {\r
ExecuteGet<SharedResource> gt = new ExecuteGet<SharedResource>(SharedResource.class, folderItem.getSharedResource().getPath()) {\r
\r
+ @Override\r
public void onComplete() {\r
folderItem.setUserObject(getResult());\r
updateFileCache(clearSelection);\r
}\r
\r
+ @Override\r
public void onError(Throwable t) {\r
-\r
GWT.log("", t);\r
GSS.get().displayError("Unable to fetch My Shares resource");\r
-\r
}\r
};\r
DeferredCommand.addCommand(gt);\r
} else if (folderItem.getOtherUserResource() != null) {\r
ExecuteGet<OtherUserResource> gt = new ExecuteGet<OtherUserResource>(OtherUserResource.class, folderItem.getOtherUserResource().getPath()) {\r
\r
+ @Override\r
public void onComplete() {\r
folderItem.setUserObject(getResult());\r
updateFileCache(clearSelection);\r
}\r
\r
+ @Override\r
public void onError(Throwable t) {\r
-\r
GWT.log("", t);\r
GSS.get().displayError("Unable to fetch My Shares resource");\r
-\r
}\r
};\r
DeferredCommand.addCommand(gt);\r
}\r
-\r
} else\r
updateFileCache(clearSelection);\r
}\r
\r
/**\r
* Fill the file cache with data.\r
- *\r
- * @param _files\r
- * @param filePaths the files to set\r
*/\r
public void setFiles(final List<FileResource> _files) {\r
if (_files.size() > 0 && !GSS.get().getFolders().isTrash(GSS.get().getFolders().getCurrent())) {\r
\r
public int compare(FileResource arg0, FileResource arg1) {\r
return arg0.getName().compareTo(arg1.getName());\r
-\r
}\r
\r
});\r
for (int r : selectedRows) {\r
int row = r - startIndex;\r
styleRow(row, false);\r
- //table.setWidget(row + 1, 0, images.document().createImage());\r
}\r
selectedRows.clear();\r
Object sel = GSS.get().getCurrentSelection();\r
\r
private void makeRowDraggable(int row){\r
int contextRow = getWidgetRow(contextMenu, table);\r
- if(contextRow != -1)\r
- table.setWidget(contextRow, 0,images.document().createImage());\r
+ if (contextRow != -1)\r
+ table.setWidget(contextRow, 0, getFileIcon(files.get(contextRow - 1)).createImage());\r
+ contextMenu.setWidget(new HTML(getFileIcon(files.get(row - 1)).getHTML()));\r
table.setWidget(row, 0, contextMenu);\r
}\r
\r
List<FileResource> versions = null;
- private List<FileResource> newVersions = null;
-
final Images images;
final VerticalPanel permPanel = new VerticalPanel();
FilePropertiesDialog container;
- public VersionsList(FilePropertiesDialog container, final Images images, List<FileResource> versions) {
- this.images = images;
- this.container = container;
- this.versions = versions;
- Collections.sort(versions, new Comparator<FileResource>(){
+ public VersionsList(FilePropertiesDialog aContainer, final Images theImages, List<FileResource> theVersions) {
+ images = theImages;
+ container = aContainer;
+ versions = theVersions;
+ Collections.sort(theVersions, new Comparator<FileResource>(){
public int compare(FileResource o1, FileResource o2) {
return o1.getVersion().compareTo(o2.getVersion());
permTable.setText(0, 3, "Size");
permTable.setText(0, 4, "");
permTable.setText(0, 5, "");
- //permTable.setText(0, 6, "");
permTable.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels");
permTable.getFlexCellFormatter().setStyleName(0, 1, "props-toplabels");
permTable.getFlexCellFormatter().setStyleName(0, 2, "props-toplabels");
HTML downloadHtml = new HTML(link[0]+images.download().getHTML()+"<span>View This Version</span>"+link[1]);
permTable.setWidget(i, 4, downloadHtml);
permTable.setWidget(i, 5, restoreVersion);
- //permTable.setWidget(i, 6, removeButton);
permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels");
permTable.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_CENTER);
permTable.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER);
}
for (; i < permTable.getRowCount(); i++)
permTable.removeRow(i);
-
}
void createDownloadLink(String[] link, FileResource file) {
void removeVersion(final FileResource version) {
ExecuteDelete df = new ExecuteDelete(version.getPath()){
+ @Override
public void onComplete() {
toRemove = version;
updateTable();
GSS.get().getFileList().updateFileCache(false, true /*clear selection*/);
}
+ @Override
public void onError(Throwable t) {
GWT.log("", t);
if(t instanceof RestException){
ExecutePost ep = new ExecutePost(selectedFile.getPath()+"?restoreVersion="+version.getVersion(),"",200){
+ @Override
public void onComplete() {
container.hide();
GSS.get().getFileList().updateFileCache(true, true /*clear selection*/);
}
+ @Override
public void onError(Throwable t) {
GWT.log("", t);
if(t instanceof RestException)
GSS.get().displayError("Unable to restore version:"+((RestException)t).getHttpStatusText());
else
GSS.get().displayError("System error restoring version:"+t.getMessage());
-
}
};
DeferredCommand.addCommand(ep);
-
}
private String formatDate(Date date){
DnDFocusPanel nodeHolder;
- /**
- *
- */
public DnDDropController(DnDFocusPanel widget) {
super(widget);
nodeHolder = widget;
}
- /* (non-Javadoc)
- * @see com.allen_sauer.gwt.dnd.client.drop.AbstractDropController#onDrop(com.allen_sauer.gwt.dnd.client.DragContext)
- */
+ @Override
public void onDrop(DragContext context) {
super.onDrop(context);
DnDFocusPanel toDrop = (DnDFocusPanel) context.draggable;
if (toDrop.getItem().getUserObject() != null && toDrop.getItem().getUserObject() instanceof FolderResource) {
FolderResource folderToDrop = (FolderResource) toDrop.getItem().getUserObject();
FolderResource initialFolder = null;
- if (GSS.get().getFolders().isTrash(nodeHolder.getItem())) {
- } else if (nodeHolder.getItem().getUserObject() instanceof FolderResource)
+ if (nodeHolder.getItem().getUserObject() instanceof FolderResource)
initialFolder = (FolderResource) nodeHolder.getItem().getUserObject();
boolean othersShared = false;
if (GSS.get().getFolders().isOthersSharedItem(nodeHolder.getItem()))
* @author kman
*
*/
-public class DnDFocusPanel extends FocusPanel{
+public class DnDFocusPanel extends FocusPanel {
private DnDTreeItem item;
private List<FileResource> files;
- public DnDFocusPanel(Widget widget,DnDTreeItem item){
+ public DnDFocusPanel(Widget widget, DnDTreeItem anItem) {
super(widget);
- this.item = item;
+ item = anItem;
}
public DnDFocusPanel(Widget widget){
super(widget);
-
}
/**
return item;
}
-
-
-
-
-
-
/**
* Retrieve the files.
*
return files;
}
-
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFiles(List<FileResource> files) {
- this.files = files;
+ public void setFiles(List<FileResource> newFiles) {
+ files = newFiles;
}
public HTML cloneHTML(){
* along with GSS. If not, see <http://www.gnu.org/licenses/>.
*/
package gr.ebs.gss.client.rest;
+
import gr.ebs.gss.client.GSS;
import gr.ebs.gss.client.rest.resource.FileResource;
import gr.ebs.gss.client.rest.resource.FolderResource;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.Response;
-
-
/**
* @author kman
- *
*/
public abstract class ExecuteGet<T extends RestResource> extends AbstractRestCommand{
T result = null;
Class<T> aclass;
- public ExecuteGet(Class<T> aclass, String pathToGet){
- this(aclass,pathToGet,true);
+ public ExecuteGet(Class<T> theclass, String pathToGet){
+ this(theclass,pathToGet,true);
}
- public ExecuteGet(Class<T> aclass, String pathToGet, boolean showLoading){
+ public ExecuteGet(Class<T> theclass, String pathToGet, boolean showLoading){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
GSS.get().showLoadingIndicator();
- this.aclass = aclass;
+ this.aclass = theclass;
final String path;
if(pathToGet.indexOf("?") != -1)
path = pathToGet;
handleHeaders(builder, path);
builder.sendRequest("", new RestCallback(path) {
+ @Override
public Object deserialize(Response response) {
return deserializeResponse(path, response);
}
+ @Override
public void handleError(Request request, Throwable exception) {
complete = true;
ExecuteGet.this.onError(exception);
}
+ @Override
public void handleSuccess(Object object) {
result = (T) object;
complete = true;
}
}
- public ExecuteGet(Class<T> aclass, String username , String pathToGet){
- this(aclass,username, pathToGet, true);
+ public ExecuteGet(Class<T> theclass, String username , String pathToGet){
+ this(theclass,username, pathToGet, true);
}
- public ExecuteGet(Class<T> aclass, String username , String pathToGet, boolean showLoading){
+ public ExecuteGet(Class<T> theclass, String username , String pathToGet, boolean showLoading){
setShowLoadingIndicator(showLoading);
if(isShowLoadingIndicator())
GSS.get().showLoadingIndicator();
- this.aclass = aclass;
+ this.aclass = theclass;
final String path = fixPath(pathToGet);
RestRequestBuilder builder = new RestRequestBuilder("GET", path);
handleHeaders(username, builder, path);
builder.sendRequest("", new RestCallback(path) {
+ @Override
public Object deserialize(Response response) {
return deserializeResponse(path, response);
}
+ @Override
public void handleError(Request request, Throwable exception) {
complete = true;
ExecuteGet.this.onError(exception);
}
+ @Override
public void handleSuccess(Object object) {
result = (T) object;
complete = true;
return true;
}
- public Object deserializeResponse(String path, Response response){
+ public Object deserializeResponse(String path, Response response) {
RestResource result1 = null;
if(aclass.equals(FolderResource.class)){
result1 = new FolderResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(FileResource.class)){
result1 = new FileResource(path);
else if(aclass.equals(TrashResource.class)){
result1 = new TrashResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(SharedResource.class)){
result1 = new SharedResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(OthersResource.class)){
result1 = new OthersResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(OtherUserResource.class)){
result1 = new OtherUserResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(GroupResource.class)){
result1 = new GroupResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(GroupUserResource.class)){
result1 = new GroupUserResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(UserResource.class)){
result1 = new UserResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(TagsResource.class)){
result1 = new TagsResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(SearchResource.class)){
result1 = new SearchResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(UserSearchResource.class)){
result1 = new UserSearchResource(path);
result1.createFromJSON(response.getText());
-
}
else if(aclass.equals(UploadStatusResource.class)){
result1 = new UploadStatusResource(path);
result1.createFromJSON(response.getText());
-
}
return result1;
-
}
-
-
}
*/
public class FileResource extends RestResource {
- /**
- * @param path
- */
- public FileResource(String path) {
- super(path);
- // TODO Auto-generated constructor stub
+ public FileResource(String aPath) {
+ super(aPath);
}
String name;
/**
* Modify the name.
*
- * @param name the name to set
+ * @param aName the name to set
*/
- public void setName(String name) {
- this.name = name;
+ public void setName(String aName) {
+ name = aName;
}
/**
/**
* Modify the owner.
*
- * @param owner the owner to set
+ * @param newOwner the owner to set
*/
- public void setOwner(String owner) {
- this.owner = owner;
+ public void setOwner(String newOwner) {
+ owner = newOwner;
}
/**
/**
* Modify the createdBy.
*
- * @param createdBy the createdBy to set
+ * @param aCreatedBy the createdBy to set
*/
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
+ public void setCreatedBy(String aCreatedBy) {
+ createdBy = aCreatedBy;
}
/**
/**
* Modify the modifiedBy.
*
- * @param modifiedBy the modifiedBy to set
+ * @param aModifiedBy the modifiedBy to set
*/
- public void setModifiedBy(String modifiedBy) {
- this.modifiedBy = modifiedBy;
+ public void setModifiedBy(String aModifiedBy) {
+ modifiedBy = aModifiedBy;
}
/**
/**
* Modify the creationDate.
*
- * @param creationDate the creationDate to set
+ * @param aCreationDate the creationDate to set
*/
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
+ public void setCreationDate(Date aCreationDate) {
+ creationDate = aCreationDate;
}
/**
/**
* Modify the modificationDate.
*
- * @param modificationDate the modificationDate to set
+ * @param aModificationDate the modificationDate to set
*/
- public void setModificationDate(Date modificationDate) {
- this.modificationDate = modificationDate;
+ public void setModificationDate(Date aModificationDate) {
+ modificationDate = aModificationDate;
}
/**
/**
* Modify the contentType.
*
- * @param contentType the contentType to set
+ * @param newContentType the contentType to set
*/
- public void setContentType(String contentType) {
- this.contentType = contentType;
+ public void setContentType(String newContentType) {
+ contentType = newContentType;
}
/**
/**
* Modify the contentLength.
*
- * @param contentLength the contentLength to set
+ * @param newContentLength the contentLength to set
*/
- public void setContentLength(Long contentLength) {
- this.contentLength = contentLength;
+ public void setContentLength(Long newContentLength) {
+ contentLength = newContentLength;
}
/**
/**
* Modify the readForAll.
*
- * @param readForAll the readForAll to set
+ * @param newReadForAll the readForAll to set
*/
- public void setReadForAll(boolean readForAll) {
- this.readForAll = readForAll;
+ public void setReadForAll(boolean newReadForAll) {
+ readForAll = newReadForAll;
}
/**
/**
* Modify the versioned.
*
- * @param versioned the versioned to set
+ * @param newVersioned the versioned to set
*/
- public void setVersioned(boolean versioned) {
- this.versioned = versioned;
+ public void setVersioned(boolean newVersioned) {
+ versioned = newVersioned;
}
/**
/**
* Modify the version.
*
- * @param version the version to set
+ * @param aVersion the version to set
*/
- public void setVersion(Integer version) {
- this.version = version;
+ public void setVersion(Integer aVersion) {
+ version = aVersion;
}
/**
/**
* Modify the etag.
*
- * @param etag the etag to set
+ * @param anEtag the etag to set
*/
- public void setEtag(String etag) {
- this.etag = etag;
+ public void setEtag(String anEtag) {
+ etag = anEtag;
}
/**
/**
* Modify the tags.
*
- * @param tags the tags to set
+ * @param newTags the tags to set
*/
- public void setTags(List<String> tags) {
- this.tags = tags;
+ public void setTags(List<String> newTags) {
+ tags = newTags;
}
/**
/**
* Modify the permissions.
*
- * @param permissions the permissions to set
+ * @param newPermissions the permissions to set
*/
- public void setPermissions(Set<PermissionHolder> permissions) {
- this.permissions = permissions;
+ public void setPermissions(Set<PermissionHolder> newPermissions) {
+ permissions = newPermissions;
}
/**
/**
* Modify the deleted.
*
- * @param deleted the deleted to set
+ * @param newDeleted the deleted to set
*/
- public void setDeleted(boolean deleted) {
- this.deleted = deleted;
+ public void setDeleted(boolean newDeleted) {
+ deleted = newDeleted;
}
/**
/**
* Modify the folderURI.
*
- * @param folderURI the folderURI to set
+ * @param aFolderURI the folderURI to set
*/
- public void setFolderURI(String folderURI) {
- this.folderURI = folderURI;
+ public void setFolderURI(String aFolderURI) {
+ folderURI = aFolderURI;
}
+ @Override
public void createFromJSON(String text) {
JSONObject metadata = (JSONObject) JSONParser.parse(text);
name = unmarshallString(metadata, "name");
name = URL.decodeComponent(name);
owner = unmarshallString(metadata, "owner");
+ contentType = unmarshallString(metadata, "content");
readForAll = unmarshallBoolean(metadata, "readForAll");
versioned = unmarshallBoolean(metadata, "versioned");
*/
public class FolderResource extends RestResource {
- /**
- * @param path
- */
- public FolderResource(String path) {
- super(path);
+ public FolderResource(String aPath) {
+ super(aPath);
}
String name;
/**
* Modify the name.
*
- * @param name the name to set
+ * @param aName the name to set
*/
- public void setName(String name) {
- this.name = name;
+ public void setName(String aName) {
+ name = aName;
}
/**
/**
* Modify the owner.
*
- * @param owner the owner to set
+ * @param anOwner the owner to set
*/
- public void setOwner(String owner) {
- this.owner = owner;
+ public void setOwner(String anOwner) {
+ owner = anOwner;
}
/**
/**
* Modify the createdBy.
*
- * @param createdBy the createdBy to set
+ * @param aCreatedBy the createdBy to set
*/
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
+ public void setCreatedBy(String aCreatedBy) {
+ createdBy = aCreatedBy;
}
/**
/**
* Modify the modifiedBy.
*
- * @param modifiedBy the modifiedBy to set
+ * @param aModifiedBy the modifiedBy to set
*/
- public void setModifiedBy(String modifiedBy) {
- this.modifiedBy = modifiedBy;
+ public void setModifiedBy(String aModifiedBy) {
+ modifiedBy = aModifiedBy;
}
/**
/**
* Modify the creationDate.
*
- * @param creationDate the creationDate to set
+ * @param aCreationDate the creationDate to set
*/
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
+ public void setCreationDate(Date aCreationDate) {
+ creationDate = aCreationDate;
}
/**
/**
* Modify the modificationDate.
*
- * @param modificationDate the modificationDate to set
+ * @param aModificationDate the modificationDate to set
*/
- public void setModificationDate(Date modificationDate) {
- this.modificationDate = modificationDate;
+ public void setModificationDate(Date aModificationDate) {
+ modificationDate = aModificationDate;
}
/**
/**
* Modify the filePaths.
*
- * @param filePaths the filePaths to set
+ * @param newFilePaths the filePaths to set
*/
- public void setFilePaths(List<String> filePaths) {
- this.filePaths = filePaths;
+ public void setFilePaths(List<String> newFilePaths) {
+ filePaths = newFilePaths;
}
/**
/**
* Modify the subfolderPaths.
*
- * @param subfolderPaths the subfolderPaths to set
+ * @param newSubfolderPaths the subfolderPaths to set
*/
- public void setSubfolderPaths(List<String> subfolderPaths) {
- this.subfolderPaths = subfolderPaths;
+ public void setSubfolderPaths(List<String> newSubfolderPaths) {
+ subfolderPaths = newSubfolderPaths;
}
/**
/**
* Modify the permissions.
*
- * @param permissions the permissions to set
+ * @param newPermissions the permissions to set
*/
- public void setPermissions(Set<PermissionHolder> permissions) {
- this.permissions = permissions;
+ public void setPermissions(Set<PermissionHolder> newPermissions) {
+ permissions = newPermissions;
}
/**
/**
* Modify the deleted.
*
- * @param deleted the deleted to set
+ * @param newDeleted the deleted to set
*/
- public void setDeleted(boolean deleted) {
- this.deleted = deleted;
+ public void setDeleted(boolean newDeleted) {
+ deleted = newDeleted;
}
public void removeSubfolderPath(String spath) {
/**
* Modify the folders.
*
- * @param folders the folders to set
+ * @param newFolders the folders to set
*/
- public void setFolders(List<FolderResource> folders) {
- this.folders = folders;
+ public void setFolders(List<FolderResource> newFolders) {
+ folders = newFolders;
}
/**
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFiles(List<FileResource> files) {
- this.files = files;
+ public void setFiles(List<FileResource> newFiles) {
+ files = newFiles;
}
/**
/**
* Modify the parentURI.
*
- * @param parentURI the parentURI to set
+ * @param aParentURI the parentURI to set
*/
- public void setParentURI(String parentURI) {
- this.parentURI = parentURI;
+ public void setParentURI(String aParentURI) {
+ parentURI = aParentURI;
}
+ @Override
public void createFromJSON(String text) {
-
JSONObject json = (JSONObject) JSONParser.parse(text);
name = unmarshallString(json, "name");
- // name = URL.decodeComponent(name);
owner = unmarshallString(json, "owner");
parentURI = unmarshallString(json, "parent");
deleted = unmarshallBoolean(json, "deleted");
permission.setModifyACL(unmarshallBoolean(obj, "modifyACL"));
permissions.add(permission);
}
-
}
}
if (json.get("folders") != null) {
folders.add(sub);
subfolderPaths.add(subUri);
}
-
}
}
}
if (fo != null) {
String fname = unmarshallString(fo, "name");
String fowner = unmarshallString(fo, "owner");
+ String fcontent = unmarshallString(fo, "content");
Integer fversion = null;
if (fo.get("version") != null)
fs.setContentLength(fsize);
fs.setDeleted(fdeleted);
fs.setCreationDate(fcreationDate);
+ fs.setContentType(fcontent);
files.add(fs);
}
}
creationDate = new Date(new Long(json.get("creationDate").toString()));
if (json.get("modificationDate") != null)
modificationDate = new Date(new Long(json.get("modificationDate").toString()));
-
}
public String getParent() {
/**
* Modify the needsExpanding.
*
- * @param needsExpanding the needsExpanding to set
+ * @param newNeedsExpanding the needsExpanding to set
*/
- public void setNeedsExpanding(boolean needsExpanding) {
- this.needsExpanding = needsExpanding;
+ public void setNeedsExpanding(boolean newNeedsExpanding) {
+ needsExpanding = newNeedsExpanding;
}
}
*/
public class GroupResource extends RestResource {
- /**
- * @param path
- */
- public GroupResource(String path) {
- super(path);
+ public GroupResource(String aPath) {
+ super(aPath);
}
List<String> userPaths = new ArrayList<String>();
/**
* Modify the userPaths.
*
- * @param userPaths the userPaths to set
+ * @param usernewUaths the userPaths to set
*/
- public void setUserPaths(List<String> userPaths) {
- this.userPaths = userPaths;
+ public void setUserPaths(List<String> usernewUaths) {
+ userPaths = usernewUaths;
}
+ @Override
public void createFromJSON(String text) {
JSONArray array = (JSONArray) JSONParser.parse(text);
if (array != null)
for (int i = 0; i < array.size(); i++)
if(array.get(i).isString() != null)
getUserPaths().add(array.get(i).isString().stringValue());
-
}
public String getName() {
*
*/
public class GroupUserResource extends RestResource{
- /**
- * @param path
- */
- public GroupUserResource(String path) {
- super(path);
+
+ public GroupUserResource(String aPath) {
+ super(aPath);
}
String username;
String name;
String home;
-
-
/**
* Retrieve the username.
*
/**
* Modify the username.
*
- * @param username the username to set
+ * @param aUsername the username to set
*/
- public void setUsername(String username) {
- this.username = username;
+ public void setUsername(String aUsername) {
+ username = aUsername;
}
/**
/**
* Modify the name.
*
- * @param name the name to set
+ * @param aName the name to set
*/
- public void setName(String name) {
- this.name = name;
+ public void setName(String aName) {
+ name = aName;
}
/**
/**
* Modify the home.
*
- * @param home the home to set
+ * @param aHome the home to set
*/
- public void setHome(String home) {
- this.home = home;
+ public void setHome(String aHome) {
+ home = aHome;
}
+ @Override
public void createFromJSON(String text) {
JSONObject json = (JSONObject) JSONParser.parse(text);
name = unmarshallString(json, "name");
*/
public class GroupsResource extends RestResource {
- /**
- * @param path
- */
- public GroupsResource(String path) {
- super(path);
+ public GroupsResource(String aPath) {
+ super(aPath);
}
List<String> groupPaths = new ArrayList<String>();
/**
* Modify the groupPaths.
*
- * @param groupPaths the groupPaths to set
+ * @param newGroupPaths the groupPaths to set
*/
- public void setGroupPaths(List<String> groupPaths) {
- this.groupPaths = groupPaths;
+ public void setGroupPaths(List<String> newGroupPaths) {
+ groupPaths = newGroupPaths;
}
+ @Override
public void createFromJSON(String text) {
JSONArray array = (JSONArray) JSONParser.parse(text);
if (array != null)
getGroupPaths().add(uri);
}
}
-
}
}
*
*/
public class OtherUserResource extends RestResource{
- /**
- * @param path
- */
- public OtherUserResource(String path) {
- super(path);
+ public OtherUserResource(String aPath) {
+ super(aPath);
}
- String username;
-
+ String username;
List<String> filePaths = new LinkedList<String>();
List<String> subfolderPaths = new LinkedList<String>();
List<FolderResource> folders = new ArrayList<FolderResource>();
-
List<FileResource> files = new ArrayList<FileResource>();
-
-
-
/**
* Retrieve the username.
*
/**
* Modify the username.
*
- * @param username the username to set
+ * @param aUsername the username to set
*/
- public void setUsername(String username) {
- this.username = username;
+ public void setUsername(String aUsername) {
+ username = aUsername;
}
/**
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFilePaths(List<String> files) {
- filePaths = files;
+ public void setFilePaths(List<String> newFiles) {
+ filePaths = newFiles;
}
/**
subfolderPaths = subfolders;
}
-
/**
* Retrieve the folders.
*
return folders;
}
-
/**
* Modify the folders.
*
- * @param folders the folders to set
+ * @param newFolders the folders to set
*/
- public void setFolders(List<FolderResource> folders) {
- this.folders = folders;
+ public void setFolders(List<FolderResource> newFolders) {
+ folders = newFolders;
}
-
/**
* Retrieve the files.
*
return files;
}
-
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFiles(List<FileResource> files) {
- this.files = files;
+ public void setFiles(List<FileResource> newFiles) {
+ files = newFiles;
}
+ @Override
public void createFromJSON(String text) {
JSONObject json = (JSONObject) JSONParser.parse(text);
if (json.get("folders") != null) {
folders.add(sub);
subfolderPaths.add(subUri);
}
-
}
}
}
if (fo != null) {
String fname = unmarshallString(fo, "name");
String fowner = unmarshallString(fo, "owner");
- String fvs = unmarshallString(fo, "version");
+ String fcontent = unmarshallString(fo, "content");
Integer fversion = null;
if (fo.get("version") != null)
fversion = new Integer(fo.get("version").toString());
fs.setContentLength(fsize);
fs.setDeleted(fdeleted);
fs.setCreationDate(fcreationDate);
+ fs.setContentType(fcontent);
files.add(fs);
}
}
}
-
}
public String getName(){
*/
public class OthersResource extends RestResource {
- /**
- * @param path
- */
- public OthersResource(String path) {
- super(path);
+ public OthersResource(String aPath) {
+ super(aPath);
}
List<String> others = new ArrayList<String>();
/**
* Modify the others.
*
- * @param others the others to set
+ * @param newOthers the others to set
*/
- public void setOthers(List<String> others) {
- this.others = others;
+ public void setOthers(List<String> newOthers) {
+ others = newOthers;
}
+ @Override
public void createFromJSON(String text) {
JSONArray array = (JSONArray) JSONParser.parse(text);
if (array != null)
getOthers().add(uri);
}
}
-
}
}
/**
* Modify the user.
*
- * @param user the user to set
+ * @param aUser the user to set
*/
- public void setUser(String user) {
- this.user = user;
+ public void setUser(String aUser) {
+ user = aUser;
}
/**
/**
* Modify the group.
*
- * @param group the group to set
+ * @param aGroup the group to set
*/
- public void setGroup(String group) {
- this.group = group;
+ public void setGroup(String aGroup) {
+ group = aGroup;
}
/**
/**
* Modify the read.
*
- * @param read the read to set
+ * @param aRead the read to set
*/
- public void setRead(boolean read) {
- this.read = read;
+ public void setRead(boolean aRead) {
+ read = aRead;
}
/**
/**
* Modify the write.
*
- * @param write the write to set
+ * @param aWrite the write to set
*/
- public void setWrite(boolean write) {
- this.write = write;
+ public void setWrite(boolean aWrite) {
+ write = aWrite;
}
/**
/**
* Modify the modifyACL.
*
- * @param modifyACL the modifyACL to set
+ * @param aModifyACL the modifyACL to set
*/
- public void setModifyACL(boolean modifyACL) {
- this.modifyACL = modifyACL;
+ public void setModifyACL(boolean aModifyACL) {
+ modifyACL = aModifyACL;
}
-
-
}
/**
* Modify the fileCount.
*
- * @param fileCount the fileCount to set
+ * @param aFileCount the fileCount to set
*/
- public void setFileCount(Long fileCount) {
- this.fileCount = fileCount;
+ public void setFileCount(Long aFileCount) {
+ fileCount = aFileCount;
}
/**
/**
* Modify the fileSize.
*
- * @param fileSize the fileSize to set
+ * @param aFileSize the fileSize to set
*/
- public void setFileSize(Long fileSize) {
- this.fileSize = fileSize;
+ public void setFileSize(Long aFileSize) {
+ fileSize = aFileSize;
}
/**
/**
* Modify the quotaLeftSize.
*
- * @param quotaLeftSize the quotaLeftSize to set
+ * @param aQuotaLeftSize the quotaLeftSize to set
*/
- public void setQuotaLeftSize(Long quotaLeftSize) {
- this.quotaLeftSize = quotaLeftSize;
+ public void setQuotaLeftSize(Long aQuotaLeftSize) {
+ quotaLeftSize = aQuotaLeftSize;
}
+
public String getFileSizeAsString() {
if (fileSize < 1024)
return String.valueOf(fileSize) + " B";
public abstract class RestResource implements Serializable{
String path;
-
- /**
- * @param path
- */
- public RestResource(String path) {
+ public RestResource(String aPath) {
super();
- this.path = path;
+ path = aPath;
}
-
-
-
/**
* Retrieve the path.
*
return path;
}
-
-
-
/**
* Modify the path.
*
- * @param path the path to set
+ * @param aPath the path to set
*/
- public void setPath(String path) {
- this.path = path;
+ public void setPath(String aPath) {
+ path = aPath;
}
-
-
public abstract void createFromJSON(String text);
-
protected String unmarshallString(JSONObject obj, String varName){
if(obj.get(varName) != null)
if(obj.get(varName).isString() != null)
*/
public class SearchResource extends RestResource {
- /**
- * @param path
- */
- public SearchResource(String path) {
- super(path);
+ public SearchResource(String aPath) {
+ super(aPath);
}
List<FileResource> files = new ArrayList<FileResource>();
/**
* Modify the files.
*
- * @param filepaths the files to set
+ * @param newFilePaths the files to set
*/
- public void setFilePaths(List<String> filePaths) {
- this.filePaths = filePaths;
+ public void setFilePaths(List<String> newFilePaths) {
+ filePaths = newFilePaths;
}
/**
return files;
}
-
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFiles(List<FileResource> files) {
- this.files = files;
+ public void setFiles(List<FileResource> newFiles) {
+ files = newFiles;
}
+ @Override
public void createFromJSON(String text) {
-
JSONArray subs = JSONParser.parse(text).isArray();
if (subs != null)
for (int i = 0; i < subs.size(); i++) {
if (fo != null) {
String fname = unmarshallString(fo, "name");
String fowner = unmarshallString(fo, "owner");
- String fvs = unmarshallString(fo, "version");
+ String fcontent = unmarshallString(fo, "content");
Integer fversion = null;
if (fo.get("version") != null)
fversion = new Integer(fo.get("version").toString());
fs.setContentLength(fsize);
fs.setDeleted(fdeleted);
fs.setCreationDate(fcreationDate);
+ fs.setContentType(fcontent);
files.add(fs);
}
}
*/
public class SharedResource extends RestResource{
- /**
- * @param path
- */
- public SharedResource(String path) {
- super(path);
+ public SharedResource(String aPath) {
+ super(aPath);
}
-
List<String> filePaths = new LinkedList<String>();
List<String> subfolderPaths = new LinkedList<String>();
List<FolderResource> folders = new ArrayList<FolderResource>();
/**
* Modify the files.
*
- * @param filepaths the files to set
+ * @param newFilePaths the files to set
*/
- public void setFilePaths(List<String> filePaths) {
- this.filePaths = filePaths;
+ public void setFilePaths(List<String> newFilePaths) {
+ filePaths = newFilePaths;
}
/**
}
/**
- * Modify the subfolders.
+ * Modify the subfolder paths.
*
- * @param subfolderPaths the subfolders to set
+ * @param newSubfolderPaths the subfolder paths to set
*/
- public void setSubfolderPaths(List<String> subfolderPaths) {
- this.subfolderPaths = subfolderPaths;
+ public void setSubfolderPaths(List<String> newSubfolderPaths) {
+ subfolderPaths = newSubfolderPaths;
}
-
/**
* Retrieve the folders.
*
return folders;
}
-
/**
* Modify the folders.
*
- * @param folders the folders to set
+ * @param newFolders the folders to set
*/
- public void setFolders(List<FolderResource> folders) {
- this.folders = folders;
+ public void setFolders(List<FolderResource> newFolders) {
+ folders = newFolders;
}
-
/**
* Retrieve the files.
*
return files;
}
-
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFiles(List<FileResource> files) {
- this.files = files;
+ public void setFiles(List<FileResource> newFiles) {
+ files = newFiles;
}
+ @Override
public void createFromJSON(String text) {
JSONObject json = (JSONObject) JSONParser.parse(text);
if (json.get("folders") != null) {
folders.add(sub);
subfolderPaths.add(subUri);
}
-
}
}
}
if (fo != null) {
String fname = unmarshallString(fo, "name");
String fowner = unmarshallString(fo, "owner");
- String fvs = unmarshallString(fo, "version");
+ String fcontent = unmarshallString(fo, "content");
Integer fversion = null;
if (fo.get("version") != null)
fversion = new Integer(fo.get("version").toString());
fs.setContentLength(fsize);
fs.setDeleted(fdeleted);
fs.setCreationDate(fcreationDate);
+ fs.setContentType(fcontent);
files.add(fs);
}
}
}
-
}
-
public List<String> getRootSharedFiles(){
List<String> res = new ArrayList<String>();
for(String f : getFilePaths()){
*/
public class TagsResource extends RestResource{
- /**
- * @param path
- */
- public TagsResource(String path) {
- super(path);
+ public TagsResource(String aPath) {
+ super(aPath);
}
List<String> tags = new ArrayList<String>();
-
/**
* Retrieve the tags.
*
/**
* Modify the tags.
*
- * @param tags the tags to set
+ * @param newTags the tags to set
*/
- public void setTags(List<String> tags) {
- this.tags = tags;
+ public void setTags(List<String> newTags) {
+ tags = newTags;
}
+ @Override
public void createFromJSON(String text) {
JSONArray array = (JSONArray) JSONParser.parse(text);
if(array != null)
for (int i = 0; i < array.size(); i++)
getTags().add(array.get(i).isString().stringValue());
-
}
}
*/
public class TrashResource extends RestResource{
- /**
- * @param path
- */
- public TrashResource(String path) {
- super(path);
+ public TrashResource(String aPath) {
+ super(aPath);
}
List<String> filePaths = new LinkedList<String>();
List<FolderResource> folders = new ArrayList<FolderResource>();
List<FileResource> files = new ArrayList<FileResource>();
-
/**
- * Retrieve the files.
+ * Retrieve the file paths.
*
- * @return the files
+ * @return the file paths
*/
public List<String> getFilePaths() {
return filePaths;
}
/**
- * Modify the files.
+ * Modify the file paths.
*
- * @param filePaths the files to set
+ * @param newFilePaths the file paths to set
*/
- public void setFilePaths(List<String> filePaths) {
- filePaths = filePaths;
+ public void setFilePaths(List<String> newFilePaths) {
+ filePaths = newFilePaths;
}
/**
- * Retrieve the subfolders.
+ * Retrieve the subfolder paths.
*
- * @return the subfolders
+ * @return the subfolder paths
*/
public List<String> getSubfolderPaths() {
return subfolderPaths;
}
/**
- * Modify the subfolders.
+ * Modify the subfolder paths.
*
- * @param subfolders the subfolders to set
+ * @param newSubfolderPaths the subfolders to set
*/
- public void setSubfolderPaths(List<String> subfolderPaths) {
- subfolderPaths = subfolderPaths;
+ public void setSubfolderPaths(List<String> newSubfolderPaths) {
+ subfolderPaths = newSubfolderPaths;
}
/**
* Modify the folders.
*
- * @param folders the folders to set
+ * @param newFolders the folders to set
*/
- public void setFolders(List<FolderResource> folders) {
- this.folders = folders;
+ public void setFolders(List<FolderResource> newFolders) {
+ folders = newFolders;
}
/**
* Modify the files.
*
- * @param files the files to set
+ * @param newFiles the files to set
*/
- public void setFiles(List<FileResource> files) {
- this.files = files;
+ public void setFiles(List<FileResource> newFiles) {
+ files = newFiles;
}
+ @Override
public void createFromJSON(String text) {
JSONObject json = (JSONObject) JSONParser.parse(text);
if (json.get("folders") != null) {
folders.add(sub);
subfolderPaths.add(subUri);
}
-
}
}
}
if (fo != null) {
String fname = unmarshallString(fo, "name");
String fowner = unmarshallString(fo, "owner");
- String fvs = unmarshallString(fo, "version");
+ String fcontent = unmarshallString(fo, "content");
Integer fversion = null;
if (fo.get("version") != null)
fversion = new Integer(fo.get("version").toString());
fs.setContentLength(fsize);
fs.setDeleted(fdeleted);
fs.setCreationDate(fcreationDate);
+ fs.setContentType(fcontent);
files.add(fs);
}
}
long bytesTransferred;
long fileSize;
- /**
- * @param path
- */
- public UploadStatusResource(String path) {
- super(path);
+ public UploadStatusResource(String aPath) {
+ super(aPath);
}
/**
* Modify the bytesTransferred.
*
- * @param bytesTransferred the bytesTransferred to set
+ * @param newBytesTransferred the bytesTransferred to set
*/
- public void setBytesTransferred(long bytesTransferred) {
- this.bytesTransferred = bytesTransferred;
+ public void setBytesTransferred(long newBytesTransferred) {
+ bytesTransferred = newBytesTransferred;
}
/**
/**
* Modify the fileSize.
*
- * @param fileSize the fileSize to set
+ * @param newFileSize the fileSize to set
*/
- public void setFileSize(long fileSize) {
- this.fileSize = fileSize;
+ public void setFileSize(long newFileSize) {
+ fileSize = newFileSize;
}
public int percent(){
- return new Long(bytesTransferred*100/fileSize).intValue();
+ return new Long(bytesTransferred * 100 / fileSize).intValue();
}
@Override
*/
public class UserResource extends RestResource {
- /**
- * @param path
- */
- public UserResource(String path) {
- super(path);
+ public UserResource(String aPath) {
+ super(aPath);
}
private String name;
/**
* Modify the name.
*
- * @param name the name to set
+ * @param aName the name to set
*/
- public void setName(String name) {
- this.name = name;
+ public void setName(String aName) {
+ name = aName;
}
/**
/**
* Modify the username.
*
- * @param username the username to set
+ * @param aUsername the username to set
*/
- public void setUsername(String username) {
- this.username = username;
+ public void setUsername(String aUsername) {
+ username = aUsername;
}
/**
/**
* Modify the email.
*
- * @param email the email to set
+ * @param anEmail the email to set
*/
- public void setEmail(String email) {
- this.email = email;
+ public void setEmail(String anEmail) {
+ email = anEmail;
}
/**
/**
* Modify the creationDate.
*
- * @param creationDate the creationDate to set
+ * @param aCreationDate the creationDate to set
*/
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
+ public void setCreationDate(Date aCreationDate) {
+ creationDate = aCreationDate;
}
/**
/**
* Modify the modificationDate.
*
- * @param modificationDate the modificationDate to set
+ * @param aModificationDate the modificationDate to set
*/
- public void setModificationDate(Date modificationDate) {
- this.modificationDate = modificationDate;
+ public void setModificationDate(Date aModificationDate) {
+ modificationDate = aModificationDate;
}
/**
/**
* Modify the filesPath.
*
- * @param filesPath the filesPath to set
+ * @param aFilesPath the filesPath to set
*/
- public void setFilesPath(String filesPath) {
- this.filesPath = filesPath;
+ public void setFilesPath(String aFilesPath) {
+ filesPath = aFilesPath;
}
/**
/**
* Modify the trashPath.
*
- * @param trashPath the trashPath to set
+ * @param aTrashPath the trashPath to set
*/
- public void setTrashPath(String trashPath) {
- this.trashPath = trashPath;
+ public void setTrashPath(String aTrashPath) {
+ trashPath = aTrashPath;
}
/**
/**
* Modify the sharedPath.
*
- * @param sharedPath the sharedPath to set
+ * @param aSharedPath the sharedPath to set
*/
- public void setSharedPath(String sharedPath) {
- this.sharedPath = sharedPath;
+ public void setSharedPath(String aSharedPath) {
+ sharedPath = aSharedPath;
}
/**
/**
* Modify the othersPath.
*
- * @param othersPath the othersPath to set
+ * @param anOthersPath the othersPath to set
*/
- public void setOthersPath(String othersPath) {
- this.othersPath = othersPath;
+ public void setOthersPath(String anOthersPath) {
+ othersPath = anOthersPath;
}
/**
/**
* Modify the tagsPath.
*
- * @param tagsPath the tagsPath to set
+ * @param aTagsPath the tagsPath to set
*/
- public void setTagsPath(String tagsPath) {
- this.tagsPath = tagsPath;
+ public void setTagsPath(String aTagsPath) {
+ tagsPath = aTagsPath;
}
/**
/**
* Modify the groupsPath.
*
- * @param groupsPath the groupsPath to set
+ * @param aGroupsPath the groupsPath to set
*/
- public void setGroupsPath(String groupsPath) {
- this.groupsPath = groupsPath;
+ public void setGroupsPath(String aGroupsPath) {
+ groupsPath = aGroupsPath;
}
/**
/**
* Modify the quota.
*
- * @param quota the quota to set
+ * @param aQuota the quota to set
*/
- public void setQuota(QuotaHolder quota) {
- this.quota = quota;
+ public void setQuota(QuotaHolder aQuota) {
+ quota = aQuota;
}
+ @Override
public void createFromJSON(String text) {
JSONObject json = (JSONObject) JSONParser.parse(text);
email = unmarshallString(json, "email");
quota.setQuotaLeftSize(new Long(qj.get("bytesRemaining").toString()));
}
}
-
}
+ @Override
public String toString() {
String res = email + "\n" + name + "\n" + username + "\n" + filesPath + "\n" + groupsPath;
return res;
*/
public class UserSearchResource extends RestResource {
- /**
- * @param aPath
- */
public UserSearchResource(String aPath) {
super(aPath);
}
put("owner", f.getOwner().getUsername()).
put("deleted", f.isDeleted()).
put("version", f.getVersion()).
+ put("content", f.getMimeType()).
put("size", f.getFileSize()).
put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
put("uri", folderUrl + URLEncoder.encode(f.getName(), "UTF-8"));
put("creationDate", oldBody.getAuditInfo().getCreationDate().getTime()).
put("modifiedBy", oldBody.getAuditInfo().getModifiedBy().getUsername()).
put("modificationDate", oldBody.getAuditInfo().getModificationDate().getTime()).
+ put("content", oldBody.getMimeType()).
put("size", oldBody.getFileSize());
else
json.put("createdBy", file.getAuditInfo().getCreatedBy().getUsername()).
put("creationDate", file.getAuditInfo().getCreationDate().getTime()).
put("modifiedBy", file.getAuditInfo().getModifiedBy().getUsername()).
put("modificationDate", file.getAuditInfo().getModificationDate().getTime()).
+ put("content", file.getMimeType()).
put("size", file.getFileSize());
Set<PermissionDTO> perms = getService().getFilePermissions(user.getId(), file.getId());
json.put("permissions", renderJson(perms));
put("deleted", f.isDeleted()).
put("version", f.getVersion()).
put("size", f.getFileSize()).
+ put("content", f.getMimeType()).
put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
put("uri", parentUrl + f.getPath());
files.add(j);
put("deleted", f.isDeleted()).
put("version", f.getVersion()).
put("size", f.getFileSize()).
+ put("content", f.getMimeType()).
put("folder", f.getFolder().getURI()).
put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
put("uri", parentUrl + f.getPath());
put("deleted", f.isDeleted()).
put("version", f.getVersion()).
put("size", f.getFileSize()).
+ put("content", f.getMimeType()).
put("folder", f.getFolder().getURI()).
put("creationDate", f.getAuditInfo().getCreationDate().getTime()).
put("uri", parentUrl + f.getPath());