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.toolbar.ToolBar;
|
||||
|
||||
|
||||
/**
|
||||
* The Class AccoutingInfoContainer.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 28, 2016
|
||||
*/
|
||||
public class AccoutingInfoContainer extends LayoutContainer {
|
||||
|
||||
/**
|
||||
|
@ -57,12 +64,18 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
private boolean groupingEnabled;
|
||||
private ListStore<ModelData> typeStoreOperation = new ListStore<ModelData>();
|
||||
|
||||
/**
|
||||
* Instantiates a new accouting info container.
|
||||
*/
|
||||
public AccoutingInfoContainer() {
|
||||
initContentPanel();
|
||||
initGrid();
|
||||
createToolBar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the content panel.
|
||||
*/
|
||||
private void initContentPanel() {
|
||||
setLayout(new FitLayout());
|
||||
getAriaSupport().setPresentation(true);
|
||||
|
@ -76,6 +89,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
add(cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tool bar.
|
||||
*/
|
||||
private void createToolBar() {
|
||||
|
||||
ToolBar bar = new ToolBar();
|
||||
|
@ -103,6 +119,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the grid.
|
||||
*/
|
||||
public void initGrid() {
|
||||
|
||||
store.groupBy(OPERATION_NAME);
|
||||
|
@ -152,6 +171,12 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
else if (model.get(OPERATION).equals(
|
||||
GxtAccountingEntryType.RESTORE))
|
||||
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;
|
||||
}
|
||||
|
@ -166,11 +191,9 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
public Object render(ModelData model, String property,
|
||||
ColumnData config, int rowIndex, int colIndex,
|
||||
ListStore<ModelData> store, Grid<ModelData> grid) {
|
||||
|
||||
// if(model.get(OPERATION).equals(GxtAccountingEntryType.READ))
|
||||
// return "<b><p style=\"color: red;\">"
|
||||
// + model.get(DESCRIPTION)+ "</p></b>";
|
||||
|
||||
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) {
|
||||
|
||||
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) {
|
||||
|
||||
initContentPanel();
|
||||
|
@ -250,10 +284,13 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
updateListAccounting(accountings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable grouping.
|
||||
*/
|
||||
public void disableGrouping() {
|
||||
GroupingStore<ModelData> groupingStore = null;
|
||||
if (store instanceof GroupingStore) {
|
||||
groupingStore = (GroupingStore<ModelData>) store;
|
||||
groupingStore = store;
|
||||
if (groupingStore != null) {
|
||||
groupingStore.clearGrouping();
|
||||
}
|
||||
|
@ -261,10 +298,13 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable grouping.
|
||||
*/
|
||||
public void enableGrouping() {
|
||||
GroupingStore<ModelData> groupingStore = null;
|
||||
if (store instanceof GroupingStore) {
|
||||
groupingStore = (GroupingStore<ModelData>) store;
|
||||
groupingStore = store;
|
||||
if (groupingStore != null) {
|
||||
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) {
|
||||
|
||||
List<BaseModelData> listModelData = new ArrayList<BaseModelData>();
|
||||
|
@ -309,6 +354,12 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
store.add(listModelData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Type.
|
||||
*
|
||||
* @param type the type
|
||||
* @return the model data
|
||||
*/
|
||||
private ModelData type(String type) {
|
||||
ModelData model = new BaseModelData();
|
||||
model.set(TYPEOPERATION, type);
|
||||
|
@ -316,6 +367,11 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update store.
|
||||
*
|
||||
* @param store the store
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void updateStore(ListStore<ModelData> store) {
|
||||
|
||||
|
@ -323,10 +379,21 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
this.grid.getStore().add(store.getModels());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset store.
|
||||
*/
|
||||
public void resetStore() {
|
||||
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,
|
||||
int width) {
|
||||
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
|
||||
|
@ -335,15 +402,30 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
|||
return columnConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the header title.
|
||||
*
|
||||
* @param title the new header title
|
||||
*/
|
||||
public void setHeaderTitle(String title) {
|
||||
cp.setHeading(title);
|
||||
// cp.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is grouping enabled.
|
||||
*
|
||||
* @return true, if is grouping enabled
|
||||
*/
|
||||
public boolean isGroupingEnabled() {
|
||||
return groupingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the grouping enabled.
|
||||
*
|
||||
* @param groupingEnabled the new grouping enabled
|
||||
*/
|
||||
public void setGroupingEnabled(boolean groupingEnabled) {
|
||||
this.groupingEnabled = groupingEnabled;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import javax.servlet.http.HttpSession;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
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.server.property.PortalUrlGroupGatewayProperty;
|
||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||
|
|
|
@ -1854,6 +1854,38 @@ public class GWTWorkspaceBuilder {
|
|||
af.setDescription(msg);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.gcube.portlets.user.workspace.shared.accounting;
|
|||
* The Enum GxtAccountingEntryType.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Nov 10, 2015
|
||||
* Sep 28, 2016
|
||||
*/
|
||||
public enum GxtAccountingEntryType {
|
||||
|
||||
|
@ -36,6 +36,10 @@ public enum GxtAccountingEntryType {
|
|||
|
||||
RESTORE("Restored", "restored"),
|
||||
|
||||
DISABLED_PUBLIC_ACCESS("DisabledPublicAccess","disabled public access"),
|
||||
|
||||
ENABLED_PUBLIC_ACCESS("EnabledPublicAccess","enabled public access"),
|
||||
|
||||
ALLWITHOUTREAD("allwithoutread", "allwithoutread");
|
||||
|
||||
private String id;
|
||||
|
|
Loading…
Reference in New Issue