Refs #21729: Investigate errors generated in the Root scope

Disabled Spaces in root
This commit is contained in:
Giancarlo Panichi 2021-06-28 19:15:49 +02:00
parent 0c8a85ee73
commit 36f917f6b5
1 changed files with 41 additions and 39 deletions

View File

@ -107,7 +107,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
Log.error("No valid user found: " + caught.getMessage());
Log.error("No valid user found: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
sessionExpiredShowDelayed();
@ -132,7 +132,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
Log.error("Error in check root scope: " + caught.getMessage());
Log.error("Error in check root scope: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
sessionExpiredShowDelayed();
@ -145,46 +145,19 @@ public class AccountingManagerController {
public void onSuccess(Boolean result) {
rootScope = result;
Log.info("RootScope: " + result);
retrieveContext();
}
});
}
private void retrieveContext() {
AccountingManagerServiceAsync.INSTANCE.getContext(new AsyncCallback<Context>() {
@Override
public void onFailure(Throwable caught) {
Log.error("Error in retrieve context: " + caught.getMessage());
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrieving contexts for " + accountingType + ":" + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving contexts ", caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Context result) {
Log.debug("Available Context: " + result);
availableContext=result;
retrieveEnableTabs();
}
});
}
private void retrieveEnableTabs() {
AccountingManagerServiceAsync.INSTANCE.getEnableTabs(new AsyncCallback<EnableTabs>() {
@Override
public void onFailure(Throwable caught) {
Log.error("Error retrieving enable tabs: " + caught.getLocalizedMessage());
Log.error("Error retrieving enable tabs: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
sessionExpiredShowDelayed();
@ -321,7 +294,7 @@ public class AccountingManagerController {
Log.debug("AccountingType: " + event.getAccountingType());
accountingStateData = accountingState.getState(event.getAccountingType());
if (accountingStateData == null) {
createDefaultChart(event.getAccountingType());
configureDefaultChart(event.getAccountingType());
} else {
accountingType = event.getAccountingType();
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore, accountingStateData);
@ -338,19 +311,51 @@ public class AccountingManagerController {
if (enableTabs != null && enableTabs.getTabs() != null && enableTabs.getTabs().size() > 0
&& enableTabs.getTabs().get(0) != null) {
Log.debug("Create DefaultChart");
createDefaultChart(enableTabs.getTabs().get(0).getAccountingType());
configureDefaultChart(enableTabs.getTabs().get(0).getAccountingType());
}
}
private void createDefaultChart(AccountingType accountingType) {
private void configureDefaultChart(AccountingType accountingType) {
accountingMonitor = new AccountingMonitor();
this.accountingType = accountingType;
if (availableContext == null) {
retrieveContext();
} else {
createDefaultChart();
}
}
private void createDefaultChart() {
AccountingClientStateData accountingStateData = new AccountingClientStateData(accountingType, rootScope);
accountingStateData.setAvailableContext(availableContext);
accountingState.setState(accountingType, accountingStateData);
retrieveFilterKey();
}
private void retrieveContext() {
AccountingManagerServiceAsync.INSTANCE.getContext(new AsyncCallback<Context>() {
@Override
public void onFailure(Throwable caught) {
accountingMonitor.hide();
Log.error("Error retrieving contexts: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
UtilsGXT3.alert("Error retrieving contexts ", caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Context result) {
Log.debug("Available Context: " + result);
availableContext = result;
createDefaultChart();
}
});
}
@ -361,6 +366,7 @@ public class AccountingManagerController {
@Override
public void onFailure(Throwable caught) {
accountingMonitor.hide();
Log.error("Error retrieving filter keys: " + caught.getLocalizedMessage(), caught);
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
} else {
@ -383,8 +389,6 @@ public class AccountingManagerController {
}
private void retrieveSpace() {
if (rootScope) {
@ -841,8 +845,6 @@ public class AccountingManagerController {
});
}
private void doExportRequest(ExportRequestEvent event) {
StringBuilder actionUrl = new StringBuilder();
actionUrl.append(GWT.getModuleBaseURL());