enhancements on ACLs

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@91803 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-02-17 18:20:30 +00:00
parent 0b8826ae99
commit 8672c7af9f
15 changed files with 96 additions and 584 deletions

View File

@ -18,6 +18,9 @@ public class FileTrashedModel extends FileGridModel {
private Date deleteDate;
private InfoContactModel deleteUser;
public static enum STOREINFO {ORIGINALPATH, DELETEDATE, DELETEUSER}
public FileTrashedModel() {
}
@ -87,18 +90,21 @@ public class FileTrashedModel extends FileGridModel {
public void setOrginalPath(String orginalPath) {
set(STOREINFO.ORIGINALPATH.toString(), orginalPath);
this.orginalPath = orginalPath;
}
public void setDeleteDate(Date deleteDate) {
set(STOREINFO.DELETEDATE.toString(), deleteDate);
this.deleteDate = deleteDate;
}
public void setDeleteUser(InfoContactModel deleteUser) {
set(STOREINFO.DELETEUSER.toString(), deleteUser);
this.deleteUser = deleteUser;
}

View File

@ -17,7 +17,9 @@ import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
import org.gcube.portlets.user.workspace.client.model.SubTree;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
import org.gcube.portlets.user.workspace.shared.TrashOperationResult;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.google.gwt.user.client.rpc.RemoteService;
@ -217,4 +219,13 @@ public interface GWTWorkspaceService extends RemoteService{
*/
List<FileTrashedModel> getTrashContent() throws Exception;
/**
* @param trashItemId
* @param operation
* @return
* @throws Exception
*/
TrashOperationResult executeOperationOnTrash(String trashItemId,
WorkspaceTrashOperation operation) throws Exception;
}

View File

@ -16,7 +16,9 @@ import org.gcube.portlets.user.workspace.client.model.ScopeModel;
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
import org.gcube.portlets.user.workspace.client.model.SubTree;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.shared.TrashOperationResult;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -188,4 +190,8 @@ public interface GWTWorkspaceServiceAsync {
void getTrashContent(AsyncCallback<List<FileTrashedModel>> callback);
void executeOperationOnTrash(String trashItemId,
WorkspaceTrashOperation operation,
AsyncCallback<TrashOperationResult> callback);
}

View File

@ -0,0 +1,37 @@
/**
*
*/
package org.gcube.portlets.user.workspace.client.util;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Feb 17, 2014
*
*/
public class GetPermissionIconByACL {
public static AbstractImagePrototype getImage(WorkspaceACL acl) {
if(acl==null || acl.getId()==null)
return null;
String id = acl.getId();
if (id.compareTo("ADMINISTRATOR") == 0) {
} else if (id.compareTo("READ_ONLY") == 0) {
return Resources.getIconReadOnly();
} else if (id.compareTo("WRITE_OWNER") == 0) {
return Resources.getIconWriteOwn();
} else if (id.compareTo("WRITE_ALL") == 0) {
return Resources.getIconWriteAll();
}
return null;
}
}

View File

@ -56,36 +56,4 @@ public class PanelPermission extends LayoutContainer {
return null;
}
/*
public List<WorkspaceACL> getCheckedGroupList() {
List<WorkspaceACL> listDS = new ArrayList<WorkspaceACL>();
List<Radio> values = new ArrayList<Radio>();
if (radioGroup.getValue()!=null){
Radio radio = radioGroup.getValue();
values.add((Radio) radio);
}
else {
List<Field<?>> listChecks = radioGroup.getAll();
for (Field<?> field : listChecks) {
values.add((Radio) field);
}
}
for (Radio radio : values) {
if (radio.isEnabled()){
WorkspaceACL acl = (WorkspaceACL) radio.getData(WORKSPACEACL);
listDS.add(acl);
}
}
if (listDS.size() == 0)
return null;
return listDS;
}
*/
}

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.workspace.client.view.sharing;
import java.util.List;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.client.util.GetPermissionIconByACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
@ -16,6 +17,7 @@ import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class PanelTogglePermission extends LayoutContainer {
@ -71,24 +73,29 @@ public class PanelTogglePermission extends LayoutContainer {
}
});
bToggle.setToolTip(new ToolTipConfig(acl.getDescription()));
setIcon(bToggle, acl.getId());
AbstractImagePrototype img = GetPermissionIconByACL.getImage(acl);
if(img!=null)
bToggle.setIcon(img);
// setIcon(bToggle, acl.getId());
return bToggle;
}
private void setIcon(ToggleButton bToggle, String id){
if(id.compareTo("ADMINISTRATOR")==0){
}else if(id.compareTo("READ_ONLY")==0){
bToggle.setIcon(Resources.getIconReadOnly());
}else if(id.compareTo("WRITE_OWNER")==0){
bToggle.setIcon(Resources.getIconWriteOwn());
}else if(id.compareTo("WRITE_ALL")==0){
bToggle.setIcon(Resources.getIconWriteAll());
}
}
// private void setIcon(ToggleButton bToggle, String id){
//
// if(id.compareTo("ADMINISTRATOR")==0){
//
// }else if(id.compareTo("READ_ONLY")==0){
// bToggle.setIcon(Resources.getIconReadOnly());
// }else if(id.compareTo("WRITE_OWNER")==0){
// bToggle.setIcon(Resources.getIconWriteOwn());
// }else if(id.compareTo("WRITE_ALL")==0){
// bToggle.setIcon(Resources.getIconWriteAll());
// }
//
// }
public WorkspaceACL getSelectedACL() {
GWT.log("Selected ACL is: "+selectedAcl);

View File

@ -1,373 +0,0 @@
package org.gcube.portlets.user.workspace.client.view.trash;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.DNDEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Record;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters;
import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.i18n.client.NumberFormat;
public class TrashInfoContainer extends LayoutContainer {
/**
*
*/
private Grid<FileModel> grid;
private ContentPanel cp;
private GroupingStore<FileModel> store = new GroupingStore<FileModel>();
private boolean groupingEnabled;
private ListStore<FileModel> typeStoreOperation = new ListStore<FileModel>();
private NumberFormat number = ConstantsExplorer.numberFormatterKB;
private GridDropTarget gridDropTarget;
public TrashInfoContainer() {
initContentPanel();
initGrid();
createToolBar();
initDropTarget();
}
/**
*
*/
private void initDropTarget() {
this.gridDropTarget = new GridDropTarget(grid){
/* (non-Javadoc)
* @see com.extjs.gxt.ui.client.dnd.GridDropTarget#onDragDrop(com.extjs.gxt.ui.client.event.DNDEvent)
*/
@Override
protected void onDragDrop(DNDEvent e) {
// TODO Auto-generated method stub
List<FileModel> listFileModel = getDragSource(e);
for (FileModel fileModel : listFileModel) {
fileModel.setIcon();
}
System.out.println("** Trash Event move handleInsertDrop is completed");
super.onDragDrop(e);
}
private List<FileModel> getDragSource(DNDEvent event){
List<FileModel> listDraggedFile = new ArrayList<FileModel>();
if(event.getData() != null){
List<BaseModelData> listItemsSource = event.getData();
System.out.println("Trash - Number of move " + listItemsSource.size());
FileModel sourceFileModel = null; //for print
for(int i=0; i<listItemsSource.size(); i++){
/*
if(listItemsSource.get(i) instanceof TreeStoreModel){
System.out.println("qui 1");
TreeStoreModel itemSource = (TreeStoreModel) listItemsSource.get(i);
listDraggedFile.add((FileModel) itemSource.getModel());
sourceFileModel = (FileModel) itemSource.getModel();
if(sourceFileModel.getParentFileModel()!=null)
System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
else
System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
}else
{
System.out.println("qui 2");
System.out.println("class "+listItemsSource.get(i).getClass());
}*/
// System.out.println("Trash Child count: " + itemSource.getChildCount());
}
}
return listDraggedFile;
}
};
}
private void initContentPanel() {
setLayout(new FitLayout());
getAriaSupport().setPresentation(true);
cp = new ContentPanel();
cp.setHeaderVisible(false);
cp.setBodyBorder(true);
cp.setLayout(new FitLayout());
cp.setButtonAlign(HorizontalAlignment.CENTER);
// cp.getHeader().setIconAltText("Grid Icon");
// cp.setSize(550, 280);
add(cp);
}
private void createToolBar() {
ToolBar bar = new ToolBar();
final ToggleButton buttonGrouping = new ToggleButton("",Resources.getIconGridView());
buttonGrouping.setToolTip("Grouping by Type");
buttonGrouping.setScale(ButtonScale.SMALL);
buttonGrouping.toggle(true);
buttonGrouping.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if (buttonGrouping.isPressed())
enableGrouping();
else
disableGrouping();
}
});
// bar.add(buttonGrouping);
cp.setTopComponent(bar);
}
public void initGrid() {
// store.groupBy(ConstantsExplorer.SHORTCUTCATEGORY);
// groupingEnabled = true;
ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25);
ColumnConfig name = createSortableColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 300);
ColumnConfig type = createSortableColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 50);
// ColumnConfig category = createSortableColumnConfig(ConstantsExplorer.SHORTCUTCATEGORY, ConstantsExplorer.SHORTCUTCATEGORY, 100);
ColumnConfig ownerFullName = createSortableColumnConfig(ConstantsExplorer.OWNERFULLNAME, ConstantsExplorer.OWNER, 100);
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, ownerFullName));
final ColumnModel columnModel = cm;
grid = new Grid<FileModel>(this.store, cm);
GroupingView view = new GroupingView();
view.setShowGroupedColumn(true);
this.grid.setView(view);
// view.setGroupRenderer(new GridGroupRenderer() {
// public String render(GroupColumnData data) {
// String f = columnModel.getColumnById(data.field).getHeader();
// String l = data.models.size() == 1 ? "Item" : "Items";
// return f + ": " + data.group + " (" + data.models.size() + " "
// + l + ")";
// }
// });
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
@Override
public String render(FileModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileModel> store, Grid<FileModel> grid) {
String val = model.get(property);
String color = "black";
if(val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())){
// color = "#EEC900";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
}else{
if(val==null)
val = "";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
}
}
};
type.setRenderer(folderRender);
GridFilters filters = new GridFilters();
filters.setLocal(true);
StringFilter nameFilter = new StringFilter(ConstantsExplorer.NAME);
StringFilter authorFilter = new StringFilter(ConstantsExplorer.TYPE);
filters.addFilter(nameFilter);
filters.addFilter(authorFilter);
grid.addPlugin(filters);
grid.setBorders(true);
grid.setStripeRows(true);
grid.getView().setAutoFill(true);
grid.setColumnLines(true);
grid.setColumnReordering(true);
grid.setStyleAttribute("borderTop", "none");
cp.add(grid);
}
public void setPanelSize(int width, int height) {
if (width > 0 && height > 0 && grid != null) {
cp.setSize(width, height);
// grid.setSize(width, height);
}
}
public TrashInfoContainer(List<FileModel> trashFiles) {
initContentPanel();
initGrid();
updateTrash(trashFiles);
}
public void disableGrouping() {
GroupingStore<FileModel> groupingStore = null;
if (store instanceof GroupingStore) {
groupingStore = (GroupingStore<FileModel>) store;
if (groupingStore != null) {
groupingStore.clearGrouping();
}
this.groupingEnabled = false;
}
}
public void enableGrouping() {
GroupingStore<FileModel> groupingStore = null;
if (store instanceof GroupingStore) {
groupingStore = (GroupingStore<FileModel>) store;
if (groupingStore != null) {
groupingStore.groupBy(ConstantsExplorer.SHORTCUTCATEGORY);
}
this.groupingEnabled = true;
}
}
public void updateTrash(List<FileModel> trashFiles) {
store.removeAll();
typeStoreOperation.removeAll();
store.add(trashFiles);
}
private void updateStore(ListStore<FileModel> store) {
resetStore();
this.grid.getStore().add(store.getModels());
}
public void resetStore() {
this.grid.getStore().removeAll();
}
public ColumnConfig createSortableColumnConfig(String id, String name,
int width) {
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
columnConfig.setSortable(true);
return columnConfig;
}
public void setHeaderTitle(String title) {
cp.setHeading(title);
// cp.layout();
}
public boolean isGroupingEnabled() {
return groupingEnabled;
}
public void setGroupingEnabled(boolean groupingEnabled) {
this.groupingEnabled = groupingEnabled;
}
/**
*
* @param identifier
* @return
*/
public FileModel getFileModelByIdentifier(String identifier){
return store.findModel(ConstantsExplorer.IDENTIFIER, identifier);
}
/**
*
* @param identifier (MANDATORY)
* @return
*/
public boolean deleteItem(String identifier) {
FileModel fileTarget = getFileModelByIdentifier(identifier);
if(fileTarget!=null){
return deleteItem(fileTarget);
}
else
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
return false;
}
/**
*
* @param fileTarget (MANDATORY)
* @return
*/
private boolean deleteItem(FileModel fileTarget) {
Record record = store.getRecord(fileTarget);
if (record != null) {
FileModel item = (FileModel) record.getModel();
store.remove(item);
return true;
} else
System.out.println("Record Error: file target with "
+ fileTarget.getIdentifier()
+ " identifier not exist in store");
return false;
}
}

View File

@ -1,119 +0,0 @@
package org.gcube.portlets.user.workspace.client.view.trash;
import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013
*
* Singleton
*/
public class WindowTrash extends Window {
private List<FileModel> trashedFiles;
private TrashInfoContainer trashContainers;
private static WindowTrash INSTANCE = null;
private WindowTrash() {
initAccounting();
setIcon(Resources.getTrash()); //TODO
setHeading("Trash");
// addResizeListner();
}
/**
*
* @return
*/
public static synchronized WindowTrash getInstance(){
if(INSTANCE==null)
INSTANCE = new WindowTrash();
return INSTANCE;
}
// public void addResizeListner(){
//
// this.addListener(Events.Resize, new Listener<WindowEvent>() {
//
// @Override
// public void handleEvent(WindowEvent we )
// {
//
// if(trashContainers!=null){
//// System.out.println("Size in event: " + we.getWidth() + "x" + we.getHeight() );
//// accountingsContainers.setPanelSize(we.getWidth()-14, we.getHeight()-30);
// }
// }
//
// });
// }
// public WindowTrash(List<FileModel> trashFiles) {
// updateTrashContainer(trashFiles);
// }
private void initAccounting() {
// setModal(true);
setLayout(new FitLayout());
setSize(700, 350);
setResizable(true);
setMaximizable(true);
// setCollapsible(true);
this.trashContainers = new TrashInfoContainer();
add(trashContainers);
}
public void setWindowTitle(String title) {
this.setHeading(title);
}
/**
*
* @param fileModelId
* @return
*/
public boolean deleteFileFromTrash(String fileModelId){
return this.trashContainers.deleteItem(fileModelId);
}
public void updateTrashContainer(List<FileModel> trashFiles) {
this.trashContainers.resetStore();
this.trashedFiles = trashFiles;
this.trashContainers.updateTrash(trashFiles);
}
public List<FileModel> getTrashedFiles() {
return trashedFiles;
}
public void maskAccountingInfo(boolean bool){
// if(accountingsContainers!=null){
//
// if(bool)
// accountingsContainers.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
// else
// accountingsContainers.unmask();
// }
if(bool)
this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
else
this.unmask();
}
}

View File

@ -532,13 +532,14 @@ public class DownloadServlet extends HttpServlet{
ExternalResourceLink externalResourceLink = (ExternalResourceLink) folderItem;
OutputStream out = resp.getOutputStream();
try {
String mimeType = externalResourceLink.getMimeType();
if(mimeType == null){
logger.trace("mimeType is null... recover from MimeTypeUtil by BufferedInputStream");
BufferedInputStream bufferedStream = new BufferedInputStream(externalResourceLink.getData(), (int) externalResourceLink.getLength());
mimeType = MimeTypeUtil.getMimeType(bufferedStream);
mimeType = MimeTypeUtil.getMimeType(externalResourceLink.getName(), bufferedStream);
}
logger.trace("setContentType with mimeType " + mimeType);

View File

@ -2158,7 +2158,7 @@ public class GWTWorkspaceBuilder {
//TODO SETTING IS FOLDER
// fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, folderItem.getLength(), false, false);
fileTrashModel = new FileTrashedModel(trashedItem.getId(), trashedItem.getName(), toDate(trashedItem.getLastModificationTime()), null, trashedItem.getLength(), false, trashedItem.isShared());
fileTrashModel.setOrginalPath(trashedItem.getOriginalPath());
fileTrashModel.setOrginalPath(trashedItem.getOriginalParentId());
fileTrashModel.setDeleteDate(fileTrashModel.getDeleteDate());
InfoContactModel deleteUser = buildGxtInfoContactFromPortalLogin(trashedItem.getDeleteUser());
fileTrashModel.setDeleteUser(deleteUser);
@ -2178,35 +2178,6 @@ public class GWTWorkspaceBuilder {
}
public FileTrashedModel buildGXTTrashModelItemById(String itemId, WorkspaceTrashFolder trash) throws InternalErrorException{
// FileTrashedModel fileTrashModel = null;
//
// WorkspaceTrashItem trashedItem = trash.findItem(itemId);
//
// switch (trashedItem.getType()) {
//
// case TRASH_ITEM:
//
// //TODO SETTING IS FOLDER
// // fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, folderItem.getLength(), false, false);
// fileTrashModel = new FileTrashedModel(trashedItem.getId(), trashedItem.getName(), toDate(trashedItem.getLastModificationTime()), null, trashedItem.getLength(), false, trashedItem.isShared());
// fileTrashModel.setOrginalPath(trashedItem.getOriginalPath());
// fileTrashModel.setDeleteDate(fileTrashModel.getDeleteDate());
// InfoContactModel deleteUser = buildGxtInfoContactFromPortalLogin(trashedItem.getDeleteUser());
// fileTrashModel.setDeleteUser(deleteUser);
// FolderItem folderItem = (FolderItem) trashedItem;
// fileTrashModel = (FileTrashedModel) setFolderItemType(fileTrashModel, folderItem);
// break;
//
//
// default:
// logger.error("gxt conversion return null for trash item "+trashedItem.getName());
// break;
//
// }
//
// return fileTrashModel;
return null;
}

View File

@ -2590,10 +2590,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
if(wsItem.isShared() && (wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER))){
WorkspaceSharedFolder ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
//TODO
ite.getACL();
return builder.getWorkspaceACLFromACLs(Arrays.asList(ACLType.values()));
return builder.getWorkspaceACLFromACLs(Arrays.asList(ite.getACLUser()));
}else
throw new Exception("Source item is not shared or shared folder");
@ -2637,8 +2634,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
* @return
* @throws Exception
*/
public TrashOperationResult executeOperationOnTrashItem(String trashItemId, WorkspaceTrashOperation operation) throws Exception{
@Override
public TrashOperationResult executeOperationOnTrash(String trashItemId, WorkspaceTrashOperation operation) throws Exception{
workspaceLogger.trace("Get TrashContent: ");
Workspace workspace;

View File

@ -220,7 +220,7 @@ public class LocalUploadServlet extends HttpServlet {
else
itemName = file.getName();
String contentType = MimeTypeUtil.getMimeType(new BufferedInputStream(fileUploadIS));
String contentType = MimeTypeUtil.getMimeType(itemName, new BufferedInputStream(fileUploadIS));
logger.trace("Content type (mime type): "+contentType + " unique name: "+itemName);
// System.out.println("Content type: "+contentType + " unique name: "+itemName);

View File

@ -199,7 +199,7 @@ public class UploadServlet extends HttpServlet {
else
itemName = uploadItem.getName();
String contentType = MimeTypeUtil.getMimeType(new BufferedInputStream(uploadItem.getInputStream()));
String contentType = MimeTypeUtil.getMimeType(itemName, new BufferedInputStream(uploadItem.getInputStream()));
logger.trace("Content type (mime type): "+contentType + " unique name: "+itemName);
// System.out.println("Content type: "+contentType + " unique name: "+itemName);

View File

@ -74,10 +74,10 @@ public class WsUtil {
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
user=TEST_USER;
// user=TEST_USER;
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
// user = "francesco.mangiacrapa";
user = "francesco.mangiacrapa";
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
logger.warn("session id: "+sessionID);
@ -105,10 +105,10 @@ public class WsUtil {
withoutPortal = true;
//COMMENT THIS IN PRODUCTION ENVIROMENT
// }else if(user.compareToIgnoreCase("francesco.mangiacrapa")==0){
//
// withoutPortal = true;
// //END UNCOMMENT
}else if(user.compareToIgnoreCase("francesco.mangiacrapa")==0){
withoutPortal = true;
//END UNCOMMENT
}else{
withoutPortal = false;

View File

@ -65,7 +65,7 @@ public class UploadServletTest {
// ExternalImage file = (ExternalImage) root.find(name);
// UPLOAD FILE
String contentType = MimeTypeUtil.getMimeType(new BufferedInputStream(
String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream(
new FileInputStream(new File(fullPath))));
String itemName = WorkspaceUtil.getUniqueName(fileName, root);