|
|
|
@ -102,91 +102,82 @@ public class AccountingManagerController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void callHello() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE
|
|
|
|
|
.hello(new AsyncCallback<UserInfo>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
Log.info("No valid user found: " + caught.getMessage());
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
UtilsGXT3.alert("Error", "Expired Session");
|
|
|
|
|
sessionExpiredShowDelayed();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Error", "No user found");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
Log.info("No valid user found: " + caught.getMessage());
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
UtilsGXT3.alert("Error", "Expired Session");
|
|
|
|
|
sessionExpiredShowDelayed();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Error", "No user found");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(UserInfo result) {
|
|
|
|
|
userInfo = result;
|
|
|
|
|
Log.info("Hello: " + userInfo.getUsername());
|
|
|
|
|
isRootScope();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(UserInfo result) {
|
|
|
|
|
userInfo = result;
|
|
|
|
|
Log.info("Hello: " + userInfo.getUsername());
|
|
|
|
|
isRootScope();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void isRootScope() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE
|
|
|
|
|
.isRootScope(new AsyncCallback<Boolean>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.isRootScope(new AsyncCallback<Boolean>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
Log.info("No valid user found: " + caught.getMessage());
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
UtilsGXT3.alert("Error", "Expired Session");
|
|
|
|
|
sessionExpiredShowDelayed();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
"Error checking the scope!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
Log.info("No valid user found: " + caught.getMessage());
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
UtilsGXT3.alert("Error", "Expired Session");
|
|
|
|
|
sessionExpiredShowDelayed();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Error", "Error checking the scope!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Boolean result) {
|
|
|
|
|
rootScope = result;
|
|
|
|
|
Log.info("RootScope: " + result);
|
|
|
|
|
retrieveEnableTabs();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Boolean result) {
|
|
|
|
|
rootScope = result;
|
|
|
|
|
Log.info("RootScope: " + result);
|
|
|
|
|
retrieveEnableTabs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void retrieveEnableTabs() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE
|
|
|
|
|
.getEnableTabs(new AsyncCallback<EnableTabs>() {
|
|
|
|
|
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 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);
|
|
|
|
|
doEnableTabs(enableTabs);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(EnableTabs enableTabs) {
|
|
|
|
|
Log.info("Enable Tabs: " + enableTabs);
|
|
|
|
|
doEnableTabs(enableTabs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doEnableTabs(EnableTabs enableTabs) {
|
|
|
|
|
if (enableTabs == null || enableTabs.getTabs() == null
|
|
|
|
|
|| enableTabs.getTabs().isEmpty()) {
|
|
|
|
|
UtilsGXT3
|
|
|
|
|
.alert("Attention",
|
|
|
|
|
"You don't have permissions to see Accounting Information in this scope!");
|
|
|
|
|
if (enableTabs == null || enableTabs.getTabs() == null || enableTabs.getTabs().isEmpty()) {
|
|
|
|
|
UtilsGXT3.alert("Attention", "You don't have permissions to see Accounting Information in this scope!");
|
|
|
|
|
} else {
|
|
|
|
|
this.enableTabs = enableTabs;
|
|
|
|
|
EnableTabsEvent event = new EnableTabsEvent(enableTabs);
|
|
|
|
@ -216,8 +207,7 @@ public class AccountingManagerController {
|
|
|
|
|
Log.debug("Locale avaible:" + locale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
|
|
|
|
|
.getLocaleCookieName());
|
|
|
|
|
String currentLocaleCookie = Cookies.getCookie(LocaleInfo.getLocaleCookieName());
|
|
|
|
|
Log.debug(Constants.AM_LANG_COOKIE + ":" + currentLocaleCookie);
|
|
|
|
|
|
|
|
|
|
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
|
|
|
@ -246,47 +236,43 @@ public class AccountingManagerController {
|
|
|
|
|
|
|
|
|
|
// Bind Controller to events on bus
|
|
|
|
|
private void bindToEvents() {
|
|
|
|
|
eventBus.addHandler(SessionExpiredEvent.TYPE,
|
|
|
|
|
new SessionExpiredEvent.SessionExpiredEventHandler() {
|
|
|
|
|
eventBus.addHandler(SessionExpiredEvent.TYPE, new SessionExpiredEvent.SessionExpiredEventHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSessionExpired(SessionExpiredEvent event) {
|
|
|
|
|
Log.debug("Catch Event SessionExpiredEvent");
|
|
|
|
|
doSessionExpiredCommand(event);
|
|
|
|
|
@Override
|
|
|
|
|
public void onSessionExpired(SessionExpiredEvent event) {
|
|
|
|
|
Log.debug("Catch Event SessionExpiredEvent");
|
|
|
|
|
doSessionExpiredCommand(event);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
eventBus.addHandler(AccountingMenuEvent.TYPE,
|
|
|
|
|
new AccountingMenuEvent.AccountingMenuEventHandler() {
|
|
|
|
|
eventBus.addHandler(AccountingMenuEvent.TYPE, new AccountingMenuEvent.AccountingMenuEventHandler() {
|
|
|
|
|
|
|
|
|
|
public void onMenu(AccountingMenuEvent event) {
|
|
|
|
|
Log.debug("Catch Event AccountingMenuEvent");
|
|
|
|
|
doMenuCommand(event);
|
|
|
|
|
public void onMenu(AccountingMenuEvent event) {
|
|
|
|
|
Log.debug("Catch Event AccountingMenuEvent");
|
|
|
|
|
doMenuCommand(event);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
eventBus.addHandler(FiltersChangeEvent.TYPE,
|
|
|
|
|
new FiltersChangeEvent.FiltersChangeEventHandler() {
|
|
|
|
|
eventBus.addHandler(FiltersChangeEvent.TYPE, new FiltersChangeEvent.FiltersChangeEventHandler() {
|
|
|
|
|
|
|
|
|
|
public void onFiltersChange(FiltersChangeEvent event) {
|
|
|
|
|
Log.debug("Catch Event FiltersChangeEvent");
|
|
|
|
|
doFiltersChangeCommand(event);
|
|
|
|
|
public void onFiltersChange(FiltersChangeEvent event) {
|
|
|
|
|
Log.debug("Catch Event FiltersChangeEvent");
|
|
|
|
|
doFiltersChangeCommand(event);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
eventBus.addHandler(ExportRequestEvent.TYPE,
|
|
|
|
|
new ExportRequestEvent.ExportRequestEventHandler() {
|
|
|
|
|
eventBus.addHandler(ExportRequestEvent.TYPE, new ExportRequestEvent.ExportRequestEventHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onExport(ExportRequestEvent event) {
|
|
|
|
|
Log.debug("Catch ExportRequestEvent");
|
|
|
|
|
doExportRequest(event);
|
|
|
|
|
@Override
|
|
|
|
|
public void onExport(ExportRequestEvent event) {
|
|
|
|
|
Log.debug("Catch ExportRequestEvent");
|
|
|
|
|
doExportRequest(event);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
eventBus.fireEvent(new UIStateEvent(UIStateType.START));
|
|
|
|
|
|
|
|
|
@ -305,14 +291,12 @@ public class AccountingManagerController {
|
|
|
|
|
case JOB:
|
|
|
|
|
case SPACE:
|
|
|
|
|
Log.debug("AccountingType: " + event.getAccountingType());
|
|
|
|
|
accountingStateData = accountingState.getState(event
|
|
|
|
|
.getAccountingType());
|
|
|
|
|
accountingStateData = accountingState.getState(event.getAccountingType());
|
|
|
|
|
if (accountingStateData == null) {
|
|
|
|
|
createDefaultChart(event.getAccountingType());
|
|
|
|
|
} else {
|
|
|
|
|
accountingType = event.getAccountingType();
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore, accountingStateData);
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -323,8 +307,7 @@ public class AccountingManagerController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void showDefault() {
|
|
|
|
|
if (enableTabs != null && enableTabs.getTabs() != null
|
|
|
|
|
&& enableTabs.getTabs().size() > 0
|
|
|
|
|
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());
|
|
|
|
@ -335,8 +318,7 @@ public class AccountingManagerController {
|
|
|
|
|
accountingMonitor = new AccountingMonitor();
|
|
|
|
|
this.accountingType = accountingType;
|
|
|
|
|
|
|
|
|
|
AccountingClientStateData accountingStateData = new AccountingClientStateData(
|
|
|
|
|
accountingType, rootScope);
|
|
|
|
|
AccountingClientStateData accountingStateData = new AccountingClientStateData(accountingType, rootScope);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
|
|
|
|
|
retrieveFilterKey();
|
|
|
|
@ -345,102 +327,84 @@ public class AccountingManagerController {
|
|
|
|
|
|
|
|
|
|
private void retrieveFilterKey() {
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getFilterKeys(accountingType,
|
|
|
|
|
new AsyncCallback<ArrayList<FilterKey>>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getFilterKeys(accountingType, new AsyncCallback<ArrayList<FilterKey>>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error retrieving filter keys for "
|
|
|
|
|
+ accountingType + ":"
|
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error retrieving filter keys",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error(
|
|
|
|
|
"Error retrieving filter keys for " + accountingType + ":" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error retrieving filter keys", caught.getLocalizedMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(ArrayList<FilterKey> result) {
|
|
|
|
|
Log.debug("FilterKeys: " + result);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData.setAvailableFilterKeys(result);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
retrieveContext();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(ArrayList<FilterKey> result) {
|
|
|
|
|
Log.debug("FilterKeys: " + result);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setAvailableFilterKeys(result);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
retrieveContext();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void retrieveContext() {
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE
|
|
|
|
|
.getContext(new AsyncCallback<Context>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getContext(new AsyncCallback<Context>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
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 onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
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);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData.setAvailableContext(result);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
retrieveSpace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Context result) {
|
|
|
|
|
Log.debug("Available Context: " + result);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setAvailableContext(result);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
retrieveSpace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void retrieveSpace() {
|
|
|
|
|
if (rootScope) {
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE
|
|
|
|
|
.getSpaces(new AsyncCallback<Spaces>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getSpaces(new AsyncCallback<Spaces>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error retrieving sapces for "
|
|
|
|
|
+ accountingType + ":"
|
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error retrieving spaces ",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error retrieving sapces for " + accountingType + ":" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error retrieving spaces ", caught.getLocalizedMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Spaces result) {
|
|
|
|
|
Log.debug("Available Spaces: " + result);
|
|
|
|
|
createDefaultSeriesRequest(result);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Spaces result) {
|
|
|
|
|
Log.debug("Available Spaces: " + result);
|
|
|
|
|
createDefaultSeriesRequest(result);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
createDefaultSeriesRequest(null);
|
|
|
|
|
}
|
|
|
|
@ -448,17 +412,14 @@ public class AccountingManagerController {
|
|
|
|
|
|
|
|
|
|
private void createDefaultSeriesRequest(Spaces spaces) {
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
DateTimeFormat dtf = DateTimeFormat
|
|
|
|
|
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
|
|
|
|
DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
|
|
|
|
String currentDate = dtf.format(now);
|
|
|
|
|
Date date = dtf.parse(currentDate);
|
|
|
|
|
Date lastMonth = new Date(date.getTime());
|
|
|
|
|
CalendarUtil.addMonthsToDate(lastMonth, -1);
|
|
|
|
|
Log.debug("LastMoth= " + dtf.format(lastMonth) + " , date="
|
|
|
|
|
+ dtf.format(date));
|
|
|
|
|
Log.debug("LastMoth= " + dtf.format(lastMonth) + " , date=" + dtf.format(date));
|
|
|
|
|
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
SeriesRequest seriesRequest = null;
|
|
|
|
|
|
|
|
|
|
switch (accountingType) {
|
|
|
|
@ -467,18 +428,17 @@ public class AccountingManagerController {
|
|
|
|
|
case SERVICE:
|
|
|
|
|
case STORAGE:
|
|
|
|
|
case TASK:
|
|
|
|
|
seriesRequest = new SeriesRequest(new AccountingPeriod(
|
|
|
|
|
dtf.format(lastMonth), dtf.format(date),
|
|
|
|
|
AccountingPeriodMode.DAILY), new AccountingFilterBasic());
|
|
|
|
|
seriesRequest = new SeriesRequest(
|
|
|
|
|
new AccountingPeriod(dtf.format(lastMonth), dtf.format(date), AccountingPeriodMode.DAILY),
|
|
|
|
|
new AccountingFilterBasic());
|
|
|
|
|
Log.debug("DefaultSeriesRequest: " + seriesRequest);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case SPACE:
|
|
|
|
|
accountingStateData.setAvailableSpaces(spaces);
|
|
|
|
|
seriesRequest = new SeriesRequest(new AccountingPeriod(
|
|
|
|
|
dtf.format(lastMonth), dtf.format(date),
|
|
|
|
|
AccountingPeriodMode.DAILY), new AccountingFilterSpaces(
|
|
|
|
|
spaces));
|
|
|
|
|
seriesRequest = new SeriesRequest(
|
|
|
|
|
new AccountingPeriod(dtf.format(lastMonth), dtf.format(date), AccountingPeriodMode.DAILY),
|
|
|
|
|
new AccountingFilterSpaces(spaces));
|
|
|
|
|
Log.debug("DefaultSeriesRequest: " + seriesRequest);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
@ -494,8 +454,7 @@ public class AccountingManagerController {
|
|
|
|
|
private void callDefaultSeriesRequest() {
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getSeriesInCache(accountingType,
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(),
|
|
|
|
|
new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(), new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(SeriesResponse seriesResponse) {
|
|
|
|
@ -503,14 +462,10 @@ public class AccountingManagerController {
|
|
|
|
|
if (seriesResponse == null) {
|
|
|
|
|
callDefaultSeriesRequestNoCache();
|
|
|
|
|
} else {
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData
|
|
|
|
|
.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore,
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
@ -521,21 +476,16 @@ public class AccountingManagerController {
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore, accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -548,8 +498,7 @@ public class AccountingManagerController {
|
|
|
|
|
private void callDefaultSeriesRequestNoCache() {
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getSeries(accountingType,
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(),
|
|
|
|
|
new AsyncCallback<String>() {
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(), new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(String operationId) {
|
|
|
|
@ -557,16 +506,12 @@ public class AccountingManagerController {
|
|
|
|
|
if (operationId == null || operationId.isEmpty()) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
Log.error("Invalid Operation Id: " + operationId);
|
|
|
|
|
UtilsGXT3.alert("Error", "Invalid Operation Id: "
|
|
|
|
|
+ operationId);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
UtilsGXT3.alert("Error", "Invalid Operation Id: " + operationId);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore, accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
} else {
|
|
|
|
|
defaultOperationMonitor(operationId);
|
|
|
|
@ -577,21 +522,16 @@ public class AccountingManagerController {
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore, accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -609,26 +549,20 @@ public class AccountingManagerController {
|
|
|
|
|
public void onMonitor(MonitorRequestEvent event) {
|
|
|
|
|
switch (event.getMonitorRequestType()) {
|
|
|
|
|
case Period:
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.operationMonitor(
|
|
|
|
|
operationId, new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.operationMonitor(operationId,
|
|
|
|
|
new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(
|
|
|
|
|
SeriesResponse seriesResponse) {
|
|
|
|
|
Log.debug("SeriesResponse: "
|
|
|
|
|
+ seriesResponse);
|
|
|
|
|
public void onSuccess(SeriesResponse seriesResponse) {
|
|
|
|
|
Log.debug("SeriesResponse: " + seriesResponse);
|
|
|
|
|
if (seriesResponse != null) {
|
|
|
|
|
monitorRequest.stop();
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData
|
|
|
|
|
.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(
|
|
|
|
|
accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
accountingStateData.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeType.Restore, accountingStateData);
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
} else {
|
|
|
|
@ -641,25 +575,17 @@ public class AccountingManagerController {
|
|
|
|
|
monitorRequest.stop();
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:"
|
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData
|
|
|
|
|
.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(
|
|
|
|
|
accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore,
|
|
|
|
|
accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
StateChangeType.Restore, accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -674,13 +600,10 @@ public class AccountingManagerController {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
Log.error("Error: TimeOut!");
|
|
|
|
|
UtilsGXT3.alert("Error Time Out", "Time Out");
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Restore,
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Restore,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
break;
|
|
|
|
@ -702,8 +625,7 @@ public class AccountingManagerController {
|
|
|
|
|
switch (event.getFiltersChangeType()) {
|
|
|
|
|
case Update:
|
|
|
|
|
SeriesRequest seriesRequest = event.getSeriesRequest();
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
if (accountingStateData != null) {
|
|
|
|
|
accountingMonitor = new AccountingMonitor();
|
|
|
|
|
accountingStateData.setSeriesRequest(seriesRequest);
|
|
|
|
@ -724,8 +646,7 @@ public class AccountingManagerController {
|
|
|
|
|
+ accountingState.getState(accountingType).getSeriesRequest());
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getSeriesInCache(accountingType,
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(),
|
|
|
|
|
new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(), new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(SeriesResponse seriesResponse) {
|
|
|
|
@ -734,14 +655,11 @@ public class AccountingManagerController {
|
|
|
|
|
// TODO
|
|
|
|
|
callSeriesRequestNoCache();
|
|
|
|
|
} else {
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData
|
|
|
|
|
.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update, accountingStateData);
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
}
|
|
|
|
@ -751,21 +669,16 @@ public class AccountingManagerController {
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update, accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -777,8 +690,7 @@ public class AccountingManagerController {
|
|
|
|
|
private void callSeriesRequestNoCache() {
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getSeries(accountingType,
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(),
|
|
|
|
|
new AsyncCallback<String>() {
|
|
|
|
|
accountingState.getState(accountingType).getSeriesRequest(), new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(String operationId) {
|
|
|
|
@ -786,16 +698,12 @@ public class AccountingManagerController {
|
|
|
|
|
if (operationId == null || operationId.isEmpty()) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
Log.error("Invalid Operation Id: " + operationId);
|
|
|
|
|
UtilsGXT3.alert("Error", "Invalid Operation Id: "
|
|
|
|
|
+ operationId);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
UtilsGXT3.alert("Error", "Invalid Operation Id: " + operationId);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update, accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
} else {
|
|
|
|
|
operationMonitor(operationId);
|
|
|
|
@ -806,21 +714,16 @@ public class AccountingManagerController {
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update, accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -837,25 +740,19 @@ public class AccountingManagerController {
|
|
|
|
|
public void onMonitor(MonitorRequestEvent event) {
|
|
|
|
|
switch (event.getMonitorRequestType()) {
|
|
|
|
|
case Period:
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.operationMonitor(
|
|
|
|
|
operationId, new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.operationMonitor(operationId,
|
|
|
|
|
new AsyncCallback<SeriesResponse>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(
|
|
|
|
|
SeriesResponse seriesResponse) {
|
|
|
|
|
Log.debug("SeriesResponse: "
|
|
|
|
|
+ seriesResponse);
|
|
|
|
|
public void onSuccess(SeriesResponse seriesResponse) {
|
|
|
|
|
Log.debug("SeriesResponse: " + seriesResponse);
|
|
|
|
|
if (seriesResponse != null) {
|
|
|
|
|
monitorRequest.stop();
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData
|
|
|
|
|
.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(
|
|
|
|
|
accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update,
|
|
|
|
|
accountingStateData.setSeriesResponse(seriesResponse);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
@ -869,25 +766,17 @@ public class AccountingManagerController {
|
|
|
|
|
monitorRequest.stop();
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:"
|
|
|
|
|
+ caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
accountingStateData
|
|
|
|
|
.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(
|
|
|
|
|
accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update,
|
|
|
|
|
accountingState
|
|
|
|
|
.getState(accountingType));
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -901,13 +790,10 @@ public class AccountingManagerController {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
Log.error("Error: TimeOut!");
|
|
|
|
|
UtilsGXT3.alert("Error Time Out", "Time Out");
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState
|
|
|
|
|
.getState(accountingType);
|
|
|
|
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
|
|
|
|
accountingStateData.setSeriesResponse(null);
|
|
|
|
|
accountingState.setState(accountingType,
|
|
|
|
|
accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
|
|
|
|
StateChangeType.Update,
|
|
|
|
|
accountingState.setState(accountingType, accountingStateData);
|
|
|
|
|
StateChangeEvent stateChangeEvent = new StateChangeEvent(StateChangeType.Update,
|
|
|
|
|
accountingState.getState(accountingType));
|
|
|
|
|
eventBus.fireEvent(stateChangeEvent);
|
|
|
|
|
break;
|
|
|
|
@ -926,23 +812,19 @@ public class AccountingManagerController {
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private void doSaveDataOnWorkspace(ExportRequestEvent event) {
|
|
|
|
|
accountingMonitor = new AccountingMonitor();
|
|
|
|
|
Log.debug("Call saveCSVOnWorkspace on server, params: "
|
|
|
|
|
+ event.getAccountingType());
|
|
|
|
|
Log.debug("Call saveCSVOnWorkspace on server, params: " + event.getAccountingType());
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.saveCSVOnWorkspace(
|
|
|
|
|
event.getAccountingType(),
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.saveCSVOnWorkspace(event.getAccountingType(),
|
|
|
|
|
new AsyncCallback<ItemDescription>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -951,50 +833,19 @@ public class AccountingManagerController {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(ItemDescription result) {
|
|
|
|
|
Log.debug("ItemDescription: " + result);
|
|
|
|
|
doDownloadCSVFromWorkspace(result);
|
|
|
|
|
// doDownloadCSVFromWorkspace(result);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doDownloadCSVFromWorkspace(
|
|
|
|
|
final ItemDescription itemDescription) {
|
|
|
|
|
Log.debug("DownloadCSV from server: " + itemDescription);
|
|
|
|
|
|
|
|
|
|
AccountingManagerServiceAsync.INSTANCE.getPublicLink(itemDescription,
|
|
|
|
|
new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
if (caught instanceof SessionExpiredException) {
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
} else {
|
|
|
|
|
Log.error("Error:" + caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
caught.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(String link) {
|
|
|
|
|
accountingMonitor.hide();
|
|
|
|
|
Log.debug("Retrieved link: " + link);
|
|
|
|
|
Window.open(link, itemDescription.getName(), "");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doExportRequest(ExportRequestEvent event) {
|
|
|
|
|
StringBuilder actionUrl = new StringBuilder();
|
|
|
|
|
actionUrl.append(GWT.getModuleBaseURL());
|
|
|
|
|
actionUrl.append(Constants.EXPORT_SERVLET + "?"
|
|
|
|
|
+ Constants.EXPORT_SERVLET_TYPE_PARAMETER + "="
|
|
|
|
|
+ event.getExportType().name() + "&"
|
|
|
|
|
+ Constants.EXPORT_SERVLET_ACCOUNTING_TYPE_PARAMETER + "="
|
|
|
|
|
+ event.getAccountingType().name() + "&"
|
|
|
|
|
+ Constants.CURR_GROUP_ID + "="
|
|
|
|
|
actionUrl.append(Constants.EXPORT_SERVLET + "?" + Constants.EXPORT_SERVLET_TYPE_PARAMETER + "="
|
|
|
|
|
+ event.getExportType().name() + "&" + Constants.EXPORT_SERVLET_ACCOUNTING_TYPE_PARAMETER + "="
|
|
|
|
|
+ event.getAccountingType().name() + "&" + Constants.CURR_GROUP_ID + "="
|
|
|
|
|
+ GCubeClientContext.getCurrentContextId());
|
|
|
|
|
|
|
|
|
|
// + "&"
|
|
|
|
@ -1002,8 +853,7 @@ public class AccountingManagerController {
|
|
|
|
|
// + GCubeClientContext.getCurrentUserId());
|
|
|
|
|
|
|
|
|
|
Log.debug("Retrieved link: " + actionUrl);
|
|
|
|
|
Window.open(actionUrl.toString(), event.getAccountingType().toString(),
|
|
|
|
|
"");
|
|
|
|
|
Window.open(actionUrl.toString(), "_blank", "");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1016,8 +866,7 @@ public class AccountingManagerController {
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private void asyncCodeLoadingFailed(Throwable reason) {
|
|
|
|
|
Log.error("Async code loading failed", reason);
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(
|
|
|
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|