Accounting Manager
Added check configuration by GenericResource git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@131558 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
afe7ee5881
commit
a320e72d19
|
@ -27,6 +27,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.SessionExpiredException;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.tabs.EnableTabs;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||
|
||||
|
@ -121,6 +122,34 @@ public class AccountingManagerController {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void retrieveEnableTabs() {
|
||||
AccountingManagerServiceAsync.INSTANCE
|
||||
.getEnableTabs(new AsyncCallback<EnableTabs>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error retrieving enable tabs: " + caught.getLocalizedMessage());
|
||||
if (caught instanceof SessionExpiredException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
sessionExpiredShowDelayed();
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(EnableTabs enableTabs) {
|
||||
Log.info("Enable Tabs: " + enableTabs);
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void sessionExpiredShowDelayed() {
|
||||
Timer timeoutTimer = new Timer() {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.menu;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.event.AccountingMenuEvent;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
|
@ -24,7 +26,7 @@ import com.sencha.gxt.widget.core.client.TabPanel;
|
|||
public class AccountingManagerMenu extends TabPanel {
|
||||
//private AccountingManagerMenuMessages msgs;
|
||||
private EventBus eventBus;
|
||||
|
||||
private ArrayList<AccountingType> enableTabs;
|
||||
|
||||
public AccountingManagerMenu(EventBus eventBus) {
|
||||
super(GWT.<TabPanelAppearance>create(Css3BigTabPanelAppearance.class));
|
||||
|
@ -36,12 +38,12 @@ public class AccountingManagerMenu extends TabPanel {
|
|||
setAnimScroll(false);
|
||||
setTabScroll(false);
|
||||
setCloseContextMenu(true);
|
||||
addTabs();
|
||||
setHeight(60);
|
||||
|
||||
addTabs();
|
||||
}
|
||||
|
||||
|
||||
protected void addTabs() {
|
||||
private void addTabs() {
|
||||
TabItemConfig storageItemConf = new TabItemConfig("Storage", false);
|
||||
storageItemConf.setIcon(AccountingManagerResources.INSTANCE.accountingStorage48());
|
||||
EmptyPanel storageCategory=new EmptyPanel(AccountingType.STORAGE.name());
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.tabs.EnableTabs;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.workspace.ItemDescription;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
|
@ -42,8 +43,7 @@ public interface AccountingManagerService extends RemoteService {
|
|||
* @throws ServiceException
|
||||
*/
|
||||
public SeriesResponse getSeries(AccountingType accountingType,
|
||||
SeriesRequest seriesRequest)
|
||||
throws ServiceException;
|
||||
SeriesRequest seriesRequest) throws ServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -54,20 +54,22 @@ public interface AccountingManagerService extends RemoteService {
|
|||
*/
|
||||
public ArrayList<FilterKey> getFilterKeys(AccountingType accountingType)
|
||||
throws ServiceException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param filterValuesRequest request values available
|
||||
* @param filterValuesRequest
|
||||
* request values available
|
||||
* @return
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public ArrayList<FilterValue> getFilterValues(FilterValuesRequest filterValuesRequest)
|
||||
throws ServiceException;
|
||||
|
||||
public ArrayList<FilterValue> getFilterValues(
|
||||
FilterValuesRequest filterValuesRequest) throws ServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemDescription item description
|
||||
* @param itemDescription
|
||||
* item description
|
||||
* @return
|
||||
* @throws ServiceException
|
||||
*/
|
||||
|
@ -82,7 +84,12 @@ public interface AccountingManagerService extends RemoteService {
|
|||
*/
|
||||
public ItemDescription saveCSVOnWorkspace(AccountingType accountingType)
|
||||
throws ServiceException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public EnableTabs getEnableTabs() throws ServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.tabs.EnableTabs;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.workspace.ItemDescription;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -78,5 +79,13 @@ public interface AccountingManagerServiceAsync {
|
|||
*/
|
||||
void saveCSVOnWorkspace(AccountingType accountingType,
|
||||
AsyncCallback<ItemDescription> callback);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param callback return the list of enabled tabs
|
||||
*/
|
||||
void getEnableTabs(AsyncCallback<EnableTabs> callback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.admin.accountingmanager.server.amservice.AccountingCal
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.AccountingCallerInterface;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.AccountingCallerTester;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.export.CSVManager;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.is.BuildEnableTabs;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.state.AccountingStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.storage.StorageUtil;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
|
@ -22,6 +23,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.session.UserInfo;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.tabs.EnableTabs;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.workspace.ItemDescription;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -66,14 +68,14 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token=SessionUtil.getToken(aslSession);
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
UserInfo userInfo = new UserInfo(aslSession.getUsername(),
|
||||
aslSession.getGroupId(), aslSession.getGroupName(),
|
||||
aslSession.getScope(), aslSession.getScopeName(),
|
||||
aslSession.getUserEmailAddress(),
|
||||
aslSession.getUserFullName());
|
||||
logger.debug("UserInfo: "+userInfo);
|
||||
logger.debug("UserToken: "+token);
|
||||
logger.debug("UserInfo: " + userInfo);
|
||||
logger.debug("UserToken: " + token);
|
||||
return userInfo;
|
||||
} catch (ServiceException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -86,6 +88,27 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnableTabs getEnableTabs() throws ServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
EnableTabs enableTabs =BuildEnableTabs.build(aslSession.getScope());
|
||||
return enableTabs;
|
||||
|
||||
} catch (ServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
logger.error("getEnableTabs(): " + e.getLocalizedMessage(), e);
|
||||
throw new ServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -96,9 +119,9 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token=SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: "+token);
|
||||
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
AccountingCallerInterface accountingCaller;
|
||||
if (Constants.DEBUG_MODE) {
|
||||
accountingCaller = new AccountingCallerTester();
|
||||
|
@ -134,9 +157,9 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token=SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: "+token);
|
||||
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
AccountingCallerInterface accountingCaller;
|
||||
if (Constants.DEBUG_MODE) {
|
||||
accountingCaller = new AccountingCallerTester();
|
||||
|
@ -169,8 +192,8 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token=SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: "+token);
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
AccountingCallerInterface accountingCaller;
|
||||
if (Constants.DEBUG_MODE) {
|
||||
|
@ -200,17 +223,20 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token=SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: "+token);
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
logger.debug("SaveDataOnWorkspace(): " + accountingType);
|
||||
AccountingStateData accountingStateData = SessionUtil
|
||||
.getAccountingStateData(session, accountingType);
|
||||
if(accountingStateData==null){
|
||||
logger.error("No series present in session for thi accounting type: "+accountingType);
|
||||
throw new ServiceException("No series present in session for thi accounting type: "+accountingType);
|
||||
if (accountingStateData == null) {
|
||||
logger.error("No series present in session for thi accounting type: "
|
||||
+ accountingType);
|
||||
throw new ServiceException(
|
||||
"No series present in session for thi accounting type: "
|
||||
+ accountingType);
|
||||
}
|
||||
|
||||
|
||||
CSVManager csvManager = new CSVManager(aslSession.getUsername());
|
||||
ItemDescription itemDescription = csvManager
|
||||
.saveOnWorkspace(accountingStateData);
|
||||
|
@ -231,9 +257,9 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
String token=SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: "+token);
|
||||
|
||||
String token = SessionUtil.getToken(aslSession);
|
||||
logger.debug("UserToken: " + token);
|
||||
|
||||
logger.debug("GetPublicLink(): " + itemDescription);
|
||||
String link = StorageUtil.getPublicLink(aslSession.getUsername(),
|
||||
itemDescription.getId());
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.is;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.tabs.EnableTabData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.tabs.EnableTabs;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class BuildEnableTabs {
|
||||
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(BuildEnableTabs.class);
|
||||
|
||||
public static EnableTabs build(String scope) throws ServiceException {
|
||||
ArrayList<EnableTabData> enableTabDataList = new ArrayList<>();
|
||||
|
||||
if (Constants.DEBUG_MODE) {
|
||||
EnableTabData enableTabData=new EnableTabData(AccountingType.SERVICE,null);
|
||||
enableTabDataList.add(enableTabData);
|
||||
} else {
|
||||
List<EnableTab> enableTabList = InformationSystemUtils
|
||||
.retrieveEnableTab(scope);
|
||||
logger.debug("Enable Tab List: " + enableTabList);
|
||||
if (enableTabList != null && !enableTabList.isEmpty()) {
|
||||
AccountingType type;
|
||||
for (EnableTab enableTab : enableTabList) {
|
||||
type = AccountingType
|
||||
.getTypeFromString(enableTab.getName());
|
||||
if (type != null) {
|
||||
if (enableTab.getRoles() != null
|
||||
&& !enableTab.getRoles().isEmpty()) {
|
||||
ArrayList<String> enableRoles = new ArrayList<>();
|
||||
enableRoles.addAll(enableTab.getRoles());
|
||||
enableTabDataList.add(new EnableTabData(type,
|
||||
enableRoles));
|
||||
} else {
|
||||
enableTabDataList
|
||||
.add(new EnableTabData(type, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String error = "Error retrieving AccountingManager resource for get enable tabs in scope: "
|
||||
+ scope;
|
||||
logger.error(error);
|
||||
throw new ServiceException(error);
|
||||
}
|
||||
}
|
||||
|
||||
EnableTabs enableTabs = new EnableTabs(enableTabDataList);
|
||||
logger.debug("EnableTabs: "+enableTabs);
|
||||
return enableTabs;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.is;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "enabletab")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class EnableTab {
|
||||
@XmlElement
|
||||
private String name;
|
||||
|
||||
@XmlElementWrapper(name = "roles", required=false)
|
||||
@XmlElement(name = "role", required=false)
|
||||
private List<String> roles;
|
||||
|
||||
public List<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnableTab [name=" + name + ", roles=" + roles + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.is;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.resources.gcore.GenericResource;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.resources.discovery.icclient.ICFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class InformationSystemUtils {
|
||||
|
||||
public static final String ACCOUNTING_NAME = "AccountingManager";
|
||||
public static final String ACCOUNTING_CATEGORY = "ApplicationProfile";
|
||||
|
||||
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(InformationSystemUtils.class);
|
||||
|
||||
public static List<EnableTab> retrieveEnableTab(String scope) throws ServiceException {
|
||||
try {
|
||||
|
||||
if (scope == null || scope.length() == 0)
|
||||
return new ArrayList<EnableTab>();
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
|
||||
SimpleQuery query = ICFactory.queryFor(GenericResource.class);
|
||||
query.addCondition(
|
||||
"$resource/Profile/SecondaryType/text() eq '" + ACCOUNTING_CATEGORY + "'")
|
||||
.addCondition(
|
||||
"$resource/Profile/Name/text() eq '" + ACCOUNTING_NAME + "'")
|
||||
.setResult("$resource/Profile/Body/enabletab");
|
||||
DiscoveryClient<EnableTab> client = ICFactory.clientFor(EnableTab.class);
|
||||
List<EnableTab> accountingEnableTabs= client.submit(query);
|
||||
|
||||
logger.debug("Response: "+accountingEnableTabs);
|
||||
|
||||
return accountingEnableTabs;
|
||||
|
||||
} catch (Throwable e) {
|
||||
String error="Error in discovery Accounting Manager enabled tab in scope: "
|
||||
+ scope;
|
||||
logger.error(error);
|
||||
logger.error("Error: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(error, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,28 +1,36 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class Constants {
|
||||
public static final boolean DEBUG_MODE = false;
|
||||
|
||||
public static final boolean TEST_ENABLE = true;
|
||||
|
||||
public static final String APPLICATION_ID = "org.gcube.portlets.admin.accountingmanager.server.portlet.AccountingManagerPortlet";
|
||||
public static final String ACCOUNTING_MANAGER_ID = "AccountingManagerId";
|
||||
public static final String AM_LANG_COOKIE = "AMLangCookie";
|
||||
public static final String AM_LANG_COOKIE = "AMLangCookie";
|
||||
public static final String AM_LANG = "AMLang";
|
||||
public static final String DEFAULT_USER = "giancarlo.panichi";
|
||||
public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
||||
public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548";
|
||||
public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
|
||||
public final static String DEFAULT_TOKEN = "6af6eaff-35bd-4405-b747-f63246d0212a-98187548";
|
||||
|
||||
// public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
||||
// public final static String DEFAULT_TOKEN =
|
||||
// "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548";
|
||||
public static final String DEFAULT_ROLE = "OrganizationMember";
|
||||
|
||||
public static final String EXPORT_SERVLET="ExportServlet";
|
||||
public static final String EXPORT_SERVLET_TYPE_PARAMETER="ExportServletType";
|
||||
public static final String EXPORT_SERVLET = "ExportServlet";
|
||||
public static final String EXPORT_SERVLET_TYPE_PARAMETER = "ExportServletType";
|
||||
public static final String EXPORT_SERVLET_ACCOUNTING_TYPE_PARAMETER = "AccountingType";
|
||||
|
||||
public static final String SESSION_ACCOUNTING_STATE = "ACCOUNTING_STATE";
|
||||
|
||||
|
||||
public static final AccountingType[] DEFAULT_TABS = new AccountingType[] { AccountingType.STORAGE };;
|
||||
|
||||
}
|
||||
|
|
|
@ -15,5 +15,15 @@ public enum AccountingType {
|
|||
PORTLET,
|
||||
TASK,
|
||||
JOB;
|
||||
|
||||
public static AccountingType getTypeFromString(String value){
|
||||
for(AccountingType a:values()){
|
||||
if(a.name().compareToIgnoreCase(value)==0){
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.tabs;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class EnableTabData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6236674776252330224L;
|
||||
|
||||
private AccountingType accountingType;
|
||||
private ArrayList<String> enableRoles;
|
||||
|
||||
public EnableTabData() {
|
||||
super();
|
||||
}
|
||||
|
||||
public EnableTabData(AccountingType accountingType,
|
||||
ArrayList<String> enableRoles) {
|
||||
super();
|
||||
this.accountingType = accountingType;
|
||||
this.enableRoles = enableRoles;
|
||||
}
|
||||
|
||||
public AccountingType getAccountingType() {
|
||||
return accountingType;
|
||||
}
|
||||
|
||||
public void setAccountingType(AccountingType accountingType) {
|
||||
this.accountingType = accountingType;
|
||||
}
|
||||
|
||||
public ArrayList<String> getEnableRoles() {
|
||||
return enableRoles;
|
||||
}
|
||||
|
||||
public void setEnableRoles(ArrayList<String> enableRoles) {
|
||||
this.enableRoles = enableRoles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnableTabData [accountingType=" + accountingType
|
||||
+ ", enableRoles=" + enableRoles + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.tabs;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class EnableTabs implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6831995927636728501L;
|
||||
|
||||
private ArrayList<EnableTabData> tabs;
|
||||
|
||||
public EnableTabs() {
|
||||
super();
|
||||
}
|
||||
|
||||
public EnableTabs(ArrayList<EnableTabData> tabs) {
|
||||
super();
|
||||
this.tabs = tabs;
|
||||
}
|
||||
|
||||
public ArrayList<EnableTabData> getTabs() {
|
||||
return tabs;
|
||||
}
|
||||
|
||||
public void setTabs(ArrayList<EnableTabData> tabs) {
|
||||
this.tabs = tabs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnableTabs [tabs=" + tabs + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -3,21 +3,48 @@
|
|||
*/
|
||||
package org.gcube.portlets.admin.accountingmanager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.server.is.EnableTab;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.is.InformationSystemUtils;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TestAccountingMananger {
|
||||
public class TestAccountingMananger extends TestCase {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(TestAccountingMananger.class);
|
||||
|
||||
public void testAccountingManagerResource() {
|
||||
if (Constants.TEST_ENABLE) {
|
||||
logger.debug("Test Enabled");
|
||||
|
||||
try {
|
||||
logger.debug("Scope: "+Constants.DEFAULT_SCOPE);
|
||||
List<EnableTab> enableTab=InformationSystemUtils
|
||||
.retrieveEnableTab(Constants.DEFAULT_SCOPE);
|
||||
logger.debug("Enable Tab: "+enableTab);
|
||||
assertTrue(true);
|
||||
|
||||
} catch (Exception e) {
|
||||
assertTrue("Error searching the resource!",false);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.debug("Test Disabled");
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue