Implemented Feature #5110
Add Enabled/Disabled Public Access to workspace history git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131999 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
24565db7ff
commit
9f804215bd
|
@ -36,6 +36,13 @@ 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.layout.FitLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class AccoutingInfoContainer.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Sep 28, 2016
|
||||||
|
*/
|
||||||
public class AccoutingInfoContainer extends LayoutContainer {
|
public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,12 +64,18 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
private boolean groupingEnabled;
|
private boolean groupingEnabled;
|
||||||
private ListStore<ModelData> typeStoreOperation = new ListStore<ModelData>();
|
private ListStore<ModelData> typeStoreOperation = new ListStore<ModelData>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new accouting info container.
|
||||||
|
*/
|
||||||
public AccoutingInfoContainer() {
|
public AccoutingInfoContainer() {
|
||||||
initContentPanel();
|
initContentPanel();
|
||||||
initGrid();
|
initGrid();
|
||||||
createToolBar();
|
createToolBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the content panel.
|
||||||
|
*/
|
||||||
private void initContentPanel() {
|
private void initContentPanel() {
|
||||||
setLayout(new FitLayout());
|
setLayout(new FitLayout());
|
||||||
getAriaSupport().setPresentation(true);
|
getAriaSupport().setPresentation(true);
|
||||||
|
@ -76,6 +89,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
add(cp);
|
add(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the tool bar.
|
||||||
|
*/
|
||||||
private void createToolBar() {
|
private void createToolBar() {
|
||||||
|
|
||||||
ToolBar bar = new ToolBar();
|
ToolBar bar = new ToolBar();
|
||||||
|
@ -103,6 +119,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the grid.
|
||||||
|
*/
|
||||||
public void initGrid() {
|
public void initGrid() {
|
||||||
|
|
||||||
store.groupBy(OPERATION_NAME);
|
store.groupBy(OPERATION_NAME);
|
||||||
|
@ -152,6 +171,12 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
else if (model.get(OPERATION).equals(
|
else if (model.get(OPERATION).equals(
|
||||||
GxtAccountingEntryType.RESTORE))
|
GxtAccountingEntryType.RESTORE))
|
||||||
return Resources.getIconUndo().createImage();
|
return Resources.getIconUndo().createImage();
|
||||||
|
else if (model.get(OPERATION).equals(
|
||||||
|
GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS))
|
||||||
|
return Resources.getIconFolderPublicRemove().createImage();
|
||||||
|
else if (model.get(OPERATION).equals(
|
||||||
|
GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS))
|
||||||
|
return Resources.getIconFolderPublic().createImage();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -166,11 +191,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
public Object render(ModelData model, String property,
|
public Object render(ModelData model, String property,
|
||||||
ColumnData config, int rowIndex, int colIndex,
|
ColumnData config, int rowIndex, int colIndex,
|
||||||
ListStore<ModelData> store, Grid<ModelData> grid) {
|
ListStore<ModelData> store, Grid<ModelData> grid) {
|
||||||
|
|
||||||
// if(model.get(OPERATION).equals(GxtAccountingEntryType.READ))
|
// if(model.get(OPERATION).equals(GxtAccountingEntryType.READ))
|
||||||
// return "<b><p style=\"color: red;\">"
|
// return "<b><p style=\"color: red;\">"
|
||||||
// + model.get(DESCRIPTION)+ "</p></b>";
|
// + model.get(DESCRIPTION)+ "</p></b>";
|
||||||
|
|
||||||
return model.get(DESCRIPTION);
|
return model.get(DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +258,12 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the panel size.
|
||||||
|
*
|
||||||
|
* @param width the width
|
||||||
|
* @param height the height
|
||||||
|
*/
|
||||||
public void setPanelSize(int width, int height) {
|
public void setPanelSize(int width, int height) {
|
||||||
|
|
||||||
if (width > 0 && height > 0 && grid != null) {
|
if (width > 0 && height > 0 && grid != null) {
|
||||||
|
@ -243,6 +272,11 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new accouting info container.
|
||||||
|
*
|
||||||
|
* @param accountings the accountings
|
||||||
|
*/
|
||||||
public AccoutingInfoContainer(List<GxtAccountingField> accountings) {
|
public AccoutingInfoContainer(List<GxtAccountingField> accountings) {
|
||||||
|
|
||||||
initContentPanel();
|
initContentPanel();
|
||||||
|
@ -250,10 +284,13 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
updateListAccounting(accountings);
|
updateListAccounting(accountings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable grouping.
|
||||||
|
*/
|
||||||
public void disableGrouping() {
|
public void disableGrouping() {
|
||||||
GroupingStore<ModelData> groupingStore = null;
|
GroupingStore<ModelData> groupingStore = null;
|
||||||
if (store instanceof GroupingStore) {
|
if (store instanceof GroupingStore) {
|
||||||
groupingStore = (GroupingStore<ModelData>) store;
|
groupingStore = store;
|
||||||
if (groupingStore != null) {
|
if (groupingStore != null) {
|
||||||
groupingStore.clearGrouping();
|
groupingStore.clearGrouping();
|
||||||
}
|
}
|
||||||
|
@ -261,10 +298,13 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable grouping.
|
||||||
|
*/
|
||||||
public void enableGrouping() {
|
public void enableGrouping() {
|
||||||
GroupingStore<ModelData> groupingStore = null;
|
GroupingStore<ModelData> groupingStore = null;
|
||||||
if (store instanceof GroupingStore) {
|
if (store instanceof GroupingStore) {
|
||||||
groupingStore = (GroupingStore<ModelData>) store;
|
groupingStore = store;
|
||||||
if (groupingStore != null) {
|
if (groupingStore != null) {
|
||||||
groupingStore.groupBy(OPERATION_NAME);
|
groupingStore.groupBy(OPERATION_NAME);
|
||||||
}
|
}
|
||||||
|
@ -272,6 +312,11 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update list accounting.
|
||||||
|
*
|
||||||
|
* @param accountings the accountings
|
||||||
|
*/
|
||||||
public void updateListAccounting(List<GxtAccountingField> accountings) {
|
public void updateListAccounting(List<GxtAccountingField> accountings) {
|
||||||
|
|
||||||
List<BaseModelData> listModelData = new ArrayList<BaseModelData>();
|
List<BaseModelData> listModelData = new ArrayList<BaseModelData>();
|
||||||
|
@ -309,6 +354,12 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
store.add(listModelData);
|
store.add(listModelData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type.
|
||||||
|
*
|
||||||
|
* @param type the type
|
||||||
|
* @return the model data
|
||||||
|
*/
|
||||||
private ModelData type(String type) {
|
private ModelData type(String type) {
|
||||||
ModelData model = new BaseModelData();
|
ModelData model = new BaseModelData();
|
||||||
model.set(TYPEOPERATION, type);
|
model.set(TYPEOPERATION, type);
|
||||||
|
@ -316,6 +367,11 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update store.
|
||||||
|
*
|
||||||
|
* @param store the store
|
||||||
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void updateStore(ListStore<ModelData> store) {
|
private void updateStore(ListStore<ModelData> store) {
|
||||||
|
|
||||||
|
@ -323,10 +379,21 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
this.grid.getStore().add(store.getModels());
|
this.grid.getStore().add(store.getModels());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset store.
|
||||||
|
*/
|
||||||
public void resetStore() {
|
public void resetStore() {
|
||||||
this.grid.getStore().removeAll();
|
this.grid.getStore().removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the sortable column config.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param name the name
|
||||||
|
* @param width the width
|
||||||
|
* @return the column config
|
||||||
|
*/
|
||||||
public ColumnConfig createSortableColumnConfig(String id, String name,
|
public ColumnConfig createSortableColumnConfig(String id, String name,
|
||||||
int width) {
|
int width) {
|
||||||
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
|
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
|
||||||
|
@ -335,15 +402,30 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
return columnConfig;
|
return columnConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the header title.
|
||||||
|
*
|
||||||
|
* @param title the new header title
|
||||||
|
*/
|
||||||
public void setHeaderTitle(String title) {
|
public void setHeaderTitle(String title) {
|
||||||
cp.setHeading(title);
|
cp.setHeading(title);
|
||||||
// cp.layout();
|
// cp.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is grouping enabled.
|
||||||
|
*
|
||||||
|
* @return true, if is grouping enabled
|
||||||
|
*/
|
||||||
public boolean isGroupingEnabled() {
|
public boolean isGroupingEnabled() {
|
||||||
return groupingEnabled;
|
return groupingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the grouping enabled.
|
||||||
|
*
|
||||||
|
* @param groupingEnabled the new grouping enabled
|
||||||
|
*/
|
||||||
public void setGroupingEnabled(boolean groupingEnabled) {
|
public void setGroupingEnabled(boolean groupingEnabled) {
|
||||||
this.groupingEnabled = groupingEnabled;
|
this.groupingEnabled = groupingEnabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.server.property.PortalUrlGroupGatewayProperty;
|
import org.gcube.portlets.user.workspace.server.property.PortalUrlGroupGatewayProperty;
|
||||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||||
|
|
|
@ -1854,6 +1854,38 @@ public class GWTWorkspaceBuilder {
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DISABLED_PUBLIC_ACCESS:
|
||||||
|
|
||||||
|
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)){
|
||||||
|
|
||||||
|
af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS);
|
||||||
|
AccountingEntryRestore acc = (AccountingEntryRestore) accountingEntry;
|
||||||
|
String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
||||||
|
msg+=GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName()+" by "+user.getName();
|
||||||
|
af.setDescription(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ENABLED_PUBLIC_ACCESS:
|
||||||
|
|
||||||
|
|
||||||
|
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)){
|
||||||
|
|
||||||
|
af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS);
|
||||||
|
AccountingEntryRestore acc = (AccountingEntryRestore) accountingEntry;
|
||||||
|
String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
||||||
|
msg+=GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName()+" by "+user.getName();
|
||||||
|
af.setDescription(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
listAccFields.add(af);
|
listAccFields.add(af);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.gcube.portlets.user.workspace.shared.accounting;
|
||||||
* The Enum GxtAccountingEntryType.
|
* The Enum GxtAccountingEntryType.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Nov 10, 2015
|
* Sep 28, 2016
|
||||||
*/
|
*/
|
||||||
public enum GxtAccountingEntryType {
|
public enum GxtAccountingEntryType {
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@ public enum GxtAccountingEntryType {
|
||||||
|
|
||||||
RESTORE("Restored", "restored"),
|
RESTORE("Restored", "restored"),
|
||||||
|
|
||||||
|
DISABLED_PUBLIC_ACCESS("DisabledPublicAccess","disabled public access"),
|
||||||
|
|
||||||
|
ENABLED_PUBLIC_ACCESS("EnabledPublicAccess","enabled public access"),
|
||||||
|
|
||||||
ALLWITHOUTREAD("allwithoutread", "allwithoutread");
|
ALLWITHOUTREAD("allwithoutread", "allwithoutread");
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
Loading…
Reference in New Issue