Updated Accounting Manager
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@117365 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
012eb588cb
commit
d1fcba4a42
|
@ -4,6 +4,9 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="accounting-manager-theme-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/accounting-manager-theme/accounting-manager-theme">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/tabular-data-manager/target/tabular-data-manager-2.6.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<property name="context-root" value="accounting-manager"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="accountingman.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/accounting-manager"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="accounting-manager"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.nowarn.legacy.tools"/>
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="accountingman.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/accounting-manager"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -port 8888 accountingman.html"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="accounting-manager"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -Dgwt.nowarn.legacy.tools"/>
|
||||
</launchConfiguration>
|
||||
|
|
40
pom.xml
40
pom.xml
|
@ -95,6 +95,8 @@
|
|||
<version>${gwtVersion}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-dev</artifactId>
|
||||
<version>${gwtVersion}</version> </dependency> -->
|
||||
|
||||
|
@ -105,14 +107,27 @@
|
|||
<version>${gxtVersion}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Accounting Manager Theme -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>accounting-manager-theme</artifactId>
|
||||
<version>[0.0.1-SNAPSHOT,
|
||||
2.0.0-SNAPSHOT)</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-dev</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> <groupId>com.sencha.gxt</groupId> <artifactId>gxt-theme-neptune</artifactId>
|
||||
<version>${gxtVersion}</version> <scope>system</scope> <systemPath>${basedir}/lib/gxt-theme-neptune-3.1.1.jar</systemPath>
|
||||
</dependency> -->
|
||||
|
||||
<!-- <dependency> <groupId>com.sencha.gxt</groupId> <artifactId>gxt-theme-neptune</artifactId>
|
||||
<version>${gxtVersion}</version> </dependency> -->
|
||||
|
||||
|
||||
<!-- GXT-Theme-Neptune
|
||||
<dependency>
|
||||
<groupId>com.sencha.gxt</groupId>
|
||||
<artifactId>gxt-theme-neptune</artifactId>
|
||||
<version>${gxtVersion}</version>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sencha.gxt</groupId>
|
||||
|
@ -126,8 +141,6 @@
|
|||
<version>0.0.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> <groupId>org.gcube.portlets.admin</groupId> <artifactId>accounting-manager-highcharts</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version> </dependency> -->
|
||||
|
||||
<!-- Portlet -->
|
||||
<dependency>
|
||||
|
@ -195,15 +208,8 @@
|
|||
<version>[0.2.0-SNAPSHOT,1.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Accounting Manager Theme <dependency> <groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>accounting-manager-theme</artifactId> <version>[0.0.1-SNAPSHOT,
|
||||
2.0.0-SNAPSHOT)</version> </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sencha.gxt</groupId>
|
||||
<artifactId>gxt-theme-neptune</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- Accounting Analytics -->
|
||||
|
|
|
@ -88,9 +88,7 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
FieldLabel startDateLabel = new FieldLabel(startDate, "Start Date");
|
||||
|
||||
endDate = new DateField();
|
||||
endDate.addValidator(new MaxDateValidator(new Date()));
|
||||
endDate.addValidator(new EmptyValidator<Date>());
|
||||
|
||||
endDate.addParseErrorHandler(new ParseErrorEvent.ParseErrorHandler() {
|
||||
@Override
|
||||
public void onParseError(ParseErrorEvent event) {
|
||||
|
@ -125,7 +123,7 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
comboPeriodMode.setTriggerAction(TriggerAction.ALL);
|
||||
comboPeriodMode.setValue(AccountingPeriodMode.DAILY);
|
||||
addHandlersForComboPeriodMode(props.label());
|
||||
|
||||
|
||||
Log.debug("ComboPeriodMode created");
|
||||
|
||||
FieldLabel periodModeLabel = new FieldLabel(comboPeriodMode,
|
||||
|
@ -158,23 +156,26 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void addHandlersForComboPeriodMode(
|
||||
final LabelProvider<AccountingPeriodMode> labelProvider) {
|
||||
comboPeriodMode.addSelectionHandler(new SelectionHandler<AccountingPeriodMode>() {
|
||||
public void onSelection(SelectionEvent<AccountingPeriodMode> event) {
|
||||
Info.display(
|
||||
"Aggregation",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
Log.debug("ComboPeriodMode selected: " + event.getSelectedItem());
|
||||
|
||||
}
|
||||
comboPeriodMode
|
||||
.addSelectionHandler(new SelectionHandler<AccountingPeriodMode>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<AccountingPeriodMode> event) {
|
||||
Info.display(
|
||||
"Aggregation",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboPeriodMode selected: "
|
||||
+ event.getSelectedItem());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void doStateChangeCommand(StateChangeEvent event) {
|
||||
|
@ -195,12 +196,15 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
private void onRestoreStateChange(StateChangeEvent event) {
|
||||
if (event.getAccountingStateData()!=null&&event.getAccountingStateData().getSeriesRequest() != null
|
||||
&& event.getAccountingStateData().getSeriesRequest().getAccountingPeriod() != null) {
|
||||
AccountingPeriod accountingPeriod = event.getAccountingStateData().getSeriesRequest()
|
||||
.getAccountingPeriod();
|
||||
if (event.getAccountingStateData() != null
|
||||
&& event.getAccountingStateData().getSeriesRequest() != null
|
||||
&& event.getAccountingStateData().getSeriesRequest()
|
||||
.getAccountingPeriod() != null) {
|
||||
AccountingPeriod accountingPeriod = event.getAccountingStateData()
|
||||
.getSeriesRequest().getAccountingPeriod();
|
||||
startDate.setValue(accountingPeriod.getStartDate());
|
||||
endDate.setValue(accountingPeriod.getEndDate());
|
||||
|
||||
comboPeriodMode.setValue(accountingPeriod.getPeriod());
|
||||
} else {
|
||||
startDate.reset();
|
||||
|
@ -213,31 +217,51 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
public AccountingPeriod getAccountingPeriod() {
|
||||
try {
|
||||
|
||||
if (startDate.validate() && endDate.validate()) {
|
||||
Date startD = startDate.getCurrentValue();
|
||||
Date endD = endDate.getCurrentValue();
|
||||
if (startD.compareTo(endD) <= 0) {
|
||||
if (comboPeriodMode.validate()
|
||||
&& comboPeriodMode.getCurrentValue() != null) {
|
||||
AccountingPeriod accountingPeriod = new AccountingPeriod(
|
||||
startD, endD, comboPeriodMode.getCurrentValue());
|
||||
return accountingPeriod;
|
||||
if (endDate.getCurrentValue().compareTo(new Date()) <= 0) {
|
||||
|
||||
Date startD = startDate.getCurrentValue();
|
||||
Date endD = endDate.getCurrentValue();
|
||||
if (startD.compareTo(endD) <= 0) {
|
||||
if (comboPeriodMode.validate()
|
||||
&& comboPeriodMode.getCurrentValue() != null) {
|
||||
AccountingPeriod accountingPeriod = new AccountingPeriod(
|
||||
startD, endD, comboPeriodMode.getCurrentValue());
|
||||
return accountingPeriod;
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Select a valid aggregation mode!");
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Select a valid aggregation mode!");
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
"The start date must be less than or equal to the end date!");
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
String endD=DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(new Date());
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
"The start date must be less than or equal to the end date!");
|
||||
"The end date must be "+endD+" or earlier!");
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
} catch(Throwable e){
|
||||
Log.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
e.getLocalizedMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||
import org.gcube.accounting.analytics.ResourceRecordQuery;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Job;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Portlet;
|
||||
|
@ -45,9 +44,9 @@ public class AccountingCaller {
|
|||
SeriesRequest seriesRequest)
|
||||
throws AccountingManagerServiceException {
|
||||
try {
|
||||
logger.debug("getSeries(): [AccountingType="+accountingType+" , seriesRequest=" + seriesRequest+"]");
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
logger.debug("getSeries(): [AccountingType=" + accountingType
|
||||
+ " , seriesRequest=" + seriesRequest + "]");
|
||||
ResourceRecordQuery rrq = new ResourceRecordQuery();
|
||||
|
||||
AccountingQueryBuilder queryBuilder = getAccountQueryBuilder(
|
||||
accountingType, seriesRequest);
|
||||
|
@ -62,14 +61,14 @@ public class AccountingCaller {
|
|||
"Error in invocation: Operation not supported");
|
||||
}
|
||||
|
||||
List<Info> infos = apq.query(query.getType(),
|
||||
List<Info> infos = rrq.getInfo(query.getType(),
|
||||
query.getTemporalConstraint(), null);
|
||||
if (infos == null) {
|
||||
throw new AccountingManagerServiceException(
|
||||
"Error retrieving list of info: list is null!");
|
||||
}
|
||||
logger.debug("Retrieved Infos");
|
||||
|
||||
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||
accountingType, infos);
|
||||
|
||||
|
|
Loading…
Reference in New Issue